Answer
Flashcards · IB Diploma Programme Computer Science · Topic 2
Theme B – Computational thinking and problem-solving flashcards
24 cards on Topic 2, subtopics B.1 to B.4. Pick a subtopic or study them all.
Study mode needs JavaScript. Every card is listed below, so you can still cover the answers and test yourself.
Choose your cards
Session complete
Worth another look:
All 24 cards
For a quick read-through or printing. Cover the right-hand side to test yourself.
B.1 Computational thinking
- What is decomposition?
- Breaking a complex problem into smaller sub-problems that are easier to understand, solve and test separately.
- What is abstraction?
- Removing unnecessary detail and keeping only what matters for solving the problem, e.g. a map that shows routes but not every building.
- What is pattern recognition in computational thinking?
- Spotting similarities within or between problems, so an existing solution can be reused or a repeated task can be generalised.
- What is an algorithm?
- A finite, ordered sequence of unambiguous steps that solves a problem or completes a task.
- Why design a solution in pseudocode or a flowchart before coding?
- Designing the logic separately from syntax reduces logic errors and follows the specify, decompose, abstract and test process of computational thinking.
- Linear search vs binary search
- Linear search checks each item in turn and works on unsorted data. Binary search repeatedly halves a sorted list by checking the middle item, so it needs far fewer comparisons on large lists.
B.2 Programming
- Name the three basic control structures
- Sequence (instructions in order), selection (branching on a condition, e.g. if/else) and iteration (repeating a block, e.g. for and while loops).
- What is modularity, and which computational thinking step does it express?
- Breaking a program into functions or procedures with defined inputs and outputs, making it easier to build, test and understand. It is the programming form of decomposition.
- Normal, boundary and erroneous test data
- Normal: typical, expected values. Boundary: values at the very edge of what is valid. Erroneous: invalid values the program should reject or handle gracefully.
- What is debugging by tracing?
- Stepping through code line by line, recording variable values, to find where the actual behaviour diverges from the expected behaviour.
- Name four primitive data types
- Integer, real (float), Boolean and character or string.
- What kinds of question does Paper 2 ask on programming?
- Code reading (predicting the output of code or pseudocode), code writing (a short program or function to a specification) and finding or fixing errors, answered in Java or Python.
B.3 Object oriented programming (OOP)
- Class vs object
- A class is a template defining the attributes (data) and methods (behaviour) of a type of object. An object is one instance of a class, with its own attribute values.
- What is a constructor?
- A special method that runs when an object is created (instantiated) and sets its initial attribute values.
- What is encapsulation?
- Bundling data with the methods that act on it and hiding the data from outside the class, usually with private attributes accessed through public methods (getters and setters).
- What is inheritance?
- A subclass takes on the attributes and methods of a superclass and can add its own or override them, so tested code is reused.
- What is polymorphism?
- The same method name behaving differently depending on the object it is called on, e.g. a subclass overriding a superclass method.
- What does a UML class diagram show?
- Each class as a box with its name, attributes and methods, with visibility marks (+ public, − private), and lines showing relationships such as inheritance between classes.
B.4 Abstract data types (HL only)
- What is an abstract data type?
- A data type defined by its values and the operations allowed on it, not by how it is implemented. B.4 is HL only.
- What is a linked list?
- A dynamic structure of nodes, each holding data and a pointer to the next node; the last points to null. Nodes can be added or removed by changing pointers, without shifting other items.
- Singly vs doubly vs circular linked lists
- Singly: each node points to the next. Doubly: each node points to the next and the previous. Circular: the last node points back to the first.
- What is a binary search tree?
- A binary tree in which each node's left subtree holds smaller values and its right subtree larger values, so a search can discard half the remaining tree at each step when it is balanced.
- What is a set as an abstract data type?
- An unordered collection of distinct values, with no duplicates, supporting operations such as add, remove, membership test, union and intersection.
- What is a hash table, and what is a collision?
- A structure that uses a hash function to turn a key into the position where its value is stored, giving very fast look-up. A collision is when two keys hash to the same position.