Multiple choice › Testing and debugging
Testing and debugging
1. Testing and debugging
In a project meeting, team members presented their code for others to review and identify errors. Which error detection method was being applied?
- Deskchecking
- Program trace
- Single line stepping
- Structured walkthrough
Answer
D
NESA answer key: D. Old syllabus (SDD): useful as overlap practice only.
2. Testing and debugging
The following algorithm is designed to calculate an average mark. 999 is used as a sentinel value. BEGIN Count = 0 Total = 0 Get Mark WHILE Mark <> 999 Count = Count +1 Total = Total + Mark Get Mark ENDWHILE Average = Total / Count Display Average END When the algorithm is coded, compiled and executed, which type of error is possible?
- Logic
- Runtime
- Syntax
- System
Answer
B
NESA answer key: B. If the first mark entered is 999, Count stays 0 and Average = Total / Count divides by zero (runtime error). Old syllabus (SDD): useful as overlap practice only.
3. Testing and debugging
While developing software, a programmer uses a compiler prior to execution. Which row of the table correctly matches a type of error with the stage at which it may be detected? Type of error | Stage detected
- Logic | Execution
- Syntax | Execution
- Runtime | Compilation
- Overflow | Compilation
Answer
A
NESA answer key: A. Old syllabus (SDD): useful as overlap practice only.
4. Testing and debugging
Which of the following statements is true about error detection?
- A variable can be used to check if certain conditions have been met.
- A breakpoint identifies where a program stops due to a runtime error.
- A stub requires programmer input before a program trace can continue.
- A debugging output statement produces a message when a syntax error occurs.
Answer
A
NESA answer key: A. Old syllabus (SDD): useful as overlap practice only.
5. Testing and debugging
Consider the following code fragment. BEGIN OPEN FileName for input ItemName = “XXX” READ ItemName from FileName WHILE ItemName is not equal to “XXX” ProcessItem READ ItemName from FileName CLOSE FileName ENDWHILE END Which type of error will result when this code is executed after successful compilation?
- Syntax
- Runtime
- Overflow
- Type mismatch
Answer
B
NESA answer key: B. Old syllabus (SDD): useful as overlap practice only.
6. Testing and debugging
Which pair are software debugging tools?
- Mind maps and brainstorming
- Gantt charts and storyboards
- Desk checks and walkthroughs
- Breakpoints and debugging output statements
Answer
D
2025 Q15(b) feedback: separate software debugging tools (breakpoints, debugging output, stepping) from manual testing such as desk checking.
7. Testing and debugging
Stubs and drivers are used to:
- Encrypt a module
- Test a module before the modules it depends on or is called by exist
- Convert Python to pseudocode
- Draw a structure chart
Answer
B
A stub stands in for a called module that is not written yet; a driver is a temporary caller used to test a module.