Which of the following is an example of a runtime error?

Karel crashing into a wall

A command missing a semicolon

An if/else statement missing a set of parentheses

A function definition missing a closing curly bracket

1 answer

A runtime error occurs when a program is able to compile but encounters an error while executing.

Among the options you've listed, Karel crashing into a wall is an example of a runtime error. This error occurs during execution when the program attempts to perform an action that isn't valid due to the current state of the program (e.g., Karel moving into a wall).

The other options (missing semicolon, missing parentheses in an if/else statement, and missing closing curly bracket in a function definition) would typically result in compile-time errors, meaning the program would not run at all until those errors are fixed.