Bad IB questions 2

Here’s another one.

Outline how a run-time error could occur in a computer program (2 marks)

Mark Scheme Answer:
Attempt to divide by zero (1 mark); error occurs because this is an illegal operation for the compiler (1 mark)

Firstly, divide by zero is one of hundreds of possible run-time errors. Other examples are null pointer exceptions, array out of bounds, type mismatch, overflow, out of memory, etc. Secondly, by its very definition a run-time error has nothing to do with the compiler. The compiler has long since left the equation. The compiler can only generate compile-time errors, which are often syntax errors, like “else with if” or “expected ;”, or can be structural or semantic problems like “method not found”, “cannot return a value from method of type void”, or “not a statement”.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s