Chapter 3 Flashcards

1
Q

What is the result of the following Boolean expression, given that x = 5, y = 3, and z = 8?
x < y or z > x (T/F)

A

false because If (x=5) < (y=3), this is False.
AND = the condition, both must be true.
(z=8) > (x=5), this is True
The whole statement is False because it uses the AND condition not the OR condition.

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

What is the result of the following Boolean expression, given that x = 5, y = 3, and z= 8?
! (x < y or z > x) and y < z (T/F)

A

False

Why: … First:
NOT = operator #1, this means the value of this expression must be reversed. so…
Second:
[ (x=5) < (y=3), expression 1 is False
Third:
OR = the operator #2, one of these must be true. (z=8) > (x=5) ], expression 2 is True - so far the sub-expression 1, in brackets, is True.

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

Write an if clause to determine whether x is anything other than 10?

A

if choice !=10:

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

Write an if-else statement that assigns 0 to the variable y if the variable x is less than 10. Otherwise it should assign 99 to the variable y.

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

Write nested decision structures that perform the following: if x is greater than 10 and y is less than 100, display the greater of x and y.

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

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

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

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

A

decision

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

A __________ structure provides one alternative path of execution

A

single alternative decision

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

In pseudocode, the If-Then statement is an example of a _________.

A

decision structure

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

A(n) _________ expression has a value of either true or false

A

boolean

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

The symbols >,

A

relational

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
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

dual alternative decision

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

You use a(n) _________ statement in pseudocode to write a single alternative decision structure.

A

if-then

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

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

A

If-Then-Else

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

A _________ structure allows you to test the value of a variable or an expression and then use that value to determine which statement or set of statements to execute.

A

multiple alternative decisions

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

A(n) _________ section of a Select Case statement is branched to, if none of the case values match the expression listed after the Select statement.

A

default

17
Q

AND, OR, and NOT are _________ operators.

A

logical

18
Q

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

A

AND

19
Q

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

A

OR

20
Q

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

A

NOT

21
Q

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

A

flag