Difficulty: Medium
Correct Answer: 11
Explanation:
Introduction / Context:Classical FORTRAN provides a computed GO TO statement for multi-way branching: GO TO (L1, L2, …, Ln) k transfers control to the k-th label in the list. Understanding the indexing behavior is essential for reading legacy scientific code.
Given Data / Assumptions:
Concept / Approach:
Evaluate JCOKE after the increment, then index into the label list. Out-of-range indices typically fall through (implementation dependent), but here the index is within the valid range 1..8.
Step-by-Step Solution:
Start: JCOKE = 3.Execute JCOKE = JCOKE + 1 → JCOKE becomes 4.Computed GO TO picks the 4th label in the list.List positions: 1→5, 2→8, 3→9, 4→11, 5→15, 6→16, 7→18, 8→20.Thus, control transfers to label 11.Verification / Alternative check:
Trace as if it were an array: labels[4] = 11. This matches standard FORTRAN behavior.
Why Other Options Are Wrong:
Common Pitfalls:
Assuming zero-based indexing; forgetting the prior increment of JCOKE; miscounting label positions.
Final Answer:
11
Discussion & Comments