GCSE Computer Science · 2.4
Boolean Logic
Name
Class
Date
Mark / 29
Section A
Circle the letter of the correct answer. One mark each.
- 1What is the output of
1 AND 0?1- AUndefined
- B0
- C1
- DBoth
- 2What is the output of
0 OR 1?1- A1
- B0
- CUndefined
- DBoth
- 3How many rows does a truth table for three inputs have?1
- A3
- B4
- C6
- D8
- 4What is the output of
NOT (1 AND 1)?1- AUndefined
- B1
- C0
- D2
- 5Which expression describes: the heater turns on if it is cold AND the system is switched on?1
- AHeater = Cold AND SystemOn
- BHeater = NOT (Cold AND SystemOn)
- CHeater = NOT Cold AND SystemOn
- DHeater = Cold OR SystemOn
- 6For
Q = (A OR B) AND NOT C, what is Q when A=0, B=1, C=0?1- A2
- BCannot be determined
- C0
- D1
- 7Which gate is described as an inverter?1
- AAND
- BOR
- CNOT
- DXOR
- 8In
A OR B AND C, which operation is carried out first?1- AThey are done simultaneously
- BB AND C
- CA OR B
- DThe order does not matter
- 9A door unlocks if the correct code is entered AND the card is valid, OR if the override switch is on. Which expression is correct?1
- AUnlock = NOT (Code AND Card)
- BUnlock = Code AND (Card OR Override)
- CUnlock = Code OR Card OR Override
- DUnlock = (Code AND Card) OR Override
- 10What is the output of
NOT 0 AND NOT 1?1- AUndefined
- B0
- C1
- DBoth
Section B
Answer in the space provided. The number of marks tells you how many separate points to make.
- 1CompleteComplete a truth table for the expression Q = A AND NOT B, showing all input combinations.4
- 2WriteA security light switches on when a movement sensor is triggered AND it is dark. Write a Boolean expression for this system.2
- 3ExplainExplain the difference between an AND gate and an OR gate.3
- 4WriteA machine will only operate if the guard is closed AND either the foot pedal is pressed OR the hand button is pressed. Write a Boolean expression and state what the output would be if the guard is open and the foot pedal is pressed.4
- 5CompleteComplete a truth table for Q = (A OR B) AND NOT C for all eight input combinations.6
Mark scheme
Section A
Section B
1 Complete a truth table for the expression Q = A AND NOT B, showing all input combinations. 4
One mark for each of the following, to a maximum of 4.
- Includes all four input combinations for A and B
- Includes an intermediate column for NOT B
- Q is 1 only when A is 1 and B is 0
- Q is 0 for all other combinations
Model answer. With A and B as inputs there are four combinations. When A is 0 and B is 0, NOT B is 1 and Q is 0 AND 1 which is 0. When A is 0 and B is 1, NOT B is 0 and Q is 0. When A is 1 and B is 0, NOT B is 1 and Q is 1 AND 1 which is 1. When A is 1 and B is 1, NOT B is 0 and Q is 1 AND 0 which is 0. So Q is 1 only in the single case where A is 1 and B is 0, and 0 in every other case.
2 A security light switches on when a movement sensor is triggered AND it is dark. Write a Boolean expression for this system. 2
One mark for each of the following, to a maximum of 2.
- Uses AND to combine the two conditions
- Correct expression such as Light = Movement AND Dark
Model answer. Light = Movement AND Dark. Both conditions must be satisfied for the light to switch on, so the two inputs are combined with an AND gate: the movement sensor must be triggered and it must also be dark.
3 Explain the difference between an AND gate and an OR gate. 3
One mark for each of the following, to a maximum of 3.
- An AND gate outputs 1 only when all inputs are 1
- An OR gate outputs 1 when at least one input is 1
- Refers to the difference in the case where only one input is 1
Model answer. An AND gate produces an output of 1 only when every one of its inputs is 1, so with two inputs it outputs 1 in just one of the four possible cases. An OR gate produces an output of 1 whenever at least one of its inputs is 1, so with two inputs it outputs 1 in three of the four cases. The gates therefore differ in exactly those cases where only one input is 1: an AND gate outputs 0 while an OR gate outputs 1. They agree only when both inputs are 0, giving 0, and when both are 1, giving 1.
4 A machine will only operate if the guard is closed AND either the foot pedal is pressed OR the hand button is pressed. Write a Boolean expression and state what the output would be if the guard is open and the foot pedal is pressed. 4
One mark for each of the following, to a maximum of 4.
- Correctly groups the pedal and button with OR
- Combines that result with the guard using AND
- Full expression such as Operate = Guard AND (Pedal OR Button)
- States the output is 0, because the guard is open so the AND cannot be satisfied
Model answer. Operate = Guard AND (Pedal OR Button). The pedal and the hand button are alternatives, so they are combined with an OR gate, and the result of that must be combined with the guard using AND because the guard must be closed in every case. If the guard is open then Guard is 0, and regardless of whether the pedal or the button is pressed the OR gate output is ANDed with 0, so the final output is 0 and the machine will not operate. This is the correct and intended safety behaviour.
5 Complete a truth table for Q = (A OR B) AND NOT C for all eight input combinations. 6
One mark for each of the following, to a maximum of 6.
- Lists all eight combinations of A, B and C
- Includes an intermediate column for A OR B
- Includes an intermediate column for NOT C
- Q is 0 for every row where C is 1
- Q is 0 when A and B are both 0
- Q is 1 for the rows 010, 100 and 110
Model answer. There are eight input combinations, counting in binary from 000 to 111. The intermediate column A OR B is 0 only when both A and B are 0, and 1 otherwise. The intermediate column NOT C is 1 whenever C is 0 and 0 whenever C is 1. Q is the AND of those two columns, so Q is 1 only when at least one of A and B is 1 and C is 0. That gives Q equal to 1 for the input combinations 010, 100 and 110, and Q equal to 0 for the other five combinations, namely 000, 001, 011, 101 and 111.