Difficulty: Easy
Correct Answer: At run-time
Explanation:
Introduction / Context:Exceptions represent abnormal conditions that arise while a program is executing. This question asks you to identify the correct phase where exceptions are thrown and caught.
Given Data / Assumptions:
Concept / Approach:By definition, exceptions are run-time events. They indicate conditions detected during execution (e.g., invalid cast, divide by zero, out-of-range index, failed I/O), though JIT or loader errors themselves may be surfaced as exceptions when execution starts.
Step-by-Step Solution:
Pick the phase where try/catch blocks can intercept errors: run-time. Compilation/linking phases can report diagnostics, but those are compile-time or build-time errors, not run-time exceptions.Verification / Alternative check:Examples: IndexOutOfRangeException, NullReferenceException occur only while running.
Why Other Options Are Wrong:They refer to build or loading phases; exceptions are an execution-time mechanism.
Common Pitfalls:Confusing compile-time errors with exceptions.
Final Answer:At run-time
Discussion & Comments