Sample Quizzes For Preparation: Algorithm Design And Problem-Solving
O Level & IGCSE Computer Science
Chapter 7 – Algorithm Design and Problem-Solving: Quiz
1. What is the main purpose of using pseudocode in algorithm design?
A) To execute programs without compiling
B) To write code in any specific language
C) To test algorithms visually
D) To represent logic in a language-independent way
2. Which symbol is typically used for assignment in pseudocode?
A) =
B) :=
C) ←
D) ==
3. What is the correct pseudocode to add 1 to the variable count?
A) count =+ 1
B) count ← count + 1
C) count ++
D) add(count,1)
4. Which of the following is NOT a valid loop structure in pseudocode?
A) WHILE…DO
B) FOR…NEXT
C) LOOP…ENDLOOP
D) REPEAT…UNTIL
5. In the context of algorithm design, what is decomposition?
A) Breaking a program into inputs and outputs only
B) Turning source code into machine code
C) Breaking a problem into smaller, manageable parts
D) Removing redundant variables
6. What type of test data would you use to check how a program handles data at the boundary of acceptable values?
A) Normal data
B) Extreme data
C) Abnormal data
D) Boundary data
7. What is the purpose of validation checks?
A) To confirm that the program is coded correctly
B) To test the performance of the CPU
C) To ensure input data is sensible and meets specific rules
D) To re-enter inputs that failed verification
8. Which of the following best describes a linear search algorithm?
A) Divides the list in half repeatedly
B) Compares each item sequentially until a match is found
C) Sorts the list before searching
D) Uses recursion to locate data
9. What is the key difference between validation and verification?
A) Validation checks data accuracy; verification checks presence
B) Validation checks reasonableness; verification confirms data entry accuracy
C) Verification tests loops; validation tests inputs
D) Validation is for code and verification is for variables
10. What does a trace table help identify?
A) Syntax errors
B) The variable and output values during each step of the algorithm
C) The runtime errors
D) The format of user input
11. Which of the following is an example of abnormal test data for an input field requiring an integer between 1 and 10?
A) 5
B) 11
C) -3
D) “cat”
12. Which flowchart symbol is used for a decision point?
A) Rectangle
B) Oval
C) Diamond
D) Parallelogram
13. Which sorting algorithm compares adjacent items and swaps them if necessary?
A) Insertion sort
B) Selection sort
C) Quick sort
D) Bubble sort
14. What is the correct structure of a WHILE loop in pseudocode?
A) WHILE condition:
B) WHILE condition DO
C) WHILE (condition)
D) IF condition THEN
15. Which of these is NOT a valid verification method?
A) Double entry
B) Range check
C) Visual check
D) Check digit
16. Which of the following is a suitable structure diagram component?
A) Algorithm table
B) Loop indicator
C) Module
D) Pointer
17. Which of the following is a purpose of the ‘analysis’ stage in the program development life cycle?
A) Drawing flowcharts
B) Identifying user needs and decomposing the problem
C) Writing code
D) Choosing programming languages
18. What does an oval represent in a flowchart?
A) Start or end
B) Process
C) Decision
D) Input/Output
19. What type of test data is 0 for a range of 1 to 100?
A) Normal
B) Extreme
C) Boundary
D) Abnormal
20. What should be done in the testing stage of the development cycle?
A) Debugging and compiling
B) Rewriting requirements
C) Using test data to ensure correct outputs
D) Performing user training
21. Which pseudocode structure represents a conditional branch?
A) LOOP UNTIL
B) FOR…TO…NEXT
C) IF…THEN…ELSE
D) SWITCH…CASE
22. In pseudocode, how is user input typically represented?
A) PRINT “Enter value”
B) GET input
C) INPUT ← value
D) READ value
23. What does the keyword ‘OUTPUT’ indicate in pseudocode?
A) The value will be saved to a file
B) The value will be printed or displayed
C) The value will be encrypted
D) The value will be reused
24. What is meant by abstraction in the analysis stage?
A) Converting data types
B) Focusing on only essential details
C) Sorting inputs
D) Drawing a flowchart
25. Which of the following is an example of a process in a flowchart?
A) Start
B) Calculate Total ← Price * Quantity
C) Is Total > 100?
D) Input Quantity
26. What validation method ensures a field is not left empty?
A) Type check
B) Presence check
C) Length check
D) Format check
27. Which check would ensure a user enters a valid date format?
A) Type check
B) Format check
C) Range check
D) Double entry
28. What is meant by “dry-running” an algorithm?
A) Executing the code
B) Testing it with live users
C) Manually stepping through the algorithm to trace variables
D) Using automated tools to test speed
29. What is the result of: IF X > 10 THEN OUTPUT "High"
when X = 5?
A) Output will be “High”
B) Output will be X
C) No output
D) Syntax error
30. Which of the following would be considered extreme test data for the range 1–100?
A) 0
B) 1
C) 50
D) 100
Answer Key and Explanations – Chapter 7: Algorithm Design and Problem-Solving
1. D – To represent logic in a language-independent way
Pseudocode helps communicate algorithms clearly without being tied to a specific programming syntax.
Other options are incorrect because pseudocode is not executed (A), not language-bound (B), and not a visual tool (C).
2. C – ←
The left arrow (←
) is the most standard symbol for assignment in pseudocode. =
may be confused with comparison.
3. B – count ← count + 1
This is the proper way to increment a value in pseudocode. Other options either use incorrect syntax or represent actual code, not pseudocode.
4. C – LOOP…ENDLOOP
This is not standard pseudocode. While other loops are used commonly in algorithm writing, this structure is not typical.
5. C – Breaking a problem into smaller, manageable parts
Decomposition allows complex systems to be tackled piece by piece, improving understanding and maintainability.
6. D – Boundary data
Boundary data tests the exact limits of allowed input, ensuring correct inclusion/exclusion.
7. C – To ensure input data is sensible and meets specific rules
Validation checks confirm data follows expected rules like length, type, or format.
8. B – Compares each item sequentially until a match is found
Linear search checks each element one by one. A is binary search, C is unrelated, D is not a search method.
9. B – Validation checks reasonableness; verification confirms data entry accuracy
Validation ensures inputs are logical. Verification ensures data is entered/transferred accurately.
10. B – The variable and output values during each step of the algorithm
Trace tables are used to simulate code execution and record how values change line by line.
11. D – “cat”
It’s non-numeric, making it abnormal. B and C are out-of-range but still numeric.
12. C – Diamond
Diamond shapes represent decisions. Rectangles are processes, ovals are start/end, and parallelograms are input/output.
13. D – Bubble sort
Bubble sort compares and swaps adjacent elements. Other options use different strategies.
14. B – WHILE condition DO
This is the correct pseudocode syntax. Others reflect programming syntax or are incorrect structures.
15. B – Range check
Range check is validation, not verification. Visual and double entry are verification methods.
16. C – Module
Structure diagrams represent modules (parts of programs). Other options don’t belong in structure diagrams.
17. B – Identifying user needs and decomposing the problem
The analysis phase is about understanding what’s needed. Flowcharts and code writing come later.
18. A – Start or end
Ovals are used to show the beginning or end in flowcharts.
19. D – Abnormal
0 is not valid for the 1–100 range, so it’s abnormal (invalid), not boundary.
20. C – Using test data to ensure correct outputs
Testing is about validating the logic and ensuring the program behaves as expected.
21. C – IF…THEN…ELSE
This is the conditional structure in pseudocode.
22. D – READ value
READ is commonly used to take input in pseudocode. GET or INPUT ← is non-standard.
23. B – The value will be printed or displayed
OUTPUT is for displaying data to the user.
24. B – Focusing on only essential details
Abstraction filters out unnecessary complexity to focus on core ideas.
25. B – Calculate Total ← Price * Quantity
This is a processing step, making it a process in the flowchart.
26. B – Presence check
Ensures data is not left blank. Type and range checks don’t handle empty fields.
27. B – Format check
Checks structure (e.g. DD/MM/YYYY). Other checks handle content rather than format.
28. C – Manually stepping through the algorithm to trace variables
Dry-running is manually simulating execution to debug logic.
29. C – No output
Since the condition X > 10
is false, the statement in the IF block is skipped.
30. D – 100
Extreme data includes the highest acceptable value. 0 is abnormal, 1 is boundary, 50 is normal.