Exam-style question
Try this first
What will happen if you try to access an index that is out of bounds?.
- A.The program will run normally
- B.An error will occur
- C.The last element will be returned
- D.The first element will be returned
Answer and explanation
Concise answer
An error will occur
Why this is correct
Accessing an out-of-bounds index typically results in a runtime error.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
