Parsing & Syntax Analysis

Your answer
Answer & solution
Answer: C: −10 (no official key was published)
The outer condition X>Y evaluates as −10>20, which is false. Its entire then statement, including the nested if and its else, is skipped. Therefore neither abs(X) nor doubling executes, and X stays −10. Pascal associates the else with the nearest unmatched if, namely the inner X<0 test. Treating that else as belonging to the outer test would incorrectly execute the doubling branch and obtain −20.