Skip to the worksheet
Revision Library
Choose a subject

Trace Tables and Binary/Hex Conversions - Worksheets, Questions and Revision

18 original exam-style questions - 10 pages of questions with a full mark scheme - free printable PDF.

Grades 1-9

This topic is chapter 7 of GCSE Computer Science Topic Workbook 2 and chapter 16 of GCSE Computer Science 10-Minute Tests.

Revision Library
revisionlibrary.co.uk
GCSE · Data Representation and Algorithms

2.9 Trace Tables and Binary/Hex Conversions

OCR J277 · Calculators not allowed · about 95 minutes
Total Marks
Name: _______________________________    Date: ____ / ____ / ______
Answer ALL questions. Show all your working.
1
Convert each of the following denary numbers to an 8 bit binary number.
(a)Convert 122 to an 8 bit binary number. Show your working.(2)
(b)Convert 201 to an 8 bit binary number. Show your working.(2)
(Total for Question 1 is 4 marks)
2
A simple character set assigns the letter 'A' the ASCII decimal code 65, with the remaining capital letters following on in alphabetical order.
(a)Calculate the ASCII decimal code for the capital letter 'M'.(2)
(b)The word 'REVISE' is stored using 8 bit ASCII, with one byte used per character. Calculate the total number of bits needed to store the word.(2)
(Total for Question 2 is 4 marks)
3
Convert each of the following 8 bit binary numbers to a two digit hexadecimal number.
(a)Convert 10110101 to hexadecimal. Show your working.(2)
(b)Convert 01111110 to hexadecimal. Show your working.(2)
(Total for Question 3 is 4 marks)
4
Convert each of the following two digit hexadecimal numbers to an 8 bit binary number.
(a)Convert 3A to an 8 bit binary number. Show your working.(2)
(b)Convert F4 to an 8 bit binary number. Show your working.(2)
(Total for Question 4 is 4 marks)
5
Programmers often write memory addresses and colour codes in hexadecimal rather than binary.
(a)State two reasons why hexadecimal is often used instead of binary, and give one real-world example of where hexadecimal is used.(3)
(Total for Question 5 is 3 marks)
6
Convert between hexadecimal and denary as follows.
(a)Convert the hexadecimal number 2F to denary. Show your working.(2)
(b)Convert the denary number 200 to a two digit hexadecimal number. Show your working.(2)
(Total for Question 6 is 4 marks)
7
The 8 bit binary number 00001101 is shifted left by 2 places.
(a)Calculate the 8 bit binary result of the shift.(2)
(b)State the denary value before and after the shift, and hence state the general effect of a left shift of n places on the value of a binary number.(2)
(Total for Question 7 is 4 marks)
8
The 8 bit binary number 11010000 is shifted right by 3 places.
(a)Calculate the 8 bit binary result of the shift.(2)
(b)State the denary value before and after the shift, and hence state the general effect of a right shift of n places on the value of a binary number.(2)
(Total for Question 8 is 4 marks)
9
Some software needs to store characters from many different alphabets, including Mandarin and Arabic characters, as well as emoji.
(a)Explain why Unicode, rather than standard 7 bit ASCII, is used to represent these characters.(2)
(b)16 bit Unicode is used instead of standard 7 bit ASCII. Calculate how many more bits per character 16 bit Unicode uses compared to 7 bit ASCII.(2)
(Total for Question 9 is 4 marks)
10
The algorithm below uses OCR reference language pseudocode:
total <- 0
FOR count <- 1 TO 5
    total <- total + (count * 2)
NEXT count
OUTPUT total
(a)Complete the trace table below to show the value of total after each pass of the loop, and state the value that is output.
counttotal
(start)0
1
2
3
4
5
OUTPUT =
(6)
(Total for Question 10 is 6 marks)
11
Add the following two 8 bit binary numbers together: 01010101 and 00101010.
(a)Calculate the 8 bit binary result of the addition, showing your carries. State whether an overflow occurs.(3)
(Total for Question 11 is 3 marks)
12
An 8 bit register is used to add the binary numbers 10110110 and 01010101.
(a)Calculate the 8 bit binary result stored in the register, showing your carries.(2)
(b)Explain why overflow has occurred and state what happens to the bit that cannot be stored.(2)
(Total for Question 12 is 4 marks)
13
An 8 bit register uses two's complement to represent signed integers.
(a)Convert the denary number -77 to an 8 bit two's complement binary number. Show your working.(3)
(Total for Question 13 is 3 marks)
14
An 8 bit two's complement register stores the value 11101001.
(a)Convert 11101001 to its denary value. Show your working.(3)
(Total for Question 14 is 3 marks)
15
The algorithm below uses OCR reference language pseudocode:
numbers <- [4, 9, 2, 7, 5]
largest <- numbers[0]
FOR index <- 1 TO 4
    IF numbers[index] > largest THEN
        largest <- numbers[index]
    ENDIF
NEXT index
OUTPUT largest
(a)Complete the trace table below to show the value of largest after each pass of the loop, and state the value that is output.
indexnumbers[index]largest
(start)-4
1
2
3
4
OUTPUT =
(6)
(Total for Question 15 is 6 marks)
16
The algorithm below uses OCR reference language pseudocode:
number <- 100
count <- 0
WHILE number > 1
    number <- number DIV 2
    count <- count + 1
ENDWHILE
OUTPUT count
(a)Complete the trace table below to show the values of number and count after each pass of the loop, and state the value that is output.
numbercount
100 (start)0
|
|
|
|
|
OUTPUT =
(7)
(Total for Question 16 is 7 marks)
17
The algorithm below uses OCR reference language pseudocode to convert a denary number to binary:
number <- 44
binaryDigits <- ""
WHILE number > 0
    remainder <- number MOD 2
    binaryDigits <- STR(remainder) + binaryDigits
    number <- number DIV 2
ENDWHILE
OUTPUT binaryDigits
(a)Complete the trace table below to show the values of remainder, binaryDigits and number after each pass of the loop, and state the string that is output. Then verify your answer by converting it back to denary.
remainderbinaryDigitsnumber
-""44 (start)
OUTPUT =
(9)
(Total for Question 17 is 9 marks)
18
Computers can represent negative integers using two's complement, or using a simpler sign-magnitude approach, where the leftmost bit only ever indicates whether the number is positive or negative and the rest of the bits store the size of the number.
(a)Explain why two's complement is used by computers to represent negative integers, rather than a sign-magnitude approach.(6)
(Total for Question 18 is 6 marks)
Mark scheme · 2.9 Trace Tables and Binary/Hex Conversions

Question 1

  • (a) Correct place values selected that total 122 (64, 32, 16, 8, 2), oeM1
  • (a) 01111010, caoA1
  • (a) Answer: 01111010
  • (b) Correct place values selected that total 201 (128, 64, 8, 1), oeM1
  • (b) 11001001, caoA1
  • (b) Answer: 11001001

Question 2

  • (a) correct offset identified, e.g. 'M' is the 13th letter of the alphabet, so the offset from 'A' is 12, oeM1
  • (a) 77, caoA1
  • (a) Answer: 77
  • (b) 6 characters identified and multiplied by 8 bits, oeM1
  • (b) 48, caoA1
  • (b) Answer: 48 bits

Question 3

  • (a) Binary split into two correct nibbles: 1011 and 0101, oeM1
  • (a) B5, caoA1
  • (a) Answer: B5
  • (b) Binary split into two correct nibbles: 0111 and 1110, oeM1
  • (b) 7E, caoA1
  • (b) Answer: 7E

Question 4

  • (a) Each hex digit correctly converted to a 4 bit nibble: 3 = 0011, A = 1010, oeM1
  • (a) 00111010, caoA1
  • (a) Answer: 00111010
  • (b) Each hex digit correctly converted to a 4 bit nibble: F = 1111, 4 = 0100, oeM1
  • (b) 11110100, caoA1
  • (b) Answer: 11110100

Question 5

  • (a) hexadecimal is much shorter/more compact to write than binary for the same value, oeB1
  • (a) each hex digit represents exactly one nibble (4 bits), so conversion between binary and hex is quick and direct, and hex is easier for humans to read/less error-prone to transcribe than long strings of 0s and 1s, oeB1
  • (a) valid real-world example, e.g. MAC addresses, HTML colour codes, memory addresses/locations (any suitable example)B1
  • (a) Answer: Hex is shorter and easier to read than binary, and each digit maps directly to 4 bits, e.g. it is used for MAC addresses or HTML colour codes.

Question 6

  • (a) correct method shown, e.g. (2 x 16) + 15, oeM1
  • (a) 47, caoA1
  • (a) Answer: 47
  • (b) correct method shown, e.g. 200 DIV 16 = 12 remainder 8, oeM1
  • (b) C8, caoA1
  • (b) Answer: C8

Question 7

  • (a) correct shifting process shown, e.g. bits moved two places left, two 0s inserted on the right, oeM1
  • (a) 00110100, caoA1
  • (a) Answer: 00110100
  • (b) before = 13, after = 52, both correct, oeB1
  • (b) a left shift by n places multiplies the value by 2n (here, shifting left by 2 multiplies by 4), provided no significant bits are lost off the left hand end, oeB1
  • (b) Answer: Before = 13, after = 52; a left shift by n places multiplies the value by 2n.

Question 8

  • (a) correct shifting process shown, e.g. bits moved three places right, three 0s inserted on the left, oeM1
  • (a) 00011010, caoA1
  • (a) Answer: 00011010
  • (b) before = 208, after = 26, both correct, oeB1
  • (b) a right shift by n places divides the value by 2n (integer division), here dividing by 8; any bits shifted off the right hand end are lost/discarded, oeB1
  • (b) Answer: Before = 208, after = 26; a right shift by n places divides the value by 2n.

Question 9

  • (a) standard ASCII only has enough bits to represent a limited number of characters (128 with 7 bits), which is not enough to cover every character used in every language and symbol set, oeB1
  • (a) Unicode uses more bits per character, so it can represent a much larger number of unique characters, covering characters from many different languages and other symbols such as emoji, oeB1
  • (a) Answer: ASCII cannot represent enough characters for every language; Unicode uses more bits per character, allowing far more characters to be represented.
  • (b) 16 - 7 shown as the method, oeM1
  • (b) 9, caoA1
  • (b) Answer: 9 more bits per character

Question 10

  • (a) count = 1: total = 2, caoB1
  • (a) count = 2: total = 6, caoB1
  • (a) count = 3: total = 12, caoB1
  • (a) count = 4: total = 20, caoB1
  • (a) count = 5: total = 30, caoB1
  • (a) OUTPUT = 30, caoB1
  • (a) Answer: total: 2, 6, 12, 20, 30; OUTPUT = 30

Question 11

  • (a) correct column-by-column addition process shown, with at least one correct carry, oeM1
  • (a) 01111111, caoA1
  • (a) no overflow occurs, because the true sum (127) fits within the range of an unsigned 8 bit number (0 to 255), oeB1
  • (a) Answer: 01111111, no overflow

Question 12

  • (a) correct column-by-column addition process shown, with correct carries propagated, oeM1
  • (a) 00001011, caoA1
  • (a) Answer: 00001011
  • (b) overflow occurs because the true sum, 267, is greater than 255, the maximum value that can be stored in an unsigned 8 bit register, oeB1
  • (b) the extra carry out of the most significant bit (bit 7) cannot be stored in an 8 bit register, so it is lost/discarded, meaning the stored result no longer represents the correct total, oeB1
  • (b) Answer: 267 exceeds the 8 bit maximum of 255, so the carry out of bit 7 is lost and the register stores an incorrect, wrapped-round value.

Question 13

  • (a) 77 correctly converted to 8 bit binary: 01001101, oeM1
  • (a) all bits correctly inverted: 10110010, oeM1
  • (a) 10110011, cao (1 added to the inverted bits)A1
  • (a) Answer: 10110011

Question 14

  • (a) bits correctly inverted: 00010110, oeM1
  • (a) 1 correctly added to the inverted bits: 00010111 (=23), oeM1
  • (a) -23, caoA1
  • (a) Answer: -23

Question 15

  • (a) numbers[index] column correct throughout: 9, 2, 7, 5, oeB1
  • (a) index = 1: largest = 9, cao (9 > 4 is true)B1
  • (a) index = 2: largest remains 9, cao (2 > 9 is false)B1
  • (a) index = 3: largest remains 9, cao (7 > 9 is false)B1
  • (a) index = 4: largest remains 9, cao (5 > 9 is false)B1
  • (a) OUTPUT = 9, caoB1
  • (a) Answer: largest: 9, 9, 9, 9; OUTPUT = 9

Question 16

  • (a) number = 50, count = 1, caoB1
  • (a) number = 25, count = 2, caoB1
  • (a) number = 12, count = 3, caoB1
  • (a) number = 6, count = 4, caoB1
  • (a) number = 3, count = 5, caoB1
  • (a) number = 1, count = 6, caoB1
  • (a) OUTPUT = 6, cao (loop ends because number is no longer greater than 1)B1
  • (a) Answer: number: 50,25,12,6,3,1; count: 1,2,3,4,5,6; OUTPUT = 6

Question 17

  • (a) iteration 1: remainder = 0, binaryDigits = "0", number = 22, caoB1
  • (a) iteration 2: remainder = 0, binaryDigits = "00", number = 11, caoB1
  • (a) iteration 3: remainder = 1, binaryDigits = "100", number = 5, caoB1
  • (a) iteration 4: remainder = 1, binaryDigits = "1100", number = 2, caoB1
  • (a) iteration 5: remainder = 0, binaryDigits = "01100", number = 1, caoB1
  • (a) iteration 6: remainder = 1, binaryDigits = "101100", number = 0, caoB1
  • (a) loop correctly identified as ending here, because number is no longer greater than 0, oeB1
  • (a) OUTPUT = 101100, caoB1
  • (a) correct verification: 101100 = 32+8+4 = 44, matching the original value of number, oeB1
  • (a) Answer: binaryDigits after each pass: 0, 00, 100, 1100, 01100, 101100; OUTPUT = 101100

Question 18

  • Level 3 Detailed explanation covering multiple points (hardware simplification, single zero representation, sign bit place value), correct terminology, ideally with an example.5-6
  • Level 2 Sound explanation of two or three points with some technical detail.3-4
  • Level 1 Basic, limited explanation of one point or an unexplained list.1-2
  • Level 0 No relevant content.0
  • Indicative content:
    • Same addition hardware/process works for positive and negative numbers
    • No separate subtraction circuit needed
    • Only one representation of zero, unlike sign-magnitude's two
    • Sign bit acts as a negative place value
    • Supported by a correct example calculation

Mark your answers

Check answers without an account. Some answers can be checked automatically; use the mark scheme to mark the rest.

Question 1

4 marks
Did your answer earn the marks?

Question 2

4 marks
Did your answer earn the marks?

Question 3

4 marks
Did your answer earn the marks?

Question 4

4 marks
Did your answer earn the marks?

Question 5

3 marks
Did your answer earn the marks?

Question 6

4 marks
Did your answer earn the marks?

Question 7

4 marks
Did your answer earn the marks?

Question 8

4 marks
Did your answer earn the marks?

Question 9

4 marks
Did your answer earn the marks?

Question 10

6 marks

Question 11

3 marks

Question 12

4 marks
Did your answer earn the marks?

Question 13

3 marks

Question 14

3 marks

Question 15

6 marks

Question 16

7 marks

Question 17

9 marks

Question 18

6 marks
Did your answer earn the marks?
Mark my answers

Worksheets are written for Revision Library and come with a full mark scheme; a few English packs quote an out-of-copyright text, and name it on the page. Exam board names and specification codes say which qualification a pack suits: we are not affiliated with, endorsed by or approved by any exam board, and no past-paper question is reproduced here. Rights queries: hello@revisionlibrary.co.uk