GATE CS 2020 (Forenoon) — Question 43

Compiler DesignSyntax-Directed Translation & Runtime EnvironmentsMCQ2 marks · −2/3 if wrongMedium

Consider the productions \( A \rightarrow PQ \) and \( A \rightarrow XY \). Each of the five non-terminals A, P, Q, X and Y has two attributes: \( s \) is a synthesized attribute, and \( i \) is an inherited attribute. Consider the following rules. Rule 1: \( P.i = A.i + 2 \), \( Q.i = P.i + A.i \) and \( A.s = P.s + Q.s \) Rule 2: \( X.i = A.i + Y.s \) and \( Y.i = X.s + A.i \) Which one of the following is TRUE?
  1. A
    Both Rule 1 and Rule 2 are L-attributed.
  2. B
    Only Rule 1 is L-attributed.
  3. C
    Only Rule 2 is L-attributed.
  4. D
    Neither Rule 1 nor Rule 2 is L-attributed.
Practise the full 2020-FN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAPractise this subject in the exam simulatorTimed, GATE-style tests with analytics that find your weak topics.
Practise more on Syntax-Directed Translation & Runtime EnvironmentsTimed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group