ITPEC FE Morning April 2022 Question 7
ITPEC FE Morning April 2022 — Question 7 of 80
Nested Array Index Calculation — evaluate A[i,j] = 2×i + j with computed indices.
Given: A[i, j] = 2 × i + j, find A[A[1,1] × 2, A[2,2] + 1].
Step 1 — compute inner values:
- A[1, 1] = 2 × 1 + 1 = 3
- A[2, 2] = 2 × 2 + 2 = 6
Step 2 — compute outer indices:
- First index: A[1,1] × 2 = 3 × 2 = 6
- Second index: A[2,2] + 1 = 6 + 1 = 7
Step 3 — substitute:
- A[6, 7] = 2 × 6 + 7 = 19
Answer: d) 19
Why not others:
- (a) 12 — likely from miscalculating inner values
- (b) 13 — likely from using wrong formula order
- (c) 18 — from forgetting +1 in the second index
Key rule: Always resolve innermost expressions first, then use results as indices for the outer call.
AI-generated — may contain errors
The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.