DigiBacc

Practice questionsIB Computer ScienceComputational thinking
IB Computer Science

Computational thinking practice questions.

21 exam-style questions on Computational thinking with answers and explanations. Six real samples below — the full set is free with an account.

Syllabus

Topics covered

Try it

Sample questions

A design team splits a hospital appointment system into a booking part, a reminder part and a billing part, and writes a separate specification for each. Which approach to computational thinking are they applying?

  • Decomposition
  • Abstraction
  • Pattern recognition
  • Algorithm evaluation

Answer: Decomposition

Breaking a system into parts that can each be specified, built and tested on their own is decomposition. Abstraction would mean discarding detail from the situation, not creating separate parts of the solution.

A delivery company models a city as a set of junctions joined by roads, each road labelled with an average travel time. Street names, road surfaces and building heights are left out. Which statement best describes what the designers have done?

  • They have decomposed the routing task into smaller independent sub-tasks
  • They have kept only the detail that the route calculation needs
  • They have recognised a pattern repeated in every delivery round
  • They have tested two rival algorithms on the same set of journeys

Answer: They have kept only the detail that the route calculation needs

Representing a real situation with only the features that affect the result is abstraction; travel time changes the chosen route, a street name does not. A model is not wrong because it omits detail, only if it omits detail the calculation needs.

A programmer notices that marking a spelling test, a times-table test and a vocabulary test all follow the same three steps: read the response, compare it with the key, add to the score. Which approach lets a single marking subprogram serve all three tests?

  • Recognising the structure shared by the three tasks
  • Decomposing each test into individual questions
  • Evaluating how quickly each test can be marked
  • Removing detail that the marking process does not need

Answer: Recognising the structure shared by the three tasks

Spotting that separate tasks repeat the same structure is pattern recognition, and it is what makes one reusable solution possible. Decomposition would produce three separate marking routines rather than one shared one.

Which requirement must a sequence of steps meet before it can properly be called an algorithm?

  • It must be expressed in a programming language before use
  • It must contain at least one loop or one decision
  • It must finish after a finite number of steps
  • It must give a different result for every possible input

Answer: It must finish after a finite number of steps

An algorithm has to be finite and unambiguous, so a set of steps that can run forever is not one. It may be written in pseudocode or drawn as a flowchart, and a straight sequence with no loop is still an algorithm.

In a flowchart, which symbol is used for a step at which the algorithm chooses between two paths?

  • A rectangle
  • An oval (terminator)
  • A parallelogram
  • A diamond

Answer: A diamond

The diamond holds a condition and has two exits that must both be labelled, usually yes and no. A rectangle is a process, a parallelogram is input or output and an oval marks the start or the stop.

Two designs find the highest mark in an unsorted list of 500 marks. Design X sorts the whole list and then takes the last value. Design Y makes one pass through the list, keeping the largest value seen so far. Which comparison of the two designs is correct?

  • Design X is faster because a sorted list can be searched quickly
  • Both designs must inspect the same number of marks in total
  • Design X is preferable because it avoids storing a running value
  • Design Y does less work because it inspects each mark once

Answer: Design Y does less work because it inspects each mark once

Both designs are correct, so the choice is decided by the work done: Y looks at each of the 500 marks once, while X first rearranges the whole list and then reads one value. Producing the right answer and producing it efficiently are separate questions.

21 Computational thinking questions — free with an account. Spaced repetition, streaks and full exam simulations included.

Practise them free
All subjects Pricing For teachers

This platform is independently developed and is not endorsed by, affiliated with, or sponsored by the International Baccalaureate Organization. “International Baccalaureate” and “IB” are registered trademarks of the IBO.