Compiler Design-Syntax Directed Translation [GATE (Graduate Aptitude Test in Engineering) Computer Science & IT (CS)]: Questions 1 - 3 of 11

Choose Programs:

🎓 Study Material (1190 Notes): 2024-2025 Syllabus

Rs. 1000.00 -OR-

3 Year Validity (Multiple Devices)

Topic-wise Notes & SampleDetails

🎯 302 Numeric, 2894 MCQs (& PYQs) with Full Explanations (2024-2025 Exam)

Rs. 650.00 -OR-

3 Year Validity (Multiple Devices)

CoverageDetailsSample Explanation

Help me Choose & Register (Watch Video) Already Subscribed?

Question 1

Appeared in Year: 2020

Question MCQ▾

Consider the productions A ⇾ PQ and A ⇾ 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?

Choices

Choice (4)Response

a.

Only Rule 2 is L-attributed

b.

Both Rule 1 and Rule 2 are L-attributed

c.

Only Rule 1 is L-attributed

d.

Neither Rule 1 nor Rule 2 is L-attributed

Edit

Question 2

Appeared in Year: 2019

Question MCQ▾

Consider the following grammar and the semantic actions to support the inherited type declaration attributes. Let , and be the placeholders for the non-terminals D, T, L or in the following table:

Grammar and the Semantic Actions to Support
Production ruleSemantic action
T. type = int
T. type = intt. type = float
add Type

Which one of the following are the appropriate choices for and ?

Choices

Choice (4)Response

a.

b.

c.

d.

Edit

Question 3

Question Numeric Answer▾

Consider the grammar given below:

Let a, b, d, and be indexed as follows:

Let a, B, D, and $ be Indexed as Follows
abd$
3210

Compute the Follow set of the non-terminal B and write the index values for the symbols in the Follow set in the descending order. (For example, if the FOLLOW set is , then the answer should be 3210)

Edit