GATE CSE Compiler design PYQ
Q1➡ | GATE 2021 Set-1 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 ) Which one of the following options is correct? |
i ➥ S1 is true and S2 is true |
ii ➥ S1 is true and S2 is false |
iii ➥ S1 is false and S2 is true |
iv ➥ S1 is false and S2 is false |
Show Answer With Best Explanation
Answer: I
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parser | Help-Line |
Q2➡ | GATE 2021 Set-1 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? |
i ➥ The actions can be used to type-check syntactically correct boolean variable declarations and boolean expressions |
ii ➥ The actions can be used to correctly type-check any syntactically correct program. |
iii ➥ The actions will lead to an infinite loop. |
iv ➥ The actions can be used to type-check syntactically correct integer variable declarations and integer expressions |
Show Answer With Best Explanation
Answer: IV
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Syntax Directed Translation | Help-Line |
Q3➡ | GATE 2021 Set-1 Consider the following context-free grammar where the set of terminals is {a, b, c, d, f} Which one of the following choices represents the correct combination for the numbered cells in the parsing table (“blank” denotes that the corresponding cell is empty)? |
i ➥ ① S ⟶ Rf ② S ⟶ Rf ③ T ⟶ ∊ ④ T ⟶ ∊ |
ii ➥ ① blank ② S ⟶ Rf ③ T ⟶ ∊ ④ T ⟶ ∊ |
iii ➥ ① blank ② S ⟶ Rf ③ blank ④ blank |
iv ➥ ① S ⟶ Rf ② blank ③ blank ④ T ⟶ ∊ |
Show Answer With Best Explanation
Answer: I
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parsers | Help-Line |
Q4➡ | GATE 2021 Set-1 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 in the DAG is _______. |
Show Answer With Best Explanation
Answer: 6
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Syntax tree | Help-Line |
Q5➡ | GATE 2021 Set-2 |
i ➥ Semantic analyzer |
ii ➥ Machine dependent optimizer |
iii ➥ Lexical analyzer |
iv ➥ Syntax analyzer |
Show Answer With Best Explanation
Answer: I
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Help-Line |
Q6➡ | GATE 2021 Set-2 For a statement S in a program, in the context of liveness analysis, the following sets are defined: USE(S) : the set of variables used in S IN(S) : the set of variables that are live at the entry of S OUT(S) : the set of variables that are live at the exit of S Consider a basic block that consists of two statements, S1 followed by S2. Which one of the following statements is correct? |
i ➥ OUT(S1) =IN(S2) |
ii ➥ OUT(S1) =IN(S2) U OUT(S2) |
iii ➥ OUT(S1) =IN(S1) U USE(S1) |
iv ➥ OUT(S1) =USE(S1) U IN(S2) |
Show Answer With Best Explanation
Answer: I
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Code Optimization | Help-Line |
Q7➡ | GATE 2021 Set-2 Consider the following augmented grammar with {#, @, <, >, a, B, c} as the set of terminals. S’ ⟶ S S ⟶ S#cS S ⟶ SS S ⟶ S@ S ⟶ < S > S ⟶ a S ⟶ b S ⟶ c Let I0=CLOSURE({S’ ⟶.S}). The number of items in the set GOTO(GOTO(I0, <), <) is __. |
Show Answer With Best Explanation
Answer: 8
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parser | Help-Line |
Q8➡ | GATE 2020 Consider the following statements. I. Symbol table is accessed only during lexical analysis and syntax analysis. II. Compilers for programming languages that support recursion necessarily need heap storage for memory allocation in the run-time environment. III. Errors violating the condition ‘any variable must be declared before its use’ are detected during syntax analysis. Which of the above statements is/are TRUE? |
i ➥ I and III only |
ii ➥ II only |
iii ➥ I only |
iv ➥ None of I, II and III |
Show Answer With Best Explanation
Answer: IV
Explanation: Upload Soon
More Discussion | Explanation On YouTube | RunTime Environment | Help-Line |
Q9➡ | GATE 2020 Consider the following grammar. S → aSB|d B → b The number of reduction steps taken by a bottom-up parser while accepting the string aaadbbb is ________. |
Show Answer With Best Explanation
Answer: 7
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parsers | Help-Line |
Q10➡ | GATE 2020 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? |
i ➥ Only Rule 1 is L-attributed. |
ii ➥ Only Rule 2 is L-attributed. |
iii ➥ Neither Rule 1 nor Rule 2 is L-attributed. |
iv ➥ Both Rule 1 and Rule 2 are L-attributed. |
Show Answer With Best Explanation
Answer: I
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Synthesized Attribute | Help-Line |
Q11➡ | GATE 2019 Which one of the following kinds of derivation is used by LR parsers? |
i ➥ Rightmost |
ii ➥ Leftmost in reverse |
iii ➥ Rightmost in reverse |
iv ➥ Leftmost |
Show Answer With Best Explanation
Answer: III
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parsers | Help-Line |
Q12➡ | GATE 2019 Consider the grammar given below: S → Aa A → BD B → b | ε D → d | ε Let a, b, d and $ be indexed as follows: 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 {a, b, d, $}, then the answer should be 3210) |
Show Answer With Best Explanation
Answer: 31
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parsers | Help-Line |
Q13➡ | GATE 2019 Consider the following grammar and the semantic actions to support the inheritance type declaration attributes. Let X1, X2, X3, X4, X5 and X6 be the placeholders for the non-terminals D, T, L or L1 in the following table: Which one of the following are the appropriate choices for X1, X2, X3 and X4? |
i ➥ X1 = L, X2 = T, X3 = L1, X4 = L |
ii ➥ X1 = T, X2 = L, X3 = T, X4 = L1 |
iii ➥ X1 = T, X2 = L, X3 = L1, X4 = T |
iv ➥ X1 = L, X2 = L, X3 = L1, X4 = T |
Show Answer With Best Explanation
Answer: I
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Synthesized and L- Attribute | Help-Line |
Q14➡ | GATE 2018 Which one of the following statements is FALSE? |
i ➥ Context-free grammar can be used to specify both lexical and syntax rules. |
ii ➥ Type checking is done before parsing. |
iii ➥ High-level language programs can be translated to different Intermediate Representations. |
iv ➥ Arguments to a function can be passed using the program stack. |
Show Answer With Best Explanation
Answer: II
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Compiler | Help-Line |
Q15➡ | GATE 2018 Consider the following parse tree for the expression a#b$c$d#e#f, involving two binary operators $ and #. Which one of the following is correct for the given parse tree? |
i ➥ $ has higher precedence and is left associative; # is right associative |
ii ➥ # has higher precedence and is left associative; $ is right associative |
iii ➥ $ has higher precedence and is left associative; # is left associative |
iv ➥ # has higher precedence and is right associative; $ is left associative |
Show Answer With Best Explanation
Answer: I
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Associativity-and-Precedence | Help-Line |
Q16➡ | GATE 2018 A lexical analyzer uses the following patterns to recognize three tokens T1, T2, and T3 over the alphabet {a,b,c}. T1 : a?(a|c)*a T2 : b?(a∣c)*b T3 : c?(b∣a)*c Note that ‘x?’ means 0 or 1 occurrence of the symbol x. Note also that the analyzer outputs the token that matches the longest possible prefix. If the string bbaacabc is processes by the analyzer, which one of the following is the sequence of tokens it outputs? |
i ➥ T1T2T3 |
ii ➥ T1T1T3 |
iii ➥ T2T1T3 |
iv ➥ T3T3 |
Show Answer With Best Explanation
Answer: IV
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Compilers | Help-Line |
Q17➡ | GATE 2017 Set-1 Consider the following intermediate program in three address code p = a – b q = p * c p = u * v q = p + q Which of the following corresponds to a static single assignment form of the above code? |
i ➥ p1 = a – b q1 = p * c p2 = u * v q2 = p + q |
ii ➥ p1 = a – b q1 = p1 * c p1 = u * v q1 = p1 + q1 |
iii ➥ p3 = a – b q4 = p3 * c p4 = u * v q5 = p4 + q4 |
iv ➥ p1 = a – b q1 = p2 * c p3 = u * v q2 = p4 + q3 |
Show Answer With Best Explanation
Answer: III
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Static Single Assignment Form | Help-Line |
Q18➡ | GATE 2017 Set-1 Consider the following grammar: What is FOLLOW(Q)? |
i ➥ {w, y} |
ii ➥ {w, $} |
iii ➥ {R} |
iv ➥ {w} |
Show Answer With Best Explanation
Answer: I
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parsers | Help-Line |
Q19➡ | GATE 2017 Set-1 Consider the following grammar: stmt → if expr then expr else expr; stmt | ȯ expr → term relop term | term term → id | number id → a | b | c number → [0-9] where relop is a relational operator (e.g., <, >, …), ȯ refers to the empty statement, and if, then, else are terminals. Consider a program P following the above grammar containing ten if terminals. The number of control flow paths in P is ________. For example, the program if e1 then e2 else e3 has 2 control flow paths, e1 → e2 and e1 → e3. |
Show Answer With Best Explanation
Answer: 1024
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parsers | Help-Line |
Q20➡ | GATE 2017 Set-1 Consider the expression (a-1)*( ( (b+c) /3) +d). Let X be the minimum number of registers required by an optimal code generation (without any register spill) algorithm for a load/store architecture, in which (i) only load and store instructions can have memory operands and (ii) arithmetic instructions can have only register or immediate operands. The value of X is ________. |
Show Answer With Best Explanation
Answer: 2
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Register Allocation | Help-Line |
Q21➡ | GATE 2017 Set-2 Which of the following statements about parser is/are CORRECT? I. Canonical LR is more powerful than SLR. II. SLR is more powerful than LALR. III. SLR is more powerful than Canonical LR. |
i ➥ II only |
ii ➥ I only |
iii ➥ II and III only |
iv ➥ III only |
Show Answer With Best Explanation
Answer: II
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parsers | Help-Line |
Q22➡ | GATE 2017 Set-2 Match the following according to input (from the left column) to the compiler phase (in the right column) that processes it: |
i ➥ P→(ii), Q→(i), R→(iii), S→(iv) |
ii ➥ P→(iii), Q→(iv), R→(i), S→(ii) |
iii ➥ P→(i), Q→(iv), R→(ii), S→(iii) |
iv ➥ P→(ii), Q→(iii), R→(iv), S→(i) |
Show Answer With Best Explanation
Answer: II
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Compiler phase | Help-Line |
Q23➡ | GATE 2017 Set-2 Consider the following expression grammar G: E → E – T | T T → T + F | F F → (E) | id Which of the following grammars is not left recursive, but is equivalent to G? |
i ➥ |
ii ➥ |
iii ➥ |
iv ➥ |
Show Answer With Best Explanation
Answer: III
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Left Recursive Grammer | Help-Line |
Q24➡ | GATE 2016 Set-1 Let p,q,r,s represent the following propositions. • p: x ∈ {8,9,10,11,12} • q: x is a composite number • r: x is a perfect square • s: x is a prime number The integer x≥2 which satisfies ¬((p ⇒ q) ∧ (¬r ∨ ¬s)) is ________. |
Show Answer With Best Explanation
Answer: 11
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Compiler phase | Help-Line |
Q25➡ | GATE 2016 Set-1 Consider the following code segment. • x = u – t; • y = x * v; • x = y + w; • y = t – z; • y = x * y; The minimum number of variables required to convert the above code segment to static single assignment form is _________. |
Show Answer With Best Explanation
Answer: 10
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Static Single Assignment | Help-Line |
Q26➡ | GATE 2016 Set-1 The attributes of three arithmetic operators in some programming language are given below. The value of the expression 2 – 5 + 1 – 7 * 3 in this language is ________. |
Show Answer With Best Explanation
Answer: 9
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Associativity and precedence | Help-Line |
Q27➡ | GATE 2016 Set-1 Consider the following Syntax Directed Translation Scheme (SDTS), with non-terminals {S, A} and terminals {a,b}. S → aA { print 1 } S → a { print 2 } A → Sb { print 3 } Using the above SDTS, the output printed by a bottom-up parser, for the input aab is: |
i ➥ 1 3 2 |
ii ➥ 2 2 3 |
iii ➥ 2 3 1 |
iv ➥ syntax error |
Show Answer With Best Explanation
Answer: III
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Syntax Directed Translation | Help-Line |
Q28➡ | GATE 2016 Set-2 |
i ➥ P ↔ i, Q ↔ ii, R ↔ iv, S ↔ iii |
ii ➥ P ↔ iii, Q ↔ i, R ↔ ii, S ↔ iv |
iii ➥ P ↔ ii, Q ↔ iii, R ↔ i, S ↔ iv |
iv ➥ P ↔ iv, Q ↔ i, R ↔ ii, S ↔ iii |
Show Answer With Best Explanation
Answer: IV
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Compiler Phases | Help-Line |
Q29➡ | GATE 2016 Set-2 Which one of the following grammars is free from left recursion? |
i ➥ S → AB A → Aa | b B → c |
ii ➥ S → Aa | Bb | c A → Bd | ε B → e |
iii ➥ S → Aa | B A → Bb | Sc | ε B → d |
iv ➥ S → Aa | Bb | c A → Bd | ε B → Ae | ε |
Show Answer With Best Explanation
Answer: II
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Left Recursive Grammer | Help-Line |
Q30➡ | GATE 2016 Set-2 A student wrote two context-free grammars G1 and G2 for generating a single C-like array declaration. The dimension of the array is at least one. For example, int a[10][3]; The grammars use D as the start symbol, and use six terminal symbols int; id[] num. Which of the grammars correctly generate the declaration mentioned above? |
i ➥ Both G1 and G2 |
ii ➥ Only G1 |
iii ➥ Only G2 |
iv ➥ Neither G1 nor G2 |
Show Answer With Best Explanation
Answer: III
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Membership Function | Help-Line |
Q31➡ | GATE 2015 Set-1 Which one of the following is True at any valid state in shift-reduce parsing? |
i ➥ Viable prefixes appear only at the bottom of the stack and not inside |
ii ➥ Viable prefixes appear only at the top of the stack and not inside |
iii ➥ The stack contains only a set of viable prefixes |
iv ➥ The stack never contains viable prefixes |
Show Answer With Best Explanation
Answer: III
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parsers | Help-Line |
Q32➡ | GATE 2015 Set-1 A variable x is said to be live at a statement Si in a program if the following three conditions hold simultaneously: i. There exists a statement Sj that uses x ii. There is a path from Si to Sj in the flow graph corresponding to the program iii. The path has no intervening assignment to x including at Si and Sj The variables which are live both at the statement in basic block 2 and at the statement in basic block 3 of the above control flow graph are |
i ➥ p, s, u |
ii ➥ r, s, u |
iii ➥ r, u |
iv ➥ q, v |
Show Answer With Best Explanation
Answer: III
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Control Flow Graph | Help-Line |
Q33➡ | GATE 2015 Set-1 The least number of temporary variables required to create a three-address code in static single assignment form for the expression q + r/3 + s – t * 5 + u * v/w is ________. |
Show Answer With Best Explanation
Answer: 8
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Static Single Assignment | Help-Line |
Q34➡ | GATE 2015 Set-2 Consider the intermediate code given below. (1) i = 1 (2) j = 1 (3) t1 = 5 * i (4) t2 = t1 + j (5) t3 = 4 * t2 (6) t4 = t3 (7) a[t4] = –1 (8) j = j + 1 (9) if j <= 5 goto(3) (10) i = i + 1 (11) if i < 5 goto(2) The number of nodes and edges in the control-flow-graph constructed for the above code, respectively, are |
i ➥ 5 and 7 |
ii ➥ 6 and 7 |
iii ➥ 5 and 5 |
iv ➥ 7 and 8 |
Show Answer With Best Explanation
Answer: II
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Control Flow Graph | Help-Line |
Q35➡ | GATE 2015 Set-3 Among simple LR (SLR), canonical LR, and look-ahead LR (LALR), which of the following pairs identify the method that is very easy to implement and the method that is the most powerful, in that order? |
i ➥ SLR, LALR |
ii ➥ Canonical LR, LALR |
iii ➥ SLR, canonical LR |
iv ➥ LALR, canonical LR |
Show Answer With Best Explanation
Answer: III
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parsers | Help-Line |
Q36➡ | GATE 2015 Set-3 Consider the following grammar G. S → F ⎪ H F → p ⎪ c H → d ⎪ c Where S, F and H are non-terminal symbols, p, d and c are terminal symbols. Which of the following statement(s) is/are correct? S1: LL(1) can parse all strings that are generated using grammar G. S2: LR(1) can parse all strings that are generated using grammar |
i ➥ Only S1 |
ii ➥ Only S2 |
iii ➥ Both S1 and S2 |
iv ➥ Neither S1 nor S2 |
Show Answer With Best Explanation
Answer: IV
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parsers | Help-Line |
Q37➡ | GATE 2014 Set-1 Which one of the following is FALSE? |
i ➥ A basic block is a sequence of instructions where control enters the sequence at the beginning and exits at the end. |
ii ➥ Available expression analysis can be used for common sub-expression elimination. |
iii ➥ Live variable analysis can be used for dead code elimination. |
iv ➥ x=4*5⇒x=20 is an example of common sub-expression elimination. |
Show Answer With Best Explanation
Answer: IV
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Optimization | Help-Line |
Q38➡ | GATE 2014 Set-1 A canonical set of items is given below S ⟶ L . > R Q ⟶ R . On input symbol < the set has |
i ➥ a shift-reduce conflict and a reduce-reduce conflict. |
ii ➥ a shift-reduce conflict but not a reduce-reduce conflict. |
iii ➥ a reduce-reduce conflict but not a shift-reduce conflict. |
iv ➥ neither a shift-reduce nor a reduce-reduce conflict. |
Show Answer With Best Explanation
Answer: IV
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parsers | Help-Line |
Q39➡ | GATE 2014 Set-2 Consider the grammar defined by the following production rules, with two operators ∗ and + S ⟶ T ∗ P T ⟶ U | T ∗ U P ⟶ Q + P | Q Q ⟶ Id U ⟶ Id Which one of the following is TRUE? |
i ➥ + is left associative, while ∗ is right associative |
ii ➥ + is right associative, while ∗ is left associative |
iii ➥ Both + and ∗ are right associative |
iv ➥ Both + and ∗ are left associative |
Show Answer With Best Explanation
Answer: II
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Precedence And Associativity | Help-Line |
Q40➡ | GATE 2014 Set-2 Which one of the following is NOT performed during compilation? |
i ➥ Dynamic memory allocation |
ii ➥ Type checking |
iii ➥ Symbol table management |
iv ➥ Inline expansion |
Show Answer With Best Explanation
Answer: I
Explanation: Upload Soon
More Discussion | Explanation On YouTube | compile time | Help-Line |
Q41➡ | GATE 2014 Set-2 Consider the expression tree shown. Each leaf represents a numerical value, which can either be 0 or 1. Over all possible choices of the values at the leaves, the maximum possible value of the expression represented by the tree is____. |
Show Answer With Best Explanation
Answer: 6
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Expression | Help-Line |
Q42➡ | GATE 2014 Set-3 One of the purposes of using intermediate code in compilers is to |
i ➥ make parsing and semantic analysis simpler. |
ii ➥ improve error recovery and error reporting. |
iii ➥ increase the chances of reusing the machine-independent code optimizer in other compilers. |
iv ➥ improve the register allocation. |
Show Answer With Best Explanation
Answer: III
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Code Optimization | Help-Line |
Q43➡ | GATE 2014 Set-3 Which of the following statements are CORRECT? 1) Static allocation of all data areas by a compiler makes it impossible to implement recursion. 2) Automatic garbage collection is essential to implement recursion. 3) Dynamic allocation of activation records is essential to implement recursion. 4) Both heap and stack are essential to implement recursion. |
i ➥ 1 and 2 only |
ii ➥ 2 and 3 only |
iii ➥ 3 and 4 only |
iv ➥ 1 and 3 only |
Show Answer With Best Explanation
Answer: IV
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Storage Allocation | Help-Line |
Q44➡ | GATE 2014 Set-3 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 |
i ➥ 6 and 6 |
ii ➥ 8 and 10 |
iii ➥ 9 and 12 |
iv ➥ 4 and 4 |
Show Answer With Best Explanation
Answer: I
Explanation: Upload Soon
More Discussion | Explanation On YouTube | DAG | Help-Line |
Q45➡ | GATE 2013 What is the maximum number of reduce moves that can be taken by a bottom-up parser for a grammar with no epsilon- and unit-production (i.e., of type A → є and A → a) to parse a string with n tokens? |
i ➥ n/2 |
ii ➥ n-1 |
iii ➥ 2n-1 |
iv ➥ 2n |
Show Answer With Best Explanation
Answer: II
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parsers | Help-Line |
Q46➡ | GATE 2013 Consider the following two sets of LR(1) items of an LR(1) grammar. X -> c.X, c/d X -> .cX, c/d X -> .d, c/d X -> c.X, $ X -> .cX, $ X -> .d, $ Which of the following statements related to merging of the two sets in the corresponding LALR parser is/are FALSE? 1. Cannot be merged since look aheads are different. 2. Can be merged but will result in S-R conflict. 3. Can be merged but will result in R-R conflict. 4. Cannot be merged since goto on c will lead to two different sets. |
i ➥ 1 only |
ii ➥ 2 only |
iii ➥ 1 and 4 only |
iv ➥ 1, 2, 3 and 4 |
Show Answer With Best Explanation
Answer: IV
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parsers | Help-Line |
Q47➡ | GATE 2012 Consider the program given below, in a block-structured pseudo-language with lexical scoping and nesting of procedures permitted. Consider the calling chain : Main->A1->A2->A21->A1 The correct set of activation records along with their access links is given by: |
i ➥ |
ii ➥ |
iii ➥ |
iv ➥ |
Show Answer With Best Explanation
Answer: IV
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Run Time Environment | Help-Line |
Q48➡ | GATE 2012 Statement for Linked Answer Questions 48 and 49: For the grammar below, a partial LL(1) parsing table is also presented along with the grammar. Entries that need to be filled are indicated as E1, E2, and E3. ε is the empty string, $ indicates end of input, and, | separates alternate right hand sides of productions. S → aAbB | bAaB | ε A → S B → S The FIRST and FOLLOW sets for the non-terminals A and B are |
i ➥ FIRST(A) = {a,b,ε} = FIRST(B) FOLLOW(A) = {a,b} FOLLOW(B) = {a,b,$} |
ii ➥ FIRST(A) = {a,b,$} FIRST(B) = {a,b,ε} FOLLOW(A) = {a,b} FOLLOW(B) = {$} |
iii ➥ FIRST(A) = {a,b,ε} = FIRST(B) FOLLOW(A) = {a,b} FOLLOW(B) = ∅ |
iv ➥ FIRST(A) = {a,b} = FIRST(B) FOLLOW(A) = {a,b} FOLLOW(B) = {a,b} |
Show Answer With Best Explanation
Answer: I
Explanation: Upload Soon
More Discussion | Explanation On YouTube | Parsers | Help-Line |
Q49➡ | |