MCQs / Computer Science / Unit 2: Computational Thinking and Algorithms

Unit 2: Computational Thinking and Algorithms MCQs — Computer Science

43 multiple-choice questions on Unit 2: Computational Thinking and Algorithms from Computer Science, each with the correct answer and, where available, a teacher's explanation. Read through them to revise the chapter, then practise the same questions one by one to test yourself.

1. Binary search can be used only when the list is:

  1. Made of strings only
  2. Smaller than 10 items
  3. Unsorted
  4. Sorted

Answer: D) Sorted

Explanation: Binary search compares with the middle element to discard half the list — this needs sorted data. SLO CS-11-B-02 · Knowledge

Discuss this question

2. In a flowchart, which symbol represents a decision?

  1. Oval
  2. Diamond
  3. Parallelogram
  4. Rectangle

Answer: B) Diamond

Explanation: Diamond = decision, rectangle = process, parallelogram = input/output, oval = start/stop. SLO CS-11-B-01 · Knowledge

Discuss this question

3. Pseudocode is:

  1. An informal, language-independent description of an algorithm's steps
  2. A type of flowchart symbol
  3. A program that runs only in Python
  4. Machine code for the CPU

Answer: A) An informal, language-independent description of an algorithm's steps

Explanation: Pseudocode uses structured English-like statements so the logic can be understood before coding. SLO CS-11-B-01 · Knowledge

Discuss this question

4. Running an algorithm by hand with sample values to check each step is called:

  1. Encrypting
  2. Dry run (tracing)
  3. Deploying
  4. Compiling

Answer: B) Dry run (tracing)

Explanation: A dry run tracks variable values in a trace table to find logic errors. SLO CS-11-B-01 · Knowledge

Discuss this question

5. Bubble sort is applied to [5, 1, 4, 2] in ascending order. What is the list after the first pass?

  1. [1, 4, 2, 5]
  2. [1, 5, 4, 2]
  3. [5, 4, 2, 1]
  4. [1, 2, 4, 5]

Answer: A) [1, 4, 2, 5]

Explanation: Compare neighbours and swap if needed: (5,1)→swap, (5,4)→swap, (5,2)→swap. The largest value bubbles to the end. SLO CS-11-B-02 · Application

Discuss this question

6. Breaking a big problem into smaller, manageable parts is called:

  1. Encryption
  2. Abstraction
  3. Iteration
  4. Decomposition

Answer: D) Decomposition

Explanation: Decomposition splits a problem into sub-problems. SLO CS-11-B-02 · Knowledge

Discuss this question

7. For a small, unsorted list, the most appropriate search is:

  1. Insertion search on a tree
  2. Bubble sort
  3. Binary search
  4. Linear search

Answer: D) Linear search

Explanation: Linear search works on any list; sorting first just to search once is wasteful. SLO CS-11-B-02 · Understanding

Discuss this question

8. Trace this pseudocode with N = 10. What is printed? pseudo sum ← 0 i ← 2 WHILE i ≤ N sum ← sum + i i ← i + 2 END WHILE PRINT sum

  1. 25
  2. 55
  3. 30
  4. 20

Answer: C) 30

Explanation: It adds the even numbers 2 + 4 + 6 + 8 + 10 = 30. SLO CS-11-B-01 · Application

Discuss this question

9. Which criterion is used to evaluate an algorithm's efficiency?

  1. How much time and memory it needs as the input grows
  2. The colour of the flowchart
  3. The programming language chosen
  4. How many comments it has

Answer: A) How much time and memory it needs as the input grows

Explanation: Efficiency compares running time and memory; correctness and clarity are other criteria. SLO CS-11-B-01 · Understanding

Discuss this question

10. How many passes does bubble sort need, at most, to sort a list of n items?

  1. log2 n
  2. n - 1
  3. n
  4. 2n

Answer: B) n - 1

Explanation: After each pass one more item is in its final place; after n-1 passes all are sorted. SLO CS-11-B-02 · Understanding

Discuss this question

11. Noticing that several problems are solved by the same steps is an example of:

  1. Pattern recognition
  2. Debugging
  3. Decomposition
  4. Abstraction

Answer: A) Pattern recognition

Explanation: Pattern recognition finds similarities so one solution can be reused. SLO CS-11-B-02 · Understanding

Discuss this question

12. Which computational thinking skill removes unnecessary details to focus on what is essential?

  1. Pattern recognition
  2. Decomposition
  3. Algorithm design
  4. Abstraction

Answer: D) Abstraction

Explanation: Abstraction hides detail (a map shows roads, not every tree). SLO CS-11-B-02 · Knowledge

Discuss this question

13. Which is the most efficient way to find an item in a sorted list of 1,000 items?

  1. Repeatedly halve the list and check the middle item
  2. Print all numbers from 1 to 1000
  3. Shuffle the list and check randomly
  4. Check every item one by one from the start

Answer: A) Repeatedly halve the list and check the middle item

Explanation: Halving the search space (binary search) needs at most about 10 comparisons for 1,000 items. SLO CS-11-B-01 · Application

Discuss this question

14. Which flowchart symbol is used for input or output?

  1. Diamond
  2. Circle
  3. Rectangle
  4. Parallelogram

Answer: D) Parallelogram

Explanation: Parallelograms show reading input or displaying output. SLO CS-11-B-01 · Knowledge

Discuss this question

15. What is the maximum number of comparisons binary search needs to find an item in a sorted list of 1,000 items?

  1. 100
  2. 1000
  3. 500
  4. 10

Answer: D) 10

Explanation: Each step halves the list: 2^10 = 1024 ge 1000, so at most 10 comparisons. SLO CS-11-B-02 · Application

Discuss this question

16. Insertion sort works by:

  1. Choosing items at random
  2. Splitting the list in halves recursively
  3. Taking each item and inserting it into its correct place among the already-sorted items
  4. Repeatedly swapping neighbouring items through the whole list

Answer: C) Taking each item and inserting it into its correct place among the already-sorted items

Explanation: Like sorting playing cards in your hand one at a time. SLO CS-11-B-02 · Understanding

Discuss this question

17. Removing unnecessary details and focusing on what matters is:

  1. decomposition
  2. abstraction
  3. sorting
  4. iteration

Answer: B) abstraction

Explanation: Abstraction hides irrelevant details (e.g. a metro map). SLO CS-11-B-02

Discuss this question

18. Breaking a big problem into smaller parts is called:

  1. abstraction
  2. debugging
  3. decomposition
  4. pattern recognition

Answer: C) decomposition

Explanation: Decomposition splits a problem into manageable sub-problems. SLO CS-11-B-02

Discuss this question

19. A table that records variable values step by step to check an algorithm is a:

  1. K-map
  2. frequency table
  3. truth table
  4. trace table

Answer: D) trace table

Explanation: A trace table is used for dry runs. SLO CS-11-B-01

Discuss this question

20. Bubble sort can stop early when:

  1. the first item is the smallest
  2. it has done n passes
  3. a complete pass makes no swaps
  4. the list has an even length

Answer: C) a complete pass makes no swaps

Explanation: No swaps in a pass means every adjacent pair is in order. SLO CS-11-B-02

Discuss this question

21. "Does the algorithm give the right result for all valid inputs and stop?" checks its:

  1. abstraction
  2. clarity
  3. efficiency
  4. correctness

Answer: D) correctness

Explanation: Correctness means right output for all valid inputs in finite time. SLO CS-11-B-01

Discuss this question

22. To change "sum of numbers" into "product of numbers", the starting value must change from 0 to:

  1. 1
  2. N
  3. −1
  4. 2

Answer: A) 1

Explanation: Multiplying by 0 would always give 0, so a product starts at 1. SLO CS-11-B-01

Discuss this question

23. A structured, English-like description of an algorithm that is not tied to any language is:

  1. pseudocode
  2. machine code
  3. source code
  4. a compiler

Answer: A) pseudocode

Explanation: Pseudocode is language-independent and easy to translate into code. SLO CS-11-B-01

Discuss this question

24. Maximum comparisons needed by binary search on 1 024 sorted items is about:

  1. 512
  2. 11
  3. 1024
  4. 100

Answer: B) 11

Explanation: ⌊log₂ 1024⌋ + 1 = 10 + 1 = 11. SLO CS-11-B-02

Discuss this question

25. Which flowchart symbol represents input or output?

  1. Rectangle
  2. Diamond
  3. Circle
  4. Parallelogram

Answer: D) Parallelogram

Explanation: Parallelograms are used for INPUT and OUTPUT. SLO CS-11-B-01

Discuss this question

Page 1 of 2 Next

Practise Unit 2: Computational Thinking and Algorithms MCQs

More Computer Science chapters