P.S: This is just a study guide. The questions may not appear exactly like this.
1. In a decision structure, the _____ clause executes when the condition is true.
• If
• While
• Else
• Case
2. The expression amount < 10 is a(n) _____ expression. 1. arithmetic 2. logical 3. Boolean 4. unary 3. For the And operator to be true, _____. • both conditions must be false • both conditions must be true • either condition can be false • either condition can be true 4. If a valid score is between 0 and 100, which Boolean expression is true if the value in the score variable is not valid? • score >= 0 OR score <= 100 • score > 0 OR score < 100 • score >= 0 AND score <= 100 • score < 0 OR score > 100
5. Evaluate each of the following conditions (as being true or false). Assume A
= 3, B = 6, C = 3, and D = 18. (A=C) AND (C=D)
6. Evaluate each of the following conditions (as being true or false). Assume A
= 3, B = 10, and Z = “five”.
A * 2 < B / 2 AND Z < “two”
7. Given the following If structure, assume B = 4. What will be the output?
8. What will be displayed after the following process is completed?
Start
Set x = 3
Set y = 2
Set z = 3
If ((x = 1) OR (y = 1) OR (z = 1)) then
Set ans = “True”
Else
Set ans = “False”
End if
Display ans
Stop
9. What will be displayed after the following process is completed?
Start
Set w = 0
Set x = 1
Set y = 4
Set z = 3
If ((w <> 0 OR x = 1) AND (y = 2 OR z <> 3)) then
Set ans = “T”
Else
Set ans = “F”
End if
Display ans
Stop
10. What will be displayed after the following process is completed?
Start
Set grade = “C”
If (grade <> “A” AND grade <> “B” AND grade <> “C”
AND grade <> “D” AND grade <> “F”) then
Set message = “invalid grade”
Else
Set message = “valid grade“
End if
Display message
Stop