Font size
WorksheetsLogic && Boolean Expressions (A-Level Computer Science)
Total questions: 58
Worksheet time: 1hrs 18mins
Which numbers would cause the Boolean expression "variable=<14" to be true?
3,17,20
14,18,20
1,11,14
13,14,15
Where can Boolean expressions be found?
In a sprite
By itself
In an if-statement
In a variable
What is a Conditional Statement?
A part of the code that allows you to perform different actions depending on which is true or false
A variable that has a value of true or false
A part of the code that tells you if a value is less than another value
A part of the code that tests whether or not two values are equal
Is "3" == 3 True?
Yes, same number
No, One is in quotes.
How many values does a Boolean variable have?
4
3
2
1
Infinite
What is this expression?
equal to
greater than or equal to
less than
is not equal to
What is this expression?
equal to
greater than
less than
is not equal to
What type of logic is this table showing:
AND
OR
NOT
NOR
What type of logic is this table showing:
AND
OR
NOT
XOR
Use the logic condition to find the value of W:
A & ~(B | C)
True
False
Use the logic condition to find the value of Y:
(A (+) B) | C
True
False
What is expression that would represent this Boolean Gate Diagram?
~(A & B) | (C & D)
(A & B) | (C & D)
(A & B) | ~(C & D)
(A & B) | ~(C | D)
What is expression that would represent this Boolean Gate Diagram?
~A & ~(B (+) C)
~A & (B (+) C)
~A & ~(B | C)
A & (B (+) C)
If the input values are A = 1, B = 0, C = 1, what would be the result at output D and G, respectively?
Output D = 0, Output G = 0
Output D = 0, Output G = 1
Output D = 1, Output G = 0
Output D = 1, Output G = 1
Commutative Law states that..
Expressions can be simplified by removing like terms
The order of variables in an operation does not matter
Expressions can be factorised, or multiplied out
A variable AND itself is the same as the variable.
Which of the following are correct expressions of De Morgan's Theorum?
¬A.¬B = ¬(A.B)
¬A.B = ¬B+A
¬(A.B) = ¬A+¬B
A.B = ¬(¬A+¬B)
A+B = ¬A.¬B
Which law tells us that we can factorise or multiply out expressions?
Associative law
Distributive law
De Morgan's law
Commutative law
Absorptive Law states that..
Expressions can be simplified by removing like terms
The order of variables in an operation does not matter
Expressions can be factorised, or multiplied out
A variable AND itself is the same as the variable.
Which law states that AND and OR can replace each other in the right circumstances?
De Morgan's Law
Associative Law
Distributive Law
Cole's Law
Identity
Truth table for AND gate?
Truth table for OR gate?
Which logic gate is this truth table for?
AND
OR
NOR
XOR
Which of these programming constructs make use of Boolean logic?
if ... then ...
while ... do ....
repeat ... until ....
repeat n times ....
If x = 3 and y = 5, choose all the statements that evaluate to True.
x < y
y > x**2
2 * x == y
y % x == 2
If a = 10 and b = 5 which of these Boolean expressions are True?
a > b And a == 2 * b
b > a And b == a / 3
a < b And b = a / 2
a == 2 * b And a**2 == b*20
Which word best completes this sentence:
Data that is Boolean can only take two values: True _____ False.
and
or
not
Which word best completes this sentence:
A logic gate is a tiny electronic component on a chip that has inputs and ______ to simulate a Boolean operation.
output
result
data
processing
Which word best completes this sentence?
A combination of logic gates is known as a logic _______.
circuit
program
array
truth table
Select all equivalent expressions
Q is A or B
Q = A + B
Q is A and B
Q = A·B
Select all equivalent expressions
Q is A or B
Q = A V B
Q is A and B
Q = A ^ B
Select all equivalent expressions
Q = ¬A^¬B
Q = ¬(A+B)
Q = ¬(A.B)
Q is not A or not B
Q is not A and not B
Select all equivalent expressions
Q = A V B
Q = A ^ B
Q is A or B
Q is A and B
Select all equivalent expressions
Q is neither A nor B
Q is not A or B
Q = ¬B + ¬A
Q = ¬A.¬B
Q = ¬(A+B)
Which law states that AND and OR can replace each other in the right circumstances?
De Morgan's Law
Associative Law
Distributive Law
Cole's Law
Identity
Which of the following are correct expressions of De Morgan's Theorum?
¬A.¬B = ¬(A.B)
¬A.B = ¬B+A
¬(A.B) = ¬A+¬B
A.B = ¬(¬A+¬B)
A+B = ¬A.¬B
Commutative Law states that..
Expressions can be simplified by removing like terms
The order of variables in an operation does not matter
Expressions can be factorised, or multiplied out
A variable AND itself is the same as the variable.
Why might one most likely use a Boolean expression?
To loop a set amount of code
To activate a response with either true or false
To locate a bug in the code
To make a sprite appear
Which numbers would cause the Boolean expression "variable<=14" to be true?
3,17,20
14,18,20
1,11,14
13,14,15
A Boolean expression...
Fixes any errors in the line of code
Sets everything in it equal to each other
Checks if something is true or false
Loops the program to continue infinitely
Which of the following is the correct truth table for the Boolean expression shown here:
The two variables age and day are initialized with the values shown.
age <-- 16
day <-- "Monday"
Choose the compound conditional that evaluates to false.
( (age = 16) AND ( NOT (day = "Tuesday") ) ) AND (day = "Monday")
( (age = 16) AND (day = "Tuesday") ) OR (day = "Monday")
( (age > 10) AND ( (age + 5) > 25 ) )
NOT ( (age = 16) AND (day = "Tuesday") )
This program uses a nested conditional to recommend a heat level for cooking eggs.
In which situations will heatLevel be "medium"?
Note that there may be multiple answers to this question. Choose all answers that apply:
When inHurry is false and eggDish is "fried"
When inHurry is true and eggDish is "fried"
When inHurry is false and eggDish is "scrambled"
When inHurry is true and eggDish is "scrambled"
Trace the code and plot the movements of the robot for the 3 scenarios.
If the robot is directed to move onto a black square, it “crashes” and the program ends.
Choose the scenario that results in a "crash."
In the program below, the initial value of x is 5 and the initial value of y is 10.
What is displayed as a result of running the program?
Foxtrot
Hotel
November
Yankee
The diagram shows a circuit composed of two logic gates labeled OR and AND. Each gate takes two inputs and produces a single output.
If the inputs A and C are both false, which of the following best describes the output of the AND gate?
The output will be true no matter what the value of input B is.
The output will be false no matter what the value of input B is.
The output will be true if input B is true; otherwise it will be false.
The output will be false if input B is true; otherwise it will be true.
14 >= 14
15 > 15
16 != 16
18 >= 19
name = 'Dave'
greeting = "Good morning" + name
print (greeting)
What is this logic circuit called?
Half Adder
Full Adder
And Adder
Ripple Carry Adder
Or Adder
Which logic circuit is a Half Adder?
Which circuit would add two 4-bit numbers?
Which logical operator does this Venn Diagram represent? (Red is True, A is the left circle)
NOT
AND
OR
XOR
NAND
Which logical operator does this Venn Diagram represent? (Red is True, A is the left circle)
NOT(A)
A AND B
A OR B
A XOR B
A NAND B
Which Boolean expression(s) does this Venn Diagram represent? (Red is True, A is the left circle)
NOT(B)
NOT(A) AND B
NOT(A) OR B
(A XOR B) AND B
A NAND (A NOR B)
Which logical operator does this Venn Diagram represent? (Red is True)
¬
∧
∨
⊻
Which logical operator does this Venn Diagram represent? (Red is True, A is the left circle)
¬
∧
∨
⊻
For this clocked logic signal, what are the correct labels for A and B?
A = Falling edge. B = Rising edge.
A = Rising edge. B = Falling edge.
What is the name of the device shown?
Full Adder
Clock
Half Adder
D-Type Flip Flop
CPU
