Errors in programs can be classified into different types. Error type Description Example Syntax error Logic error Runtime error (a) Complete the table by d...

Assessment: Computer Science (9-1) 0984 | Paper 1 Mock 01 | Computer Systems Subject: Computer Science (9-1) - 0984

Question 1 Report

Errors in programs can be classified into different types.

Error typeDescriptionExample
Syntax error
Logic error
Runtime error

(a) Complete the table by describing each type of error and giving an example. [6]

(b) State which type of error is typically the hardest to find. Explain why. [2]

Answer Details

(a)

Error typeDescriptionExample
Syntax errorA mistake in the code that violates the grammar rules of the programming language, preventing the program from being compiled or interpreted. [1]Writing pritn("Hello") instead of print("Hello"), or forgetting to close a bracket. [1]
Logic errorThe program runs without crashing but produces incorrect results because the algorithm or reasoning in the code is wrong. [1]Using + instead of - in a calculation, so the program adds when it should subtract. [1]
Runtime errorAn error that occurs while the program is running, causing it to crash or stop unexpectedly. [1]Attempting to divide a number by zero, or trying to open a file that does not exist. [1]

(b) Logic errors are typically the hardest to find. [1] The program runs without any error messages, so the programmer receives no automatic indication of where the problem is. They must trace through the code manually or use debugging tools to identify the exact point where the output deviates from the expected behaviour. [1]

Download The App On Google Playstore

Everything you need to excel in your exams

Green Bridge CBT Mobile App
Personalized AI Learning Chat Assistant
200,000+ Exam Questions Across IGCSE, JAMB, WAEC & NECO
Over 3,900 Lesson Notes
Offline Support - Learn Anytime, Anywhere
Green Bridge Timetable
Literature Summaries & Potential Questions
Track Your Performance & Progress
In-depth Explanations for Comprehensive Learning