exam 2 Flashcards

1
Q

a ____ is a sequence of statements only executed under a certain condition.

A

branch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

An ____ branch is a branch taken only if an expression is true.

A

if

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

An ____ branch has two branches: The first branch is executed if an expression is true, else the other branch is executed.

A

if-else

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The ____ evaluates to True if the left and right sides are equal.

A

equality operator (==)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The ____ evaluates to True if the left and right sides are not equal, or different.

A

inequality operator (!=)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

A ____ is a type that has just two values: True or False.

A

Boolean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A ____ checks how one operand’s value relates to another.

A

relational operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Python supports ____. For example, a < b < c determines whether b is greater-than a but less-than c.

A

operator chaining

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A ____ treats operands as being True or False, and evaluates to True or False.

A

logical operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Logical operators include ____, ____, and ____.

A

AND, OR, NOT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

____: True when its one operand is False, and vice versa.

A

Logical NOT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

____: True when at least one of its two operands are True.

A

Logical OR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

____: True when both of its operands are True.

A

Logical AND

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

A branch’s statements can include any valid statements, including another if-else statement, which are known as ____ statements.

A

nested if-else

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The order in which operators are evaluated in an expression is known as precedence rules. ____, ____, and ____operators are evaluated in what order.

A

Arithmetic, relational, logical

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A ____ is a series of statements grouped together.

A

code block

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

____ is any blank space or newline

A

whitespace

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Program redundancy can be reduced by creating a grouping of predefined statements for repeated operations, known as a ____.

A

function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

A ____ is a named series of statements.

A

function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

A ____ consists of the function’s name and a block of statements.

A

function definition

21
Q

A ____ is an invocation of the function’s name, causing the function’s statements to execute.

A

function call

22
Q

The ____ keyword is used to create new functions.

23
Q

____ is a special keyword that indicates no value.

24
Q

A ____ is a function input specified in a function definition.

25
An ____ is a value provided to a function's parameter during a function call.
argument
26
Code such as user_input = int(input()) consists of such a hierarchical function call, in which the input() function is called and evaluates to a value that is then passed as an argument to the int() function.
hierarchical function calls or nested function calls
27
A function with no return statement is called a ____, and such a function returns the value None.
void function
28
A variable or function object is only visible to part of a program, known as the object's ____.
scope
29
variables defined inside a function are called____.
local variables
30
a variable defined outside of a function is called a ____.
global variable
31
A ____ statement must be used to change the value of a global variable inside of a function.
global
32
The function's behavior of adding together different types is a concept called ____
polymorphism
33
Python uses ____ to determine the type of objects as a program executes.
dynamic typing
34
In contrast to dynamic typing, many other languages like C, C++, and Java use ____, which requires the programmer to define the type of every variable and every function parameter in a program's source code.
static typing
35
____ is an operation that allows a statement to perform multiple assignments at once to variables in a tuple or list.
Unpacking
36
A ____ is a string literal placed in the first line of a function body.
docstring
37
A ____ statement loops over each element in a container one at a time, assigning a variable with the next element that can then be used in the loop body.
for loop
38
A for loop may also iterate backward over a sequence, starting at the last element and ending with the first element, by using the ____ function to reverse the order of the elements.
reversed()
39
____ generates a sequence of integers between a starting integer that is included in the range, an ending integer that is not included in the range, and an integer step value.
range()
40
A ____ is a construct that repeatedly executes an indented block of code (known as the loop body) as long as the loop's expression is True.
while loop
41
Each execution of the loop body is called an ____, and looping is also called ____.
iteration, iterating
42
____, a value that when evaluated by the loop expression causes the loop to terminate.
sentinel value
43
An ____ is a loop that will always execute because the loop's expression is always True.
infinite loop
44
The programmer can use a variable to count the number of iterations, called a ____.
loop variable
45
A ____ is a loop that appears as part of the body of another loop.
nested loop
46
The nested loops are commonly referred to as the ____ and ____.
outer loop, inner loop
47
A ____ statement in a loop causes the loop to exit immediately.
break
48
A ____ statement in a loop causes an immediate jump to the while or for loop header statement.
continue