QUESTION IMAGE
Question
which of the following is an example of a runtime error?
i. karel crashing into a wall
ii. leaving a colon off the end of a function definition
iii. using the wrong syntax in an if/else statement
iv. not closing all open parenthesis
options:
i
i and iii
ii and iv
i - iv, all
answered
great work!
question: 2
if the following program is supposed to put down three tennis balls, where is the logic error?
1 def place_three_ball():
2 for i in range(4):
3 put_ball()
4
5 placethreeballs()
options:
line 1
line 2
line 3
line 5
For Question 1:
Runtime errors occur while code runs, not during parsing. I is a runtime error (Karel acts during execution). II, III, IV are syntax errors caught before execution.
For Question 2:
- Line 1: Function name is
place_three_ball(), but Line 5 callsplaceThreeBalls()(mismatched names, so the defined function never runs). - Line 2 uses
range(4)which would place 4 balls, but the core logic error is the function call mismatch, as the intended function isn't invoked at all.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
- I
- Line 5