Level:
Correct: 0
Incorrect: 0
Marks: 0/0
Exam Practice
Subject:
Topics:
Avg
score:
–
Topics
done:
0/32

Logic gates and their functions

Practise 29 exam-style questions on Logic gates and their functions for Cambridge IGCSE Computer Science (Paper 2). Write your answer as you would in the exam and get it marked in seconds against the mark scheme, point by point, with an AI tutor on hand if you get stuck.

  • 29 questions
  • 1–6 marks each
  • Instant marking
  • No sign-up needed
20 questions, marked as you go

Sample questions with model answers

Here are 4 of the questions in this topic, each with a model answer, an explanation of why it earns the marks and the mark scheme an examiner would use.

Question 1

1 mark

The truth table shows the output X of a single logic gate with two inputs, A and B.

Identify the logic gate.

Truth table with two input columns, A and B, and one output column, X (a thick line separates the inputs from the rest). The 4 rows list every combination of inputs in binary order from 00 to 11. Rows (A B → X): 00 → 1; 01 → 0; 10 → 0; 11 → 0.

Model answer

NOR

Explanation

The output is 1 only when both inputs are 0. This is the opposite of OR (which is 0 only when both inputs are 0), so the gate is NOR.

Mark scheme
  1. 1 mark

    NOR

Question 2

2 marks

The truth table is for an XOR gate with inputs A and B.

Give the output column X, from the first row to the last.

Truth table with two input columns, A and B, and one output column, X (a thick line separates the inputs from the rest). The 4 rows list every combination of inputs in binary order from 00 to 11. The X column is blank in every row, to be completed.

Model answer

0, 1, 1, 0

Explanation

XOR outputs 1 only when the inputs are different (01 and 10). When both inputs are the same (00 or 11), the output is 0.

Mark scheme
  1. 1 mark

    Rows 1 and 2 (A B = 00, 01): 0, 1

    1 mark for each two correct rows.

  2. 1 mark

    Rows 3 and 4 (A B = 10, 11): 1, 0

Question 3

3 marks

Compare the outputs of a two-input NAND gate and a two-input NOR gate. For each possible combination of inputs, state whether the two gates give the same output or different outputs.

Model answer

When both inputs are 0, NAND and NOR both output 1. When both inputs are 1, they both output 0. When the inputs are different (01 or 10), they give different outputs: NAND outputs 1 and NOR outputs 0.

Explanation

NAND is 0 only for 11 and NOR is 1 only for 00. Writing out both truth tables side by side shows that they agree when the inputs are the same and disagree when they are different.

Mark scheme
  1. 1 mark

    Inputs 00: both gates output 1 (same)

  2. 1 mark

    Inputs 11: both gates output 0 (same)

  3. 1 mark

    Inputs 01 and 10: the outputs are different: NAND outputs 1 and NOR outputs 0

    Both rows and the values needed.

Question 4

4 marks

In the logic circuit, gates P and Q are hidden. S labels the wire from the output of gate P. This table shows the values at S and the output X for every combination of inputs:

A  B  S  X
0  0  0  1
0  1  1  0
1  0  1  1
1  1  0  1

Identify gate P and gate Q, explaining how you used the table.

Logic circuit with two inputs, A and B, on the left and one output, X, on the right. It has two logic gates (numbered here from left to right, then top to bottom): gate 1 is drawn as a blank box labelled P, with inputs A and B, and its output wire is labelled S; gate 2 is drawn as a blank box labelled Q, with inputs from gate 1 (upper) and input B (lower), and its output is X. Input B is drawn once and branches, with junction dots, to gates 1 and 2. As a logic expression, with P and Q standing for the blank gates: X = (A P B) Q B.

Model answer

P is XOR, because its output S is 0, 1, 1, 0: it is 1 only when A and B are different.
Q is NAND. Its inputs are S and B. The pairs (S, B) in the four rows are (0, 0), (1, 1), (1, 0) and (0, 1), giving X = 1, 0, 1, 1. X is 0 only when both of Q's inputs are 1, which is NAND.

Explanation

Identify each gate from its own inputs and output. Gate P's inputs are A and B, but gate Q's inputs are S and B, so you must read the S and B columns, not A and B, to build Q's truth table.

Mark scheme
  1. 1 mark

    P is XOR

    Accept EOR.

  2. 1 mark

    S (the output of P) is 1 only when A and B are different (0, 1, 1, 0)

  3. 1 mark

    Q is NAND

  4. 1 mark

    Q's inputs are S and B: X is 0 only when S = 1 and B = 1 (row A B = 01), and 1 for the other combinations of S and B (00, 10, 01)

Ready to try the rest? Every answer you write is marked against the mark scheme, so you can see exactly where the marks are.

AI Tutor Hints first, answers after you try

Hi! Stuck? Ask me for a hint and I’ll help you work it out. Once you’ve checked your answer I can explain exactly where the marks are.