First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.
Continue in the practice tool above to load more questions, 50 at a time.
Question 1Computational Thinking and Problem Solving
In computational thinking, what does decomposition mean?
- Repeating the same steps many times
- Ignoring detail that is not needed
- Splitting a problem into parts Correct answer.
- Combining small programs into one larger one
Explanation
Decomposition means breaking a complex problem into smaller sub-problems that can each be tackled separately. The smaller parts can then be solved, tested and combined to form the whole solution.
Question 2Computational Thinking and Problem Solving
Which phrase best describes a variable in a program?
- A named block of reusable code
- A store whose value may change Correct answer.
- A fixed value that cannot change
- A value passed into a routine
Explanation
A variable is a named storage location whose contents can be altered while the program runs. Its name lets the programmer refer to the stored value throughout the code.
Question 3Computational Thinking and Problem Solving
Which of these is the best definition of an algorithm?
- A step-by-step method for solving a task Correct answer.
- A rule used to check that input is valid
- An error that stops a program from running
- A named storage location that holds data
Explanation
An algorithm is a finite sequence of clear, ordered steps that takes inputs and produces a solution to a problem. It must be unambiguous so that each step can be carried out without interpretation.
Question 4Computational Thinking and Problem Solving
In a flowchart, what does a parallelogram represent?
- A value being input or output Correct answer.
- A step that processes data
- A decision with two outcomes
- The start or end of the algorithm
Explanation
The parallelogram (slanted rectangle) is the standard flowchart symbol for input and output operations. Data entering or leaving the algorithm is shown inside it.
Question 5Computational Thinking and Problem Solving
Noticing that several separate parts of a problem share the same structure is called what?
- Finding and fixing errors in code
- Pattern recognition Correct answer.
- Checking that a program meets requirements
- Converting a design into program code
Explanation
Pattern recognition is spotting similarities, repetition or trends within a problem so that one general solution can be reused. It often leads to loops, functions or reusable sub-programs.
Question 6Computational Thinking and Problem Solving
Which term means repeating a group of instructions a set number of times or until a condition is met?
- Sequence
- Selection
- Abstraction
- Iteration Correct answer.
Explanation
Iteration is the repeated execution of a block of instructions, implemented with loops such as for, while or repeat-until. The repetition stops when a count is reached or a condition changes.
Question 7Computational Thinking and Problem Solving
Which construct runs different instructions depending on whether a condition is true or false?
- Sequence
- Recursion
- Iteration
- Selection Correct answer.
Explanation
Selection uses a condition to choose between alternative paths, as in an if-else statement or a decision symbol in a flowchart. Exactly one branch is followed each time the statement is reached.
Question 8Computational Thinking and Problem Solving
Which search method checks each item in turn starting from the first item of a list?
- Merge sort
- Binary search
- Linear search Correct answer.
- Bubble sort
Explanation
A linear search works through the list one item at a time until the target is found or the list ends. It works on unsorted data but can be slow for long lists.
Question 9Computational Thinking and Problem Solving
Study this pseudocode:
total ← 0
for i ← 1 to 4
total ← total + i
What is the value of total when the loop finishes?
- 24
- 10 Correct answer.
- 4
- 6
Explanation
The loop adds each value of i from 1 to 4 to total, giving 1 + 2 + 3 + 4 = 10. The loop body runs four times, once for each value of i.
Question 10Computational Thinking and Problem Solving
Binary search can only be used on a list that is which of the following?
- Stored in a linked list
- Free of duplicate values
- Small enough to fit in memory
- Sorted into order Correct answer.
Explanation
Binary search works by comparing the target with the middle item and discarding half of the list, which is only valid if the items are in order. Without sorting, the discarded half might contain the target.
Question 11Computational Thinking and Problem Solving
A list contains 5, 3, 8, 1. One complete left-to-right pass of a bubble sort compares and swaps adjacent pairs in order. What is the list after this pass?
- 3, 5, 1, 8 Correct answer.
- 1, 3, 5, 8
- 5, 3, 1, 8
- 3, 5, 8, 1
Explanation
The pass compares 5 and 3 (swap), then 5 and 8 (no swap), then 8 and 1 (swap), giving 3, 5, 1, 8. Each pass moves the largest remaining value to the end of the unsorted section.
Question 12Computational Thinking and Problem Solving
A racing game stores each car's position, speed and colour, but never its engine temperature. Which computational thinking technique does this illustrate?
- Iteration
- Validation
- Abstraction Correct answer.
- Decomposition
Explanation
Abstraction means keeping only the details relevant to the purpose and removing the rest. Engine temperature does not affect the game's behaviour, so it is left out of the model.
Question 13Computational Thinking and Problem Solving
Why does decomposition make a large programming problem easier to solve?
- It removes the need for testing
- It removes repetition from the code
- Parts can be built and tested on their own Correct answer.
- It always makes the final program shorter
Explanation
Once a problem is broken into smaller sub-problems, each part can be designed, coded and tested independently. Errors are easier to locate because they are confined to a small, well-defined part.
Question 14Computational Thinking and Problem Solving
A flowchart tests whether number MOD 2 equals 0, outputting 'even' if it does and 'odd' if it does not. The input is 7. What is output?
- even
- nothing
- odd Correct answer.
- an error
Explanation
7 MOD 2 leaves a remainder of 1, so the condition 'equals 0' is false. The algorithm therefore follows the false branch and outputs 'odd'.
Question 15Computational Thinking and Problem Solving
A program sets score ← 3 and then runs 'while score < 10 do output score', with nothing else inside the loop. What happens?
- The loop body never runs
- The program outputs the value 10
- The loop repeats without ever ending Correct answer.
- The loop runs once and then stops
Explanation
The loop condition stays true because score is never changed inside the loop body. Since nothing alters the control variable, the condition is never satisfied and the loop runs forever.
Question 16Computational Thinking and Problem Solving
A sorted list holds about 1000 names. Roughly how many comparisons does binary search need in the worst case, compared with linear search?
- About 10 instead of about 1000 Correct answer.
- Both need about the same number
- About 500 instead of about 1000
- About 100 instead of about 1000
Explanation
Binary search halves the remaining list each time, so the number of comparisons is about log₂ of the list size. For 1000 items that is about 10 comparisons, while linear search may need all 1000.
Question 17Computational Thinking and Problem Solving
What is a trace table used for during program development?
- Sorting a list of values into order
- Storing data permanently between runs
- Translating code into machine code
- Recording variable values step by step Correct answer.
Explanation
A trace table has one column per variable and one row per step, so the values can be followed as the algorithm runs. Comparing the traced values with expected values helps locate logic errors.
Question 18Computational Thinking and Problem Solving
Which design tool shows a problem broken into sub-tasks arranged in levels, with each level refining the one above?
- A structure diagram Correct answer.
- A trace table
- Pseudocode
- A flowchart
Explanation
A structure diagram is a hierarchy of boxes in which each box is split into the smaller tasks that make it up. It records the top-down design of a solution before any code is written.
Question 19Computational Thinking and Problem Solving
How many times is the output statement carried out in this pseudocode?
for i ← 1 to 3
for j ← 1 to 4
output i * j
- 4
- 3
- 7
- 12 Correct answer.
Explanation
The outer loop runs 3 times and, for each of those, the inner loop runs 4 times. The output statement therefore executes 3 × 4 = 12 times.
Question 20Computational Thinking and Problem Solving
A program runs to completion but gives the answer 15 when 51 was expected, because two instructions were written in the wrong order. What type of error is this?
- A syntax error
- A logic error Correct answer.
- A transmission error
- A runtime error
Explanation
A logic error lets the program run but produces the wrong result because the reasoning behind the code is faulty. Reordering instructions changes the result without breaking any rule of the language.
Question 21Computational Thinking and Problem Solving
A recursive routine is defined as f(0) = 0, f(1) = 1 and f(n) = f(n-1) + f(n-2) for n > 1. What is f(5)?
- 13
- 5 Correct answer.
- 8
- 3
Explanation
Working upwards: f(2) = 1, f(3) = 2, f(4) = 3 and f(5) = 5. Each value is the sum of the two preceding values, and each call reduces n until a base case is reached.
Question 22Computational Thinking and Problem Solving
A merge sort is applied to a list of 8 items. How many levels of splitting occur before single items are reached?
- 2
- 4
- 3 Correct answer.
- 8
Explanation
The list is split 8 → 4 + 4, then 4 → 2 + 2, then 2 → 1 + 1, which takes three levels. Merge sort then merges the single items back together in order.
Question 23Computational Thinking and Problem Solving
A program accepts ages from 11 to 18 inclusive. Which set of test data best checks the boundaries?
- 10, 11, 18, 19 Correct answer.
- 5, 12, 25
- 11, 14, 18
- 0, 50, 100
Explanation
Boundary testing uses values on and just outside the limits of valid input. 10 and 19 are just outside the range and should be rejected, while 11 and 18 are the limits themselves and should be accepted.
Question 24Computational Thinking and Problem Solving
Algorithm A takes about 2n steps and Algorithm B takes about n² steps to solve the same problem. For large values of n, which is faster and why?
- A, because 2n grows more slowly than n² Correct answer.
- A, because it uses fewer lines of code
- B, because squaring makes numbers smaller
- B, because it repeats a step fewer times
Explanation
As n grows large, n² increases much faster than 2n, so Algorithm A needs far fewer steps. The constant factor of 2 matters little once n becomes large compared with the growth of n².
Question 25Computational Thinking and Problem Solving
To swap the values held in x and y, a programmer writes:
x ← y
y ← x
After both lines run, which statement is true?
- both now hold the original value of y Correct answer.
- x and y have been swapped correctly
- y keeps its original value and x changes
- both now hold the original value of x
Explanation
The first line overwrites x with the value of y, so the original value of x is lost. The second line then copies that same value into y, leaving both variables holding the original value of y. A temporary variable is needed to hold one value during the swap.
Question 26Computational Thinking and Problem Solving
What name is given to the process of breaking a large problem into smaller, more manageable parts?
- Iteration
- Abstraction
- Decomposition Correct answer.
- Selection
Explanation
Decomposition divides a complex problem into smaller sub-problems that can be solved separately. The smaller parts can then be combined to form a complete solution.
Question 27Computational Thinking and Problem Solving
A map uses a simple house symbol to stand for a large building. Which computational thinking technique does this most directly illustrate?
- Algorithm design
- Pattern recognition
- Decomposition
- Abstraction Correct answer.
Explanation
Abstraction keeps only the features needed for the task and hides the rest. A simple symbol represents a building without showing its size, materials or internal layout.
Question 28Computational Thinking and Problem Solving
Which statement best describes an algorithm?
- A high-level programming language used by experts
- A diagram showing how data is stored on disk
- A piece of hardware that stores program data
- A set of steps that solves a problem Correct answer.
Explanation
An algorithm is a finite, ordered set of instructions that transforms inputs into a required output. It is independent of any particular programming language.
Question 29Computational Thinking and Problem Solving
In a flowchart, which symbol represents a decision?
- A parallelogram
- A diamond Correct answer.
- A circle
- A rectangle
Explanation
A diamond-shaped flowchart symbol contains a condition and has two or more outgoing paths for the possible outcomes. Rectangles show processes and parallelograms show input or output.
Question 30Computational Thinking and Problem Solving
A programmer wants a variable name for a player's name. Which name is most suitable in a typical programming language?
- player-name
- player name
- 2player
- playerName Correct answer.
Explanation
A variable name normally must begin with a letter and may not contain spaces or punctuation such as a hyphen. Joining words with capital letters gives a readable valid identifier.
Question 31Computational Thinking and Problem Solving
Which data type is most suitable for storing whether a light is switched on or off?
- Boolean Correct answer.
- Integer
- Real
- String
Explanation
A Boolean can hold only two values, usually true and false, which matches the two states of a switch. Numeric and text types have many possible values and are not limited to two states.
Question 32Computational Thinking and Problem Solving
Which pseudocode statement reads a value typed by the user into the variable age?
- age ← 18
- INPUT age Correct answer.
- OUTPUT age
- age ← age + 1
Explanation
INPUT takes a value from the user and stores it in the named variable. OUTPUT and assignment do not accept data from the keyboard.
Question 33Computational Thinking and Problem Solving
Three instructions are written one after another, with no loops or conditions. Which programming construct does this show?
- Selection
- Iteration
- Sequence Correct answer.
- Recursion
Explanation
Sequence means instructions are carried out in the order in which they are written. Selection and iteration would require conditions or repetition.
Question 34Computational Thinking and Problem Solving
A program sets age ← 15 and member ← true, then runs: if age >= 16 AND member = true then output 'yes' else output 'no'. What is output?
- yes
- an error message
- no Correct answer.
- nothing
Explanation
The condition requires both parts to be true. Because age >= 16 is false, the whole AND condition is false, so the else branch runs.
Question 35Computational Thinking and Problem Solving
Consider this pseudocode:
x ← 1
while x < 5 do
output x
x ← x + 2
How many values are output?
- Two Correct answer.
- Three
- Four
- Five
Explanation
The loop outputs x while x is less than 5, and x increases by 2 each time. The values output are 1 and 3, so two values are produced.
Question 36Computational Thinking and Problem Solving
When completing a trace table for a loop, what does each row usually represent?
- One possible error in the program
- One data type used in the program
- One variable used in the program
- One pass through the loop body Correct answer.
Explanation
A trace table records how values change as the program runs. Each row usually records the state after one execution of the loop body, showing variable values and any output.
Question 37Computational Thinking and Problem Solving
Which sorting algorithm repeatedly finds the smallest remaining item and places it in the next position?
- Insertion sorting method
- Merge sort
- Bubble sort
- Selection sort Correct answer.
Explanation
Selection sort scans the unsorted part of the list for the smallest item and swaps it into the next sorted position. Bubble sort swaps adjacent items, while merge sort divides and combines lists.
Question 38Computational Thinking and Problem Solving
What is the purpose of a base case in a recursive routine?
- To repeat the recursive call twice
- To store the final answer in a list
- To make the routine run more slowly
- To provide a stopping condition Correct answer.
Explanation
A base case is a condition that can be answered without another recursive call, so it stops the recursion. Without it, the routine would keep calling itself.
Question 39Computational Thinking and Problem Solving
A programmer notices that the same calculation is needed for every item in a list. Which computational thinking approach is most directly shown?
- Program testing steps
- Abstraction techniques
- Pattern recognition Correct answer.
- Decomposition methods
Explanation
Spotting that the same calculation applies to every item identifies a repeated pattern. That pattern can then be implemented once inside a loop or function.
Question 40Computational Thinking and Problem Solving
Which is a valid reason for placing repeated code inside a function?
- To remove the need for testing
- To reuse the same code Correct answer.
- To make every variable global
- To stop loops from ending
Explanation
A function can be called wherever the same operation is needed, so the code is written once and reused. This reduces duplication and makes maintenance easier.
Question 41Computational Thinking and Problem Solving
A program gives the wrong result, so the programmer adds extra OUTPUT statements inside a loop to show variable values. What is this an example of?
- Compiling the whole program
- Changing the data type of a variable
- Printing values while debugging Correct answer.
- Writing the user documentation
Explanation
Printing intermediate values lets the programmer compare what the program is doing with what was intended. This is a common debugging technique for locating a logic error.
Question 42Computational Thinking and Problem Solving
A program contains the instruction prnt score, which is not a recognised command, so the program will not run. What type of error is this?
- Off-by-one error
- Logic error
- Syntax error Correct answer.
- Runtime error
Explanation
A syntax error breaks the rules of the language, so the program cannot be translated or run. A misspelled command name is a typical example.
Question 43Computational Thinking and Problem Solving
A ticket is valid when age < 5 OR age > 65. Which age makes the ticket valid?
- 30
- 50
- 70 Correct answer.
- 20
Explanation
The OR condition is true when either part is true. Age 70 is greater than 65, so the second part is true and the whole condition is true.
Question 44Computational Thinking and Problem Solving
What is the value of 17 DIV 5?
- 4
- 2
- 3.4
- 3 Correct answer.
Explanation
DIV gives the whole-number quotient after division, discarding the remainder. Since 5 goes into 17 three whole times, the result is 3.
Question 45Computational Thinking and Problem Solving
A recursive routine is defined as g(0) = 2 and g(n) = 2 × g(n - 1) + 1 for n ≥ 1. What is g(4)?
- 47 Correct answer.
- 45
- 23
- 46
Explanation
Apply the rule repeatedly: g(1)=5, g(2)=11, g(3)=23 and g(4)=47. Each step doubles the previous value and adds 1.
Question 46Computational Thinking and Problem Solving
Consider this pseudocode:
total ← 0
for i ← 1 to 3
for j ← 1 to 2
total ← total + i × j
What is total at the end?
- 18 Correct answer.
- 12
- 21
- 9
Explanation
For each i, the inner loop adds i×1 and i×2, which is 3i. Summing 3, 6 and 9 for i = 1, 2 and 3 gives 18.
Question 47Computational Thinking and Problem Solving
A list contains 4, 2, 7, 1. After two passes of selection sort in ascending order, what is the list?
- 1, 4, 2, 7
- 1, 2, 4, 7
- 2, 4, 7, 1
- 1, 2, 7, 4 Correct answer.
Explanation
The first pass places the smallest item, 1, at the front. The second pass looks at the remaining items 2, 7 and 4 and finds 2 already in the next position, leaving 1, 2, 7, 4.
Question 48Computational Thinking and Problem Solving
A loop starts with n ← 1 and doubles n each time until n > 100. How many times is the loop body carried out?
- Eight
- Five
- Six
- Seven Correct answer.
Explanation
The values of n after each pass are 2, 4, 8, 16, 32, 64 and 128. The loop body runs seven times, and the condition then stops the loop.
Question 49Computational Thinking and Problem Solving
A team builds a game by creating separate modules for scoring, graphics and sound. Which benefit is most directly provided by this decomposition?
- The program will use no variables
- The game will need no user testing
- The game will always run without errors
- Modules can be tested separately Correct answer.
Explanation
Decomposition assigns different parts of the problem to separate modules with clear responsibilities. This allows each module to be built, tested and maintained independently.
Question 50Computational Thinking and Problem Solving
A function should return the largest of three numbers. It sets largest ← a, then compares b and c with largest. Which test case is most important for checking the case where all three numbers are equal?
- a = -1, b = -2, c = -3
- a = 1, b = 3, c = 5
- a = 5, b = 5, c = 5 Correct answer.
- a = 5, b = 3, c = 1
Explanation
A test case with all three values equal checks that the function does not depend on a later number being strictly larger. The other cases each contain a single distinct maximum and do not test equality of all values.