OCR GCSE Computer Science June 2025 Paper 2, Question 5(a) and (b): a circuit from words

OCR J277/02 June 2025, Question 5(a) and (b): turn a description of a card payment security system into a logic circuit, (A OR B) AND NOT C, then complete the truth table for A AND B. Worked through, with both truth tables to run.

Past paper questionOCR J277/02June 2025 Paper 25 marksLogic

Question 5 of the OCR GCSE Computer Science Paper 2 sat on 20 May 2025 (J277/02) gives you a logic system in words and asks you to draw it (3 marks). Then it asks for the whole truth table of A AND B, inputs and all (2 marks).

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

The question in short

A security system for online card payments has three inputs. A is true when the password is correct. B is true when the PIN is correct. C is true when the card is blocked.

The output P is true if both of these are true: the user has entered the correct password or the correct PIN, and the card is not blocked.

Part (a): from words to an expression to a circuit

Find the three logic words in the description. They are the three gates.

P = (A OR B) AND NOT C

  1. A and B go into an OR gate (curved back, pointed front).
  2. C goes into a NOT gate (a triangle with a small circle).
  3. The two outputs go into an AND gate (D shape), and its output is P.

One mark for an OR gate with two inputs, one for NOT C, one for joining them correctly with an AND gate. Extra gates cap you at 2.

Part (b): the truth table for P = A AND B

This time the inputs are blank too, so write all four combinations, in binary counting order.

A B P
0 0 0
0 1 0
1 0 0
1 1 1

One mark for the four input combinations, in any order. One mark for P: 1 only when both inputs are 1.

Where the marks are lost

  • Missing the NOT. C means the card is blocked, and payment needs it not to be. A description that says "not" needs a NOT gate.
  • A NOT gate without its circle, or a circle on the AND or OR gate.
  • A repeated row in part (b). Count in binary: 00, 01, 10, 11. Then none is missed and none is doubled.
  • Writing the OR column. 0, 1, 1, 1 is OR. AND is 0, 0, 0, 1.

Run it

Both tables from Python. In the first, read each row as a payment attempt.

The security system allows 3 of the 8 cases: the ones where the card is not blocked and the password, the PIN or both are right. Then the A AND B table: 0 0 0 1.
The program
from bugbot import *
connect()

print("A B C  P = (A OR B) AND NOT C")
allowed = 0
for A in [0, 1]:
    for B in [0, 1]:
        for C in [0, 1]:
            P = int((A or B) and not C)
            allowed = allowed + P
            print(A, B, C, "", P)
print(allowed, "of 8 allowed")

print("A B  P = A AND B")
for A in [0, 1]:
    for B in [0, 1]:
        print(A, B, "", int(A and B))
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 2025 Paper 2 Question 5(a)?

An OR gate with inputs A and B, a NOT gate with input C, and an AND gate that takes both of their outputs and produces P. As an expression, P = (A OR B) AND NOT C.

How do I turn a description into a logic circuit?

Underline the words and, or and not in the description. Write the expression with brackets round the part that belongs together, then draw one gate for each operator, working from the inputs towards the output.

What is the truth table for an AND gate?

The output is 1 only when both inputs are 1. For inputs 00, 01, 10 and 11 the outputs are 0, 0, 0 and 1.

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.