PLAY · GCSE · OCR J277

Trace it.

Wire up AND, OR and NOT and watch the truth table fill itself, flip eight bits into denary and hex, then step a sort and count every comparison.

Wire it, then read the table

FIG. 01 · 2.4.1 · AND · OR · NOT
A B C AND AND Q 0

Q = (A AND B) AND C

Truth table — the highlighted row is the one your switches are sitting on
ABCA op BQ
Inputs
NOT on an input

A NOT gate is a triangle with a bubble. The bubble is the inversion — the triangle on its own is just a buffer.

First gate (A · B)
Second gate (with C)
Output Q
0
Rows where Q = 1
1

What the exam wants. J277 section 2.4.1 only ever uses AND, OR and NOT, and the two things it asks for are: draw the logic diagram from an expression, and complete the truth table. Three inputs means eight rows — always eight, always in that counting order — and the fastest safe method is the middle column you can see here: work out the first gate for every row, then feed that into the second.

Eight switches, three languages

FIG. 02 · 1.2.3–1.2.4 · BINARY · DENARY · HEX
HIGH NIBBLE
0000
0
LOW NIBBLE
0000
0

Flip switches. Hex is only ever four bits at a time — split the byte down the middle and convert each half.

Operations

A left shift multiplies by two; anything pushed off the left-hand end is simply gone. That is overflow, and it is worth a mark.

Denary
0
Hex
00
Binary
0000 0000
Largest in 8 bits
255 · FF

What the exam wants. 1.2.4 asks for conversions in every direction and 1.2.3 for the units that sit on top of them. Denary from binary is just adding the column headings above the 1s. Hex from binary is four bits at a time — never eight. And when a shift is worth 3 marks, one of them is almost always for saying which bits were lost and what that does to the value.

Sort it, and count the cost

FIG. 03 · 2.1.3 · BUBBLE · INSERTION · MERGE

Choose an algorithm and step it. The two highlighted bars are the pair being compared right now.

Algorithm
Run it

Every algorithm gets the same starting list, so the counters are a fair fight.

Comparisons
0
Moves
0
Step
0 / 0
Total cost
— / —

What the exam wants. 2.1.3 asks you to “show the list after each pass” and to say which algorithm you would choose and why. Bubble is the easiest to describe and the slowest to run; insertion does well on a list that is nearly sorted; merge splits until every list has one item and then does the work on the way back up. Run all three on the same list and the comparison counters make the answer for you.

Six real questions

LIVE FROM THE BANK · NO ACCOUNT
Practise GCSE Computer Science → Read the lessons All subject labs