Question bank › GCSE Computer Science › Algorithms

Designing algorithms: flowcharts, pseudocode, trace tables, errors

Answer on paper first, then reveal the mark scheme one mark at a time.

1Grade 6–75 marks

The flowchart shows an algorithm.

(a) Complete a trace table with columns n, count and output for the algorithm when the input is 6. [4]

(b) State the output when the input is 1. [1]

StartInput ncount = 0n > 1 ?NoYesn MOD 2 == 0 ?YesNon = n DIV 2n = n * 3 + 1count = count + 1Output countEnd
2Grade 4–55 marks

Look at the algorithm below.

nums = [4, 7, 2, 9, 5]
x = nums[0]
for i = 1 to 4
    if nums[i] > x then
        x = nums[i]
    endif
next i
print(x)

(a) Complete a trace table with columns i, x and output. [4]

(b) State the purpose of the algorithm. [1]

3Grade 6–75 marks

The algorithm below uses the MOD and DIV operators.

num = int(input("Enter a number"))
total = 0
while num > 0
    digit = num MOD 10
    total = total + digit
    num = num DIV 10
endwhile
print(total)

(a) Complete a trace table with columns num, digit, total and output when the input is 507. [4]

(b) Describe the purpose of the algorithm. [1]

4Grade 1–34 marks

The diagram shows four flowchart symbols labelled A to D.

State what each symbol is used for. [4]

ABCD
5Grade 8–96 marks

A teacher wants a program that lets them enter test scores one at a time. Entering -1 stops the input. The program must then output the mean score and the highest score.

Write an algorithm for the program, using OCR Exam Reference Language or a high-level programming language. [6]

Still losing marks on this topic?

Book a free introductory session and we'll find exactly which step is costing you.

Book a free intro