New Activity
Play Quiz
1. 
A student is writing a program to model different real-world events using simulations. Which of the following simulations will generate a result that would best be stored using a Boolean variable?
A.
A simulation of flipping a fair coin
B.
A simulation of rolling a fair die (with sides numbered 1 through 6)
C.
A simulation of the temperature in a location over time
D.
A simulation of traffic patterns on a road
2. 
Answer
A.
second <- first
B.
second <- temp
C.
temp <- first
D.
temp <- second
3. 
Answer
A.
1 3
B.
3 3
C.
3 4
D.
4 4
4. 
Answer
A.
I and II only
B.
I and III only
C.
II and III only
D.
I, II, and III
5. 
answer
A.
first = 100, second = 100
B.
first = 100, second = 200
C.
first = 200, second = 100
D.
first = 200, second = 200
6. 
answer
A.
The value of first is true, and the value of second is true.
B.
The value of first is true, and the value of second is false.
C.
The value of first is false, and the value of second is true.
D.
The value of first is false, and the value of second is false.
7. 
Answer
A.
__
B.
__
C.
__
D.
__
8. 
answer
A.
initials ← concat(prefix(firstName, 1), prefix(lastName, 1))
B.
initials ← concat(prefix(firstName, 2), prefix(lastName, 2))
C.
initials ← prefix(concat(firstName, lastName), 1)
D.
initials ← prefix(concat(firstName, lastName), 2)
9. 
Answer
A.
A = true, B = false, C = false, D = false
B.
A = true, B = true, C = false, D = false
C.
A = false, B = false, C = true, D = true
D.
A = false, B = false, C = false, D = true
10. 
Answer
A.
A = true, B = true, C = true, D = false
B.
A = true, B = false, C = false, D = true
C.
A = false, B = true, C = true, D = true
D.
A = false, B = false, C = true, D = true
11. 
Answer
A.
Include <- (floor > 10) OR (bedrooms = 3)
B.
include 10) AND (bedrooms = 3)
C.
include <- (floor
D.
include <- (floor
12. 
To be eligible for a particular ride at an amusement park, a person must be at least 12 years old and must be between 50 and 80 inches tall, inclusive. Let age represent a person’s age, in years, and let height represent the person’s height, in inches. Which of the following expressions evaluates to true if and only if the person is eligible for the ride?
A.
(age ≥ 12) AND ((height ≥ 50) AND (height ≤ 80))
B.
(age ≥ 12) AND ((height ≤ 50) AND (height ≥ 80))
C.
(age ≥ 12) AND ((height ≤ 50) OR (height ≥ 80))
D.
(age ≥ 12) OR ((height ≥ 50) AND (height ≤ 80))
13. 
A NAND gate is a type of logic gate that produces an output of false only when both of its two inputs are true. Otherwise, the gate produces an output of true. Which of the following Boolean expressions correctly models a NAND gate with inputs P and Q ?
A.
(NOT P) AND (NOT Q)
B.
(NOT P) AND Q
C.
NOT (P AND Q)
D.
NOT (P OR Q)
14. 
Answer
A.
(NOT input1) OR (NOT input2)
B.
(NOT input1) AND (NOT input2)
C.
NOT (input1 OR input2)
D.
NOT (input1 AND input2)