Computer Science · B1

Computational thinking

Specify the problem, decompose it, abstract what matters and trace the algorithm before you write a single line of code. In 7Quest it is Thinking Workshop: 3 stages, 27 quick questions and 7 exam-style ones.

What the stages cover

Codes follow the 2027 guide (A1–A4 and B1–B4). HL-only stages are marked. Each stage is a short lesson, quick questions, a minigame and an exam-style question.

  1. The four pillars
    Define decomposition, pattern recognition, abstraction and algorithmic design, and apply them to a real problem.
    Syllabus B1.1.2, B1.1.3
  2. Specifying the problem
    Construct a complete problem specification: problem statement, constraints, objectives, inputs, outputs and measurable evaluation criteria.
    Syllabus B1.1.1
  3. Flowcharts
    Read and trace flowcharts with sequence, selection and iteration using trace tables.
    Syllabus B1.1.4

Two questions to try

Written for 7Quest in the style of the exam, not taken from past papers. Answer first, then open the markscheme.

Explain4 marksThe four pillars

A school wants an application that automatically generates the weekly timetable for all its classes. Explain how decomposition and abstraction could be used in the design of this application.

Show the markscheme

Markscheme (4 marks)

  1. Decomposition: breaking the system down into smaller sub-problems, e.g. entering data, generating the timetable, detecting clashes, displaying the timetable.
  2. Benefit of decomposition in this context: each module can be programmed/tested separately or developed by different members of the team.
  3. Abstraction: keeping only the relevant data, e.g. for each lesson the class, subject, teacher, room and time slot.
  4. Benefit/example of what is ignored: irrelevant data (the teacher’s age, the colour of the room) is discarded, which simplifies the model and the data to be stored.

A full-marks answer

Using decomposition, the problem of generating the timetable is broken down into sub-problems: managing the data (teachers, rooms, classes), allocating lessons to time slots, detecting clashes and displaying each student’s or teacher’s timetable. Each module can be programmed and tested separately, even by different people, and an error in clash detection can be located without reviewing the whole system.
Using abstraction, each lesson is represented only by the data needed for scheduling: class, subject, teacher, room and time slot; for teachers, only their availability and the subjects they teach are relevant. Details such as the teacher’s age or the decoration of the room are ignored because they do not affect the timetable; this makes the model simpler and reduces the amount of data stored.

Trace4 marksFlowcharts

Trace the following flowchart for the input n = 5, using a trace table with columns n, a, b, t, i and output.

[Start]
[Input] n
[Process] a = 0; b = 1; i = 1
<i < n?>  --No-->  [Output] b  -->  [End]
   | Yes
[Process] t = a + b; a = b; b = t; i = i + 1
   (back to <i < n?>)
Show the markscheme

Markscheme (4 marks)

  1. Correct initialisation: a = 0, b = 1, i = 1 (n = 5).
  2. Values of a: 1, 1, 2, 3 and of b: 1, 2, 3, 5, in that order.
  3. Values of t: 1, 2, 3, 5 and of i: 2, 3, 4, 5; the loop ends when i = 5 (i < n is false).
  4. Final output: 5 (once only, at the end).

A full-marks answer

Trace table (first row = initialisation; then one row per iteration, with the values at the end of that iteration):

n   a   b   t   i   i < n   output
5   0   1   -   1   True
5   1   1   1   2   True
5   1   2   2   3   True
5   2   3   3   4   True
5   3   5   5   5   False   5

The condition is checked 5 times; when i reaches 5 it is False, the loop ends and 5 is output once. The algorithm calculates the nth term of the Fibonacci sequence (1, 1, 2, 3, 5).

The other 5 questions in this topic are in the app, marked point by point, and anything you miss comes back in your review. If this is the topic you find hardest, you can make it your free topic and do all of it, with short practice tests on it, without paying or giving a card.

Start Computer Science free