Computer Science EngineeringHard

In the dangling-else problem, the usual resolution is to associate an else with

  1. A. the nearest unmatched if
  2. B. the first if in the statement
  3. C. the outermost if
  4. D. no if at all

Correct answer: A. the nearest unmatched if

Most languages bind else to the closest preceding if that does not yet have an else.

More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions

Exams that ask this topic