Time Left - 15:00 mins

GATE CS 2021 : Compiler Design Quiz 4 (App update required to attempt this test)

Attempt now to get your rank among 491 students!

Question 1

Consider the syntax directed translation scheme(SDTS), with non-terminals {S,A} and {a,b}-

S -> bA {print 30}

S->b {print 20}

A-> Sa {print 10}

Using above SDTS, the output printed by bottom - up parser, for the input bba:-

Question 2

Consider the following SDT

S -> 0 {S.x = 0}

S -> 1 {S.x = 1}

S -> S0 {S.x = S1.x * 2}

S -> S1 {S.x = S1.x * 2 + 1}

What will be translation of an input “1001” using above SDT?

Question 3

Consider the following Attributed grammar:

E -> E + E {E.x = E1.x + E2.x}

E -> E * E {E.x = E1.x * E2.x}

E -> id {E.x = id.val}

Above SDT is

Question 4

Consider the following SDT :

E E + T {E.val = E.val - T.val , Printf(E.val)}

E T {E.val = T.val+1}

T T*F {T.val = T.val + F.val}

T F {T.val = 2*F.val}

What will be printed when the provided input is : 5+4*9 _________.

F id {F.val = id}

Question 5

Let G be the grammar with the following translations for bottom up parser :

S-> a {print "M"} A

A-> S {print "S"}

A-> bB {print "I"}

A-> {print "R"} c

B-> d {print "H"} A

B-> epsilon {print "W"}

What is the sum of the output produced for the input "abdbdac" using the above SDT if the value of M=1 ,S=2 ,I=3 ,R=4 ,H=5 ,W=6 ?

Question 6Multiple Correct Options

Which of the following statements is/are correct?(Multi Select Question)
  • 491 attempts
  • 1 upvote
  • 6 comments
Oct 13GATE & PSU CS

Posted by:

Harshita AgarwalHarshita AgarwalMember since Jul 2020
Share this quiz   |