GATE Computer ScienceModerateGATE CS (PYQ pattern)
An array A[1..4], [0..5], [1..6] of 8-byte elements is stored in row-major order starting at address 500. What is the address of A[3][2][5]?
- A. 1500
- B. 1204
- C. 1348
- D. 1108
Correct answer: B. 1204
Dimension sizes are [4, 6, 6]; the offset is built Horner-style from (index − lower bound), then × 8, giving 1204. Forgetting the lower bounds or swapping the layout order gives the distractors.
More Compiler Design questions
- For G: S → A b | a A c | B c | a B b; A → a; B → a, which statements are true? I. G is LL(2). II. G is SLR(1). III. G is LALR(1). IV. The…
- For E → id | E [ E ] | ( E ) (augmented), how many states does the LR(0) automaton have, and which is the strongest of LR(0) / SLR(1) /…
- S → A B; A → a | ε; B → A b | c generates exactly five strings, and its LL(1) table has one multiply-defined cell. If that cell is…
- Consider an SDD where for A → B C the rules are: B.i = A.i + 1, C.i = B.s, A.s = C.s. Which statement is correct?
- Consider these claims about LR parsers. I. Merging LR(1) states with the same core can create a shift-reduce conflict that the canonical…
- Code: k = 3; m = k k; k = k + 1; p = k m; q = p - 36; s = q + z; r = s 1. Only r is live at the end and z is an input. After constant…