Unit 5: B1 Computational thinking

Topic 5.1: Thinking computationally about a problem Questions

Practice 20 exam-style questions for IB Computer Science Topic 5.1. Review the question stems below, then unlock the full Question Bank to access markschemes, model answers, and AI grading.

1Choose1 mark
2026
Choose the best example of abstraction.
Markscheme and model answer locked
Unlock Question
2Outline3 marks
2026
Outline what a problem specification should contain.
Markscheme and model answer locked
Unlock Question
3Construct3 marks
2026
Construct a flowchart, described in steps, that inputs a number and outputs whether it is positive, negative or zero.
Markscheme and model answer locked
Unlock Question
4Construct4 marks
2026
Construct, as steps, a flowchart that reads 10 numbers and outputs their total.
Markscheme and model answer locked
Unlock Question
5Suggest3 marks
2026
A flowchart initialises HIGH to zero before finding the highest of a set of numbers. Suggest why this can give a wrong answer.
Markscheme and model answer locked
Unlock Question
6Determine3 marks
2026
Determine the output of this Java code. int total = 0; for (int i = 1; i <= 4; i++) { total = total + i * i; } System.out.println(total);
Markscheme and model answer locked
Unlock Question
7Determine3 marks
2026
Determine what this Python code outputs and what it is doing, where words is a list of strings. c = 0 for w in words: if len(w) > 5: c = c + 1 print(c)
Markscheme and model answer locked
Unlock Question
8Determine3 marks
2026
Determine what this Java code outputs and what it is doing, where words is an array of strings. int c = 0; for (String w : words) { if (w.length() > 5) { c = c + 1; } } System.out.println(c);
Markscheme and model answer locked
Unlock Question
9Determine3 marks
2026
Determine the output of this Java code. int x = 5; int y = 2; while (x > y) { x = x - 1; } System.out.println(x);
Markscheme and model answer locked
Unlock Question
10Determine3 marks
2026
Determine what is wrong with this Python code. i = 1 while i < 10: print(i)
Markscheme and model answer locked
Unlock Question
11Determine3 marks
2026
Determine what is wrong with this Java code. int i = 1; while (i < 10) { System.out.println(i); }
Markscheme and model answer locked
Unlock Question
12Choose1 mark
2026
Choose the output of this Java code. int i = 1; while (i <= 3) { System.out.println(i); i = i + 1; }
Markscheme and model answer locked
Unlock Question
13Determine1 mark
2026
Determine the output of this Python code. a = 3 b = 7 if a > b: print(a) else: print(b)
Markscheme and model answer locked
Unlock Question
14Determine1 mark
2026
Determine the output of this Java code. int a = 3; int b = 7; if (a > b) { System.out.println(a); } else { System.out.println(b); }
Markscheme and model answer locked
Unlock Question
15Determine3 marks
2026
A programmer tries to swap the values of a and b in Python like this. a = 4 b = 9 a = b b = a Determine what goes wrong.
Markscheme and model answer locked
Unlock Question
16Determine3 marks
2026
A programmer tries to swap the values of a and b in Java like this. int a = 4; int b = 9; a = b; b = a; Determine what goes wrong.
Markscheme and model answer locked
Unlock Question
17Determine3 marks
2026
Determine the final value of total after this Python code runs. total = 0 for i in range(1, 6): if i % 2 == 0: total = total + i
Markscheme and model answer locked
Unlock Question
18Determine3 marks
2026
Determine the final value of total after this Java code runs. int total = 0; for (int i = 1; i <= 5; i++) { if (i % 2 == 0) { total = total + i; } }
Markscheme and model answer locked
Unlock Question
19Determine3 marks
2026
Determine the output of this Python code. n = 5 f = 1 while n > 0: f = f * n n = n - 1 print(f)
Markscheme and model answer locked
Unlock Question
20Determine3 marks
2026
Determine the output of this Java code. int n = 5; int f = 1; while (n > 0) { f = f * n; n = n - 1; } System.out.println(f);
Markscheme and model answer locked
Unlock Question

Ready to practice Topic 5.1?

Get instant AI feedback on your answers, view detailed markschemes, and track your progress across all IB Computer Science topics.

Start Practising Now