Skip to content

Course home

Representing algorithms

Representing algorithms

EasyMediumHard
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
Question 77

An algorithm is shown in the pseudocode below:

1  running ← True
2  total ← 0
3  WHILE running = True
4      n ← USERINPUT
5      IF n > 0 THEN
6          WHILE n > 0
7              rem ← n MOD 3
8              IF rem = 1 THEN
9                  total ← total + 2
10             ELSE IF rem = 2 THEN
11                 total ← total + 5
12             ENDIF
13             n ← n DIV 3
14         ENDWHILE
15         OUTPUT total
16         running ← False
17     ELSE
18         running ← False
19     ENDIF
20 ENDWHILE

What will be output when the user input is 22?

A

444

B

999

C

111111

D

121212

Markscheme

Representing algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Representing algorithms

208 exam-style questions on AQA GCSE Computer Science Representing algorithms. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank