GATE CSE 2020 Q43: Which semantic rules are L-attributed
- Compiler Design
- 2 marks
- MCQ
- −2/3 if wrong
Question
Consider the productions and . Each of the five non-terminals A, P, Q, X, and Y has two attributes: is a synthesized attribute, and is an inherited attribute. Consider the following rules.
Rule 1: , , and
Rule 2: and
Which one of the following is TRUE?
Try it: multiple choice: exactly one correct option
Show answer and explanation
Answer: B (official GATE 2020 final answer key)
Concept used: L-attributed: an inherited attribute of a child may depend only on the parent's inherited attributes and on attributes of siblings to its left.
First step: Check each inherited attribute: in Rule 2, uses , and is to the right of .
Full step-by-step solution
Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.
Share this question
Source: official GATE 2020 CS question paper and final answer key, organised by IIT Delhi. Question paper · Answer key
More Compiler Design PYQs
- 2026 Session 1 · Q27Classify errors in three C string declarations
- 2026 Session 1 · Q28True statements about LL(1) parsing
- 2026 Session 1 · Q42Redundant (common) subexpressions in blocks B4 and B5 of a CFG
- 2026 Session 1 · Q53Compare two SDDs for type declarations
- 2026 Session 2 · Q35Count tokens produced by a lexer for a given string
- 2026 Session 2 · Q41Shift-reduce conflicts in the LR(0) table of a grammar