Unit 6: B2 Programming

Topic 6.1: Programming fundamentals Questions

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

1Distinguish2 marks
2021
A form stores a person's middle initial and their full surname. Distinguish between the char and string data types.
Markscheme and model answer locked
Unlock Question
2Define1 mark
2023
A programmer names a variable totalScore and a method addPoints. Define the term identifier.
Markscheme and model answer locked
Unlock Question
3Determine3 marks
2026
Determine the output of this Java code. String s = "DATABASE"; String r = ""; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) != 'A') { r = r + s.charAt(i); } } System.out.println(r);
Markscheme and model answer locked
Unlock Question
4Determine1 mark
2026
Determine the output of this Java code. String s = "ALGORITHM"; System.out.println(s.length());
Markscheme and model answer locked
Unlock Question
5Determine2 marks
2026
Determine the output of this Java code. String s = "DATABASE"; int c = 0; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == 'A') { c = c + 1; } } System.out.println(c);
Markscheme and model answer locked
Unlock Question
6Determine3 marks
2026
Determine the output of this Python code. s = 'DATABASE' r = '' for ch in s: if ch != 'A': r = r + ch print(r)
Markscheme and model answer locked
Unlock Question
7Determine1 mark
2026
Determine the output of this Python code. s = 'ALGORITHM' print(len(s))
Markscheme and model answer locked
Unlock Question
8Determine2 marks
2026
Determine the output of this Python code. s = 'DATABASE' c = 0 for ch in s: if ch == 'A': c = c + 1 print(c)
Markscheme and model answer locked
Unlock Question
9Determine3 marks
2026
A palindrome check compares the first and last characters of a string, moves both positions one step inward, and repeats; it reports a palindrome only if every pair matches exactly. Determine whether the check reports 'Never odd or even' as a palindrome, and explain.
Markscheme and model answer locked
Unlock Question
10Describe4 marks
2027
A ticket system stores each date as one string in the form year-month-day, for example 2026-03-14. A method has been written that rewrites the date as day/month/year, so 2026-03-14 becomes 14/03/2026. Describe the steps involved in this method.
Markscheme and model answer locked
Unlock Question
11Describe4 marks
2027
A school stores email addresses such as lisa.nowak@school.org. A method has been written that rewrites each address as the domain, a colon, a space and then the username, so lisa.nowak@school.org becomes school.org: lisa.nowak. Describe the steps involved in this method.
Markscheme and model answer locked
Unlock Question
12Determine3 marks
2026
Determine the output of this Java code. public class Demo { static int x = 5; static void change() { int x = 10; } public static void main(String[] args) { change(); System.out.println(x); } }
Markscheme and model answer locked
Unlock Question
13Determine3 marks
2026
Determine the output of this Python code. x = 5 def change(): x = 10 change() print(x)
Markscheme and model answer locked
Unlock Question
14Construct6 marks
2026
Write a Python program that reads a student's five marks, works out the mean, and outputs the mean and whether it is a pass at 50.
Markscheme and model answer locked
Unlock Question
15Explain4 marks
2026
Explain the difference between static and dynamic typing, with one advantage of each.
Markscheme and model answer locked
Unlock Question
16State3 marks
2026
State the value of X after: X = 5; X = X + 3; X = X * 2.
Markscheme and model answer locked
Unlock Question
17Outline2 marks
2025
A physics simulation updates the speed of 5 000 particles many times a second, using a double for each speed. Outline one advantage of using a primitive data type for this.
Markscheme and model answer locked
Unlock Question
18State1 mark
2025
A cinema program stores how many tickets are left for a showing. State a suitable data type for this variable.
Markscheme and model answer locked
Unlock Question
19State1 mark
2022
A program checks whether a number n is even. State the condition it should test, using mod.
Markscheme and model answer locked
Unlock Question
20Define1 mark
2023
In a Java or Python program, int and boolean are described as primitive data types. Define the term primitive data type.
Markscheme and model answer locked
Unlock Question

Ready to practice Topic 6.1?

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

Start Practising Now