Week 3 Flashcards

1
Q

The Python language is not sensitive to block structuring of code.

A

False

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

The if statement causes one or more statements to execute only when a Boolean expression is true.

A

True

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

Python allows you to compare strings, but it is not case sensitive.

A

False

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

Nested decision statements are one way to test more than one condition.

A

True

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

Python uses the same symbols for the assignment operator as for the equality operator.

A

False

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

The not operator is a unary operator which must be used in a compound expression.

A

False

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

Short -circuit evaluation is only performed with the not operator.

A

False

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

Expressions that are tested by the if statement are called Boolean expressions.

A

True

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

Decision structures are also known as selection structures.

A

True

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

An action in a single alternative decision structure is performed only when the condition is true.

A

True

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

A(n) __________ structure is a logical design that controls the order in which a set of statements execute.
a. function
b. control
c. sequence
d. iteration

A

b. control

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

The decision structure that has two possible paths of execution is known as
a. single alternative
b. double alternative
c. dual alternative
d. two alternative

A

c. dual alternative

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

Multiple Boolean expressions can be combined by using a logical operator to create __________ expressions.
a. sequential
b. logical
c. compound
d. mathematical

A

c. compound

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

When using the __________ logical operator, one or both of the subexpressions must be true for the compound expression to be true.
a. or
b. and
c. not
d. maybe

A

a. or

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

Which logical operators perform short-circuit evaluation?
a. or, not
b. not, and
c. or, and
d. and, or, not

A

b. not, and

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

Which of the following is the correct if clause to determine whether y is in the range 10 through 50, inclusive?
a. if 10 < y or y > 50:
b. if 10 > y and y < 50:
c. if y >= 10 and y <= 50:
d. if y >= 10 or y <= 50:

A

c. if y >= 10 and y <= 50:

17
Q

A Boolean variable can reference one of two values which are
a. yes or no
b. True or False
c. or F
d. Y or N

A

b. True or False

18
Q

What is the result of the following Boolean expression, given that x = 5, y = 3, and z = 8?
x < y or z > x
a. True
b. False
c. 8
d. 5

A

a. True

19
Q

What does the following expression mean?
x <= y
a. x is less than y
b. x is less than or equal to y
c. x is greater than y
d. x is greater than or equal to y

A

b. x is less than or equal to y

20
Q

Which of the following is the correct if clause to determine whether choice is anything other than 10?
a. if choice != 10:
b. if choice != 10
c. if choice <> 10:
d. if not(choice < 10 and choice > 10):

A

a. if choice != 10:

21
Q

When using the __________ logical operator, both subexpressions must be true for the compound expression to be true.
a. or
b. and
c. not
d. either or or and D

A

b. and

22
Q

In Python the __________ symbol is used as the not-equal-to operator.
a. ==
b. <>
c. <=
d. !=

A

d. !=

23
Q

In Python the __________ symbol is used as the equality operator.
a. ==
b. <>
c. <=
d. !=

A

a. ==

24
Q

The ___________ statement is used to create a decision structure.

A

if

25
Q

In flowcharting, the __________ symbol is used to represent a Boolean expression.

A

diamond

26
Q

A(n) __________ decision structure provides only one alternative path of execution.

A

single alternative

27
Q

In a decision structure, the action is ___________ executed because it is performed only when a specific condition is true.

A

conditionally

28
Q

A(n) __________ operator determines whether a specific relationship exists between two values.

A

relational

29
Q

A(n) __________ statement will execute one block of statements if its condition is true or another block if its condition is false.

A

if-else

30
Q

Python provides a special version of a decision structure known as the __________ statement, which makes the logic of the nested decision structure simpler to write.

A

if-elif-else

31
Q

The logical __________ operator reverses the truth of a Boolean expression.

A

not

32
Q

Boolean variables are commonly used as __________ to indicate whether a specific condition exists.

A

flags

33
Q

A(n) ___________ expression is made up of two or more Boolean expressions.

A

compound