1
GATE CSE 2021 Set 1
MCQ (Single Correct Answer)
+2
-0.67

Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation (SDT) actions, given as pseudo-code:

P → D* E*

D → int ID {record that ID.lexeme is of type int}

D → bool ID { record that ID.lexeme is of type bool}

E → E1 + E2 {check that E1.type = E2.type = int; set E.type := int}

E → !E1 {check that E1.type = bool; set E.type := bool}

E → ID {set E.type := int}

With respect to the above grammar; which one of the following choices is correct?

A
The actions will lead to infinite loop.
B
The actions can be used to correctly type-check any syntactically correct program.
C
The actions can be used to type-check syntactically correct boolean variable declarations and boolean expressions.
D
The actions can be used to type-check syntactically correct integer variable declarations and integer expressions.
2
GATE CSE 2016 Set 1
MCQ (Single Correct Answer)
+2
-0.6
Consider the following Syntax Directed Translation Scheme $$(SDTS),$$ with non-terminals $$\left\{ {S,A} \right\}$$ and terminals $$\left\{ {A,B} \right\}.$$
$$S \to aA$$ $$\,\,\,\,\,$${ print $$1$$ }
$$S \to a$$ $$\,\,\,\,$$$$\,\,\,\,\,$${ print $$2$$ }
$$A \to Sb$$ $$\,\,\,\,\,$${ print $$3$$ }

Using the above $$SDTS,$$ the output printed by a bottom-up parser, for the input $$aab$$ is:

A
$$1\,\,3\,\,2$$
B
$$2\,\,2\,\,3$$
C
$$2\,\,3\,\,1$$
D
syntax error
3
GATE CSE 2014 Set 3
MCQ (Single Correct Answer)
+2
-0.6

Consider the basic block given below.

a = b + c 
c = a + d 
d = b + c 
e = d - b 
a = e + b

The minimum number of nodes and edges present in the DAG representation of the above basic block respectively are

A
6 and 6
B
8 and 10
C
9 and 12
D
4 and 4
4
GATE CSE 2010
MCQ (Single Correct Answer)
+2
-0.6

The program below uses six temporary variables a, b, c, d, e, f.

a = 1 
b = 10 
c = 20 
d = a + b 
e = c + d 
f = c + e 
b = c + e 
e = b + f 
d = 5 + e 
return d + f

Assuming that all operations take their operands from registers, what is the minimum number of registers needed to execute this program without spilling?

A
2
B
3
C
4
D
6
GATE CSE Subjects
Software Engineering
Web Technologies
EXAM MAP
Medical
NEET
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
CBSE
Class 12