OCR GCSE Computer Science June 2024 Paper 2, Question 5: a truth table and a logic circuit

OCR J277/02 June 2024, Question 5: complete the eight row truth table for P = (A AND B) OR C, then draw the logic circuit for P = NOT A AND (B OR C). Worked row by row, with a program that prints both truth tables.

Past paper questionOCR J277/02June 2024 Paper 27 marksLogic

Question 5 of the OCR GCSE Computer Science Paper 2 sat on 21 May 2024 (J277/02) is two logic questions: fill in the P column of a three input truth table (4 marks), then draw a circuit from an expression (3 marks).

We do not copy the exam paper here. Open it beside this page: OCR June 2024 J277/02 question paper (PDF). When you have finished, check the mark scheme too.

Part (a): P = (A AND B) OR C

Brackets first. Add a working column for A AND B, which is 1 only when both are 1. Then P is 1 when that column is 1 or C is 1.

A B C A AND B P
0 0 0 0 0
0 0 1 0 1
0 1 0 0 0
0 1 1 0 1
1 0 0 0 0
1 0 1 0 1
1 1 0 1 1
1 1 1 1 1

A quick check: P should be 1 in every row where C is 1 (that is every second row), plus the row 1 1 0. Five 1s in all.

There is one mark for each pair of rows, so one slip costs one mark, not four.

Part (b): draw P = NOT A AND (B OR C)

Work from the inputs towards P.

  1. A goes into a NOT gate: a triangle with a small circle on its point.
  2. B and C go into an OR gate: the shape with a curved back and a pointed front.
  3. The outputs of the NOT gate and the OR gate go into an AND gate: the D shape. Its output is P.

One mark for NOT A, one for B OR C, and one for an AND gate with two inputs. An extra or missing gate caps you at 2.

NOT only applies to A here. There are no brackets round A AND ..., and NOT is worked out before AND.

Where the marks are lost

  • Doing the OR first in part (a). The brackets say A AND B comes first.
  • Forgetting the circle on the NOT gate. Without it the shape is a buffer, not a NOT. No other gate has a circle at GCSE.
  • A NOT gate on the output. That would be NOT (A AND (B OR C)), a different expression.
  • AND and OR shapes swapped. AND has a flat back and a round front. OR has a curved back and a pointed front.

Run it

Python has and, or and not, so it can print any truth table. This one prints both expressions from the question. The P column of the second table is what your circuit should produce.

The first table is part (a): P is 0 1 0 1 0 1 1 1. The second is the circuit in part (b): P is 0 1 1 1 0 0 0 0.
The program
from bugbot import *
connect()

print("A B C  (A AND B) OR C")
for A in [0, 1]:
    for B in [0, 1]:
        for C in [0, 1]:
            P = (A and B) or C
            print(A, B, C, "      ", int(P))

print("A B C  NOT A AND (B OR C)")
for A in [0, 1]:
    for B in [0, 1]:
        for C in [0, 1]:
            P = (not A) and (B or C)
            print(A, B, C, "      ", int(P))
Put this demo on your own site

Paste it into a school website, Moodle, Google Sites or a blog. More options on the embed page.

Questions

What is the answer to OCR J277 June 2024 Paper 2 Question 5(a)?

Reading down the P column: 0, 1, 0, 1, 0, 1, 1, 1.

How do I fill in a truth table with three inputs?

List all eight combinations of the inputs in binary counting order, from 000 to 111. Work out any bracketed part in its own column first, then combine that column with the remaining input.

Which comes first in a logic expression: NOT, AND or OR?

Brackets first, then NOT, then AND, then OR.

More from this paper

Every OCR J277 question we have worked · Guide: Logic gates and truth tables explained

Learn it step by step

  1. F9.1 Logic gates and truth tables Logic and computer systems
  2. F9.2 Logic circuits and expressions Logic and computer systems
Open the lessons

This is our own explanation of a published exam question. It is not written or endorsed by OCR, and the question paper and mark scheme remain OCR's copyright. Read them on OCR's site with the links on this page.