Multiple choice technology programming languages

What does Debug.assert() do?

  1. takes Boolean condition as parameter and shows error dialog if condition is true; but proceeds without interruption if condition is false.

  2. takes Boolean condition as parameter and throws exception if condition is false; but proceeds without interruption if condition is true.

  3. takes Boolean condition as parameter and shows error dialog if condition is false; but proceeds without interruption if condition is true.

  4. None of above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Debug.Assert checks a condition and shows an error dialog only when the condition is false (indicating a failure). When the condition is true (normal case), execution continues uninterrupted. The dialog helps catch logic errors during development.

AI explanation

Debug.assert() takes a Boolean condition and is meant to verify an assumption during development: if the condition evaluates to false, it signals a problem (traditionally by showing an error/alert), but if the condition is true, execution simply continues uninterrupted. This matches how assertions work generally — they exist to catch cases that should never happen, not to halt on the expected/true case.