Question bank › A-level Computer Science › Theory of computation

Abstraction, automation and systematic problem solving

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

1Core4 marks

A company is writing route-planning software for its delivery drones. The software models the town as a set of points (landing pads) joined by straight-line flight paths, each labelled with its length in metres.

(a) Explain why this model is an example of representational abstraction. [1]

(b) State two details of the real town that have been left out of the model. [2]

(c) The software also stores records for drones, delivery vans and cargo bikes. Each is treated as a kind of delivery vehicle that has a maximum load and a top speed. State the type of abstraction being used here. [1]

2Core4 marks

The structure chart below shows how a programmer has designed a quiz program.

(a) State the name of the problem-solving technique, shown in the chart, of breaking a problem into sub-problems that each have an identifiable task. [1]

(b) The finished Mark answer module calls Compare answer and then Update score. State the term for combining procedures into a compound procedure in this way. [1]

(c) Each question is stored as a record holding the question text, four options and the correct option. All the records are then held in a list. Explain how this is an example of composition of data. [1]

(d) Once the design is complete, the programmer writes the code and runs it. State the term used for putting a model into action in this way. [1]

Run quizLoad questionsAsk questionMark answerShow resultsCompare answerUpdate score
3Standard5 marks

The algorithm below is written in pseudo-code.

x ← USERINPUT
total ← 0
WHILE x > 0
  d ← x MOD 10
  IF d MOD 2 = 1 THEN
    total ← total + d
  ELSE
    total ← total - d
  ENDIF
  x ← x DIV 10
ENDWHILE
OUTPUT total

(a) Complete a trace table, with columns x, d and total, for the algorithm when the user enters 7258. State the value that is output. [4]

(b) An algorithm must always terminate. Explain why this algorithm will always terminate for any positive integer input. [1]

Stuck on Abstraction, automation and systematic problem solving?

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.

4Standard3 marks

Three warehouse robots, X, Y and Z, each send status messages. Every robot is either reliable (all its messages are true) or faulty (all its messages are false).

  • X reports: “Y is faulty.”
  • Y reports: “X and Z are both faulty.”
  • Z reports: “Y is reliable.”

Determine which of the robots are reliable and which are faulty. You must show your reasoning. [3]

5Standard4 marks

A programmer creates a class Playlist. Internally it stores songs in a private array with a private integer pointer to the next free position. Other parts of the program can only use the public methods AddSong(title), RemoveSong(title) and Length().

(a) Explain how this design uses information hiding. [2]

(b) The programmer later replaces the array with a linked list. Explain why data abstraction means no other part of the program needs to change. [1]

(c) Length() returns the number of songs. A user of the class knows what Length() computes but not how it computes it. State the type of abstraction this is an example of. [1]

6Hard5 marks

A sixth-form college must schedule exams so that no student has two exams in the same session. The table shows which pairs of subjects share at least one student.

SubjectShares students with
MathsPhysics, Chemistry, History
PhysicsMaths, Chemistry
ChemistryMaths, Physics, Biology
BiologyChemistry, History
HistoryBiology, Maths

The developer notices that this problem can be solved by reducing it to a graph-colouring problem, where adjacent vertices must have different colours and an algorithm for this already exists.

(a) Explain what is meant by problem abstraction (reduction). [1]

(b) Describe how the exam problem is represented as a graph-colouring problem. [3]

(c) State the minimum number of sessions needed for these five exams. [1]

7Standard5 marks

A cinema booking program asks the user how many tickets they want. The program should accept only whole numbers from 1 to 8 inclusive.

(a) For each test value below, state whether it is normal, boundary or erroneous test data. [3]

  • 5
  • 8
  • “three”

(b) Explain why the programmer should test the value 9 as well as the value 8. [1]

(c) Describe what is meant by acceptance testing. [1]

8Hard5 marks

A year is a leap year if it is divisible by 4, except that a year divisible by 100 is only a leap year if it is also divisible by 400.

A student has written the following function.

FUNCTION IsLeap(y)
  IF y MOD 4 = 0 THEN
    RETURN True
  ELSE IF y MOD 100 = 0 THEN
    RETURN False
  ELSE IF y MOD 400 = 0 THEN
    RETURN True
  ELSE
    RETURN False
  ENDIF
ENDFUNCTION

(a) State the value returned by IsLeap(1900) and explain why this shows the function is incorrect. [2]

(b) Rewrite the function in pseudo-code so that it is correct for all years. [3]

9Hard6 marks

A software house is building an appointment system for a group of veterinary clinics. The project manager plans to use an iterative (agile) approach with prototyping rather than completing each stage fully before starting the next.

Discuss how the analysis and design stages should be carried out for this project, and the benefits and drawbacks of using an iterative approach with prototypes. [6]

10Stretch6 marks

The function below is intended to return True if the positive integer n is prime.

FUNCTION IsPrime(n)
  isPrime ← True
  i ← 2
  WHILE i < n
    IF n MOD i = 0 THEN
      isPrime ← False
    ENDIF
    i ← i + 1
  ENDWHILE
  RETURN isPrime
ENDFUNCTION

(a) State how many times the body of the WHILE loop is executed when n is 91. [1]

(b) Identify a positive integer input for which the function returns an incorrect result. [1]

(c) Describe two changes that would make the function more time-efficient. One of your changes must reduce the range of values of i that are tested; explain why this change does not affect the result returned. [3]

(d) With both of your changes made, state how many times the loop body is executed when n is 97. [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