Question bank › GCSE › GCSE Computer Science › Fundamentals of algorithms

Representing algorithms, decomposition & abstraction

10 questions44 marksabout 55 min

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

1Grade 1–34 marks

Three flowchart symbols, A, B and C, are shown in the diagram.

(a) State the purpose of each symbol. [3]

(b) Define the term algorithm. [1]

A B C
2Grade 1–33 marks

(a) Define the term decomposition. [1]

(b) Define the term abstraction. [1]

(c) A student is writing a program for a quiz game. Give one example of how the student could use abstraction when designing the game. [1]

3Grade 6–75 marks

Look at this algorithm, written in AQA pseudocode.

nums ← [4, 7, 2, 9, 5]
max ← nums[0]
pos ← 0
FOR i ← 1 TO 4
   IF nums[i] > max THEN
      max ← nums[i]
      pos ← i
   ENDIF
ENDFOR
OUTPUT pos

(a) Complete a trace table for the algorithm with the columns i, max, pos and OUTPUT. Start with a first row showing the initial values max = 4 and pos = 0. [4]

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

Stuck on Representing algorithms, decomposition & abstraction?

Get it sorted in a free 30-minute session

We work through your weakest questions on this topic on Zoom. I reply the same day.

4Grade 1–34 marks

An algorithm is written in AQA pseudo-code. The lines are numbered to help you answer the question.

1  length ← USERINPUT
2  width ← USERINPUT
3  area ← length * width
4  IF area > 50 THEN
5     OUTPUT "Large"
6  ELSE
7     OUTPUT "Small"
8  ENDIF

(a) Give the number of one line where the algorithm performs each of the following. [3]

(i) input    (ii) processing    (iii) output

(b) State what is output when the user enters 8 for length and 7 for width. [1]

5Grade 4–54 marks

The flowchart shows a guessing game. The player keeps guessing until they enter the number 7.

Write the algorithm shown in the flowchart using AQA pseudo-code. [4]

Start INPUT guess guess = 7 ? OUTPUT "Try again" OUTPUT "Correct" End Yes No
6Grade 1–34 marks

A programmer is writing software for a supermarket self-service checkout. The diagram shows how the problem has been decomposed. Two boxes, labelled A and B, have been left blank.

(a) Suggest a suitable sub-problem for box A and for box B. [2]

(b) Explain one advantage to the programmer of decomposing the problem in this way before writing any code. [2]

Self-service checkout program Scan items A Take payment Print receipt Card payment B
7Grade 4–54 marks

(a) A student says: "My Python program is an algorithm." Explain why the student is not fully correct. [2]

(b) A bus-route map shows each stop as a dot and the route as a straight line, with no roads, buildings or distances shown. Explain how the map is an example of abstraction. [2]

8Grade 6–75 marks

An algorithm is written in AQA pseudo-code.

n ← USERINPUT
count ← 0
WHILE n > 0
   n ← n DIV 10
   count ← count + 1
ENDWHILE
OUTPUT count

(a) Complete a trace table for the algorithm when the user enters 4071. Use the columns n, count and OUTPUT, starting with a row showing n = 4071 and count = 0. [3]

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

(c) State the value output when the user enters 0. [1]

9Grade 6–76 marks

A weather station records the temperature once a day for five days.

Write an algorithm, using AQA pseudo-code, that:

  • asks the user to enter five temperatures, one at a time
  • outputs how many of the temperatures were below 0
  • outputs the mean of the five temperatures.

[6]

10Grade 8–95 marks

A student writes this algorithm in AQA pseudo-code. It is meant to count how many times the letter 'a' appears in a word entered by the user.

word ← USERINPUT
count ← 0
FOR i ← 1 TO LEN(word) - 1
   IF SUBSTRING(i, i, word) = 'a' THEN
      count ← count + 1
   ENDIF
ENDFOR
OUTPUT count

(a) State the output when the user enters the word avocado. [1]

(b) Explain why this output is not what the student intended. [2]

(c) Rewrite the FOR line so that the algorithm works as intended. [1]

(d) The student decides that a trace table is not needed because the error can be found by visual inspection. Give one advantage of using a trace table rather than visual inspection to check an algorithm. [1]

Stuck on this topic?

Book a free 30-minute session on WhatsApp and we'll find exactly which step is costing you the marks. Or build a timed paper on it.

Free 30-minute session