EXAM QUESTIONS · AS LEVEL 9618
Algorithm Design and Problem-Solving Exam-Style Questions with Answers (A Level 9618)
Original exam-style questions on computational thinking, abstraction and decomposition, structured English, flowcharts, pseudocode, identifier tables, stepwise refinement and tracing algorithms for Cambridge AS & A Level Computer Science 9618 (Paper 2). There are 18 marks in total. Try each question on paper first, then press Show answer to see the mark scheme. Answers that can be calculated mark themselves.
Explain how abstraction is used when designing a computer model of a bus route.
Show answer
- Unnecessary details are removed, e.g. the colour of the bus or the names of the drivers. [1]
- Only the details needed are kept, e.g. the stops, distances and timings. [1]
Explain what is meant by stepwise refinement and give one benefit.
Show answer
- A problem is broken down into smaller steps [1], and each step is broken down further until it can easily be written as code. [1]
- Benefit: easier to write, test and debug each part / parts can be given to different programmers. [1]
Complete an identifier table for an algorithm that inputs the price and quantity of an item and outputs the total cost.
Show answer
| Identifier | Data type | Description |
|---|---|---|
| Price | REAL | The price of one item |
| Quantity | INTEGER | The number of items |
| TotalCost | REAL | Price × Quantity, output |
1 mark per correct row with a suitable data type and description; 1 mark for meaningful identifiers. [4]
Write this structured English as pseudocode.
Set count to zero Repeat 50 times: Input a temperature If the temperature is above 30, add one to count Output count
Show answer
Count ← 0
FOR Index ← 1 TO 50
INPUT Temperature
IF Temperature > 30
THEN
Count ← Count + 1
ENDIF
NEXT Index
OUTPUT Count- 1 mark: Count initialised to 0
- 1 mark: loop that runs 50 times
- 1 mark: input and IF with > 30 inside the loop
- 1 mark: Count incremented and output after the loop
State the values of Min and Changes after this algorithm runs.
Data ← [4, 9, 2, 7] // array indexed 1 to 4
Min ← Data[1]
Changes ← 0
FOR I ← 2 TO 4
IF Data[I] < Min
THEN
Min ← Data[I]
Changes ← Changes + 1
ENDIF
NEXT IShow answer
- Min = 2 [1]
- Changes = 1 [1]
- Only Data[3] = 2 is smaller than the current Min (4); 9 and 7 are not. [1]
Give two reasons why an algorithm might be written in pseudocode rather than program code.
Show answer
Any two from:
- It is not tied to any programming language, so any programmer can understand it.
- It lets the programmer focus on the logic without worrying about syntax.
- It is easier to read and check.
- It can easily be converted into any programming language.
Frequently asked questions
What is stepwise refinement?
Breaking each step of an algorithm into smaller, more detailed steps, repeatedly, until each step is simple enough to be written directly as program code.
Are these past paper questions?
No. These are original exam-style questions written by a Computer Science teacher in the Cambridge style.
Revise the topic: 9618 algorithm design notes · 9618 flashcards · All exam-style questions