Topic Two Flashcards

1
Q

A ________ structure can execute a set of statements only under certain circumstances.

a. sequence
b. circumstantial
c. decision
d. Boolean

A

c. decision

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

A ___________ structure provides one alternative path of execution.

a. sequence
b. single alternative decision
c. one path alternative
d. single execution decision

A

b. single alternative decision

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

A (n) __________ expression has a value of either True or False.

a. binary
b. decision
c. unconditional
d. Boolean

A

d. Boolean

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

The symbols >, < , == and are all _________ operators.

a. relational
b. logical
c. conditional
d. ternary

A

a. relational

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

A (n) ________ structure tests a condition and then takes one path if the condition is true, or another path if the condition is false.

a. if statement
b. single alternative decision
c. dual alternative decision
d. sequence

A

c. dual alternative decision

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

You use a (n) ________ statement to write a single alternative decision structure.

a. test -jump
b. if
c. if-else
d. if-call

A

b. if

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

You use a (n) _________ statement to write a dual alternative decision structure.

a. test-jump
b. if
c. if-else
d. if-call

A

c. if-else

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

and , or , not are _________ operators.

a. relational
b. logical
c. conditional
d. ternary

A

b. logical

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

A compound Boolean expression created with the _______ operator is true only if both of its subexpressions are true.

a. and
b. or
c. not
d. both

A

a. and

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

A compound Boolean expression created with the _______ operator is true if either of its subexpressions is true.

a. and
b. or
c. not
d. either

A

b. or

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

The _______ operator takes a Boolean expression as its operand and reverses its logical value.

a. and
b. or
c. not
d. either

A

c. not

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

A ______ is a Boolean variable that signals when some condition exists in the program.

a. flag
b. signal
c. sentinel
d. siren

A

a. flag

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

True or False

You can write any program using only sequence structures.

A

False

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

True or False

A program can be made of only one type of control structure. You cannot combine structures.

A

False

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

True or False

A single alternative decision structure tests a condition and then takes one path if the condition is true, or another path if the condition is false.

A

True

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

True or False

A decision structure can be nested inside another decision structure.

17
Q

True or False

A compound Boolean expression created with the and operator is true only when both subexpressions are true.

18
Q

A (n) __________ structure is a logical design that controls the order in which a set of statements execute

a. Control
b. Sequence
c. Function
d. Iteration

A

a. Control

19
Q

Multiple Boolean expressions can be combined by using a logical operator to create __________ expressions

a. Sequential
b. Mathematical
c. Logical
d. Compound

A

d. Compound

20
Q

Which logical operators perform short-circuit evaluation?

a. not, and
b. or, and
c. or, not
d. and, or, not

A

b. or, and

21
Q

Which of the following is the correct if clause to determine whether y is in the range 10 through 50, inclusive?

a. if y >= 10 and y <= 50:
b. if 10 > y and y < 50:
c. if 10 < y or y > 50:
d. if y >= 10 or y <= 50:

A

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

22
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. False
b. 8
c. True
d. 5

23
Q

Which of the following is the correct if clause to determine whether choice is a number other than 10?

a. if choice == 10:
b. if choice < 10 or choice > 10:
c. if choice <> 10:
d. if choice != 10

A

b. if choice < 10 or choice > 10:

24
Q

In Python the __________ symbol is used as the not-equal-to operator

a. <>
b. <=
c. !=
d. ==

25
Python allows you to compare strings, but it is not case sensitive. True or False
False
26
Nested decision statements are one way to test more than one condition. True or False
True
27
Python uses the same symbols for the assignment operator as for the equality operator. True or False
False
28
Short -circuit evaluation is only performed with the not operator. True or False
False
29
Expressions that are tested by the if statement are called Boolean expressions. True or False
True
30
A (n) __________ structure is a logical design that controls the order in which a set of statements execute. iteration sequence function control
control
31
Multiple Boolean expressions can be combined by using a logical operator to create __________ expressions. sequential logical mathematical compound
compound
32
Which logical operators perform short-circuit evaluation? not, and and, or, not or, and or, not
or, and