MCQs / Computer Science / Unit 2: Computational Thinking and Algorithms
Unit 2: Computational Thinking and Algorithms MCQs — Computer Science (page 2) 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.
26. Which approach to summing 1 to n is most efficient? The formula n(n + 1)/2 Recursion adding one at a time Two nested loops A loop adding each number Answer: A) The formula n(n + 1)/2
Explanation: The formula needs a single calculation whatever the size of n. SLO CS-11-B-01
Discuss this question
27. What is printed? (sum of even numbers algorithm with N = 9) python N = 9 s, i = 0, 2 while i <= N: s += i i += 2 print(s) 18 30 25 20 Answer: D) 20
Explanation: 2 + 4 + 6 + 8 = 20; the loop stops when i = 10. SLO CS-11-B-01
Discuss this question
28. Which sort works like arranging playing cards in your hand? Linear sort Binary sort Insertion sort Bubble sort Answer: C) Insertion sort
Explanation: Insertion sort inserts each new item into its correct place in the sorted part. SLO CS-11-B-02
Discuss this question
29. Worst-case number of comparisons for bubble sort on 8 items is: 16 28 8 64 Answer: B) 28
Explanation: (n − 1) + … + 1 = n(n − 1)/2 = 28. SLO CS-11-B-02
Discuss this question
30. Which search is better for a small, unsorted list? K-map search Linear search Binary search Bubble search Answer: B) Linear search
Explanation: Linear search works on unsorted data and is simple for small lists. SLO CS-11-B-02
Discuss this question
31. Insertion sort is especially efficient when the list is: nearly sorted stored on paper in reverse order very large and random Answer: A) nearly sorted
Explanation: Few items need to be shifted when the list is almost sorted. SLO CS-11-B-02
Discuss this question
32. In pseudocode, the symbol ← usually means: assignment less than comparison output Answer: A) assignment
Explanation: count ← count + 1 assigns a new value to count. SLO CS-11-B-01
Discuss this question
33. After the first pass of bubble sort (ascending) on [5, 1, 4, 2, 8], the list is: [1, 4, 2, 5, 8] [1, 5, 4, 2, 8] [5, 1, 4, 2, 8] [1, 2, 4, 5, 8] Answer: A) [1, 4, 2, 5, 8]
Explanation: Swaps: (5,1), (5,4), (5,2); (5,8) stays – the largest value reaches the end. SLO CS-11-B-02
Discuss this question
34. The rounded rectangle (oval) in a flowchart shows: a decision start or stop a process a connector only Answer: B) start or stop
Explanation: Terminal symbols mark the start and end. SLO CS-11-B-01
Discuss this question
35. In binary search, if the middle item is smaller than the target, the search continues in the: left half whole list again middle only right half Answer: D) right half
Explanation: The target must be among the larger values to the right. SLO CS-11-B-02
Discuss this question
36. Searching for a word in a printed dictionary by opening near the middle is similar to: insertion sort linear search bubble sort binary search Answer: D) binary search
Explanation: The dictionary is sorted, and you repeatedly halve the range. SLO CS-11-B-02
Discuss this question
37. For a program accepting marks 0–100, the value 100 is: normal data erroneous data boundary data invalid data Answer: C) boundary data
Explanation: Values at the limits of the valid range are boundary (extreme) data. SLO CS-11-B-01
Discuss this question
38. What does this program print? python data = [3, 8, 12, 17, 23] print(data.index(17)) 3 -1 4 2 Answer: A) 3
Explanation: Indexes start at 0: 3→0, 8→1, 12→2, 17→3. SLO CS-11-B-02
Discuss this question
39. Noticing that every class needs the same permission letter, so one template can be reused, is: encryption pattern recognition decomposition abstraction Answer: B) pattern recognition
Explanation: Pattern recognition finds similarities to reuse solutions. SLO CS-11-B-02
Discuss this question
40. The property of an algorithm that it must stop after a finite number of steps is: effectiveness definiteness clarity finiteness Answer: D) finiteness
Explanation: An algorithm must terminate. SLO CS-11-B-01
Discuss this question
41. To sort in descending order with bubble sort, the comparison a[j] a[j+1] changes to: a[j] == a[j+1] a[j] = a[j+1] a[j] < a[j+1] it does not change Answer: C) a[j] < a[j+1]
Explanation: Swap when the left item is smaller, so larger values move to the front. SLO CS-11-B-02
Discuss this question
42. Which flowchart symbol is used for a decision? Diamond Oval Rectangle Parallelogram Answer: A) Diamond
Explanation: A diamond holds a condition with Yes/No exits. SLO CS-11-B-01
Discuss this question
43. Binary search requires the list to be: short sorted made of strings only unsorted Answer: B) sorted
Explanation: Binary search halves a sorted range; on unsorted data it gives wrong answers. SLO CS-11-B-02
Discuss this question
Previous Page 2 of 2
Practise Unit 2: Computational Thinking and Algorithms MCQs
More Computer Science chapters