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

Consider the following statements.

S1 : Every SLR(1) grammar is unambiguous but there are certain unambiguous grammars that are not SLR(1).

S2 : For any context-free grammar, there is a parser that takes at most O(n3) time to parse a string of length n.

Which one of the following option is correct?

A
S1 is true and S2 is false
B
S1 is false and S2 is true
C
S1 is true and S2 is true
D
S1 is false and S2 is false
2
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.
3
GATE CSE 2021 Set 1
Numerical
+2
-0.67

Consider the following C code segment:

a = b + c;

e = a + 1;

d = b + c;

f = d + 1;

g = e + f;

In a compiler, this code segment is represented internally as a directed acyclic graph (DAG). The number of nodes of nodes in the DAG is ______

Your input ____
4
GATE CSE 2021 Set 1
MCQ (More than One Correct Answer)
+2
-0.67

Consider two hosts P and Q connected through a router R. The maximum transfer unit (MTU) value of the link between P and R is 1500 bytes, and between R and Q is 820 bytes.

A TCP segment of size 1400 bytes was transferred from P to Q through R, with IP identification value as 0 × 1234. Assume that the IP header size is 20 bytes. Further, the packet is allowed to be fragmented i. e, Don't Fragment (DF) flag in the IP header is not set by P.

Which of the following statements is/are correct?

A
TCP destination port can be determined by analysing only the second fragement.
B
If the second fragment is lost, P is required to resend the whole TCP segment.
C
Two fragments are created at R and the IP datagram size carrying the second fragment is 620 bytes.
D
If the second fragment is lost, R will resend the fragment with the IP identification value 0 × 1234.
EXAM MAP
Medical
NEET
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
CBSE
Class 12