search
Log In

Recent questions and answers in Compiler Design

1 vote
3 answers
1
For a statement $S$ in a program, in the context of liveness analysis, the following sets are defined: $\text{USE}(S)$ : the set of variables used in $S$ $\text{IN}(S)$ : the set of variables that are live at the entry of $S$ $\text{OUT}(S)$ : the set of variables that are live at the ... $) }\cup \text{ OUT ($S_2$)}$ $\text{OUT ($S_1$)} = \text{USE ($S_1$)} \cup \text{IN ($S_2$)}$
answered May 30 in Compiler Design Arjun 504 views
0 votes
1 answer
2
Linking : cannot be performed before relocation cannot be performed after relocation can be performed both before and after relocation is not required if relocation is performed
answered May 30 in Compiler Design surya.pandey 328 views
6 votes
3 answers
3
Whether LR(1) grammar is same as that of CLR(1) grammar. If yes then please explain and if not then what is the difference between them?
answered May 20 in Compiler Design NICKGHULE 7.4k views
0 votes
1 answer
4
State whether the following statements are True or False with reasons for your answer: A two pass assembler uses its machine opcode table in the first pass of assembly.
answered May 4 in Compiler Design Arjun 179 views
15 votes
2 answers
5
State whether the following statements are True or False with reasons for your answer A subroutine cannot always be used to replace a macro in an assembly language program.
answered May 4 in Compiler Design gatecse 1.5k views
0 votes
1 answer
6
State whether the following statements are True or False with reasons for your answer A symbol declared as ‘external’ in an assembly language program is assigned an address outside the program by the assembler itself.
answered May 3 in Compiler Design gatecse 61 views
71 votes
10 answers
7
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 \rightarrow \epsilon$ and $A \rightarrow a$) to parse a string with $n$ tokens? $n/2$ $n-1$ $2n-1$ $2^{n}$
answered Apr 29 in Compiler Design mani312 14.1k views
9 votes
4 answers
8
Let $G_1 = (N, T, P, S_1)$ be a CFG where, $N=\{S_1, A, B\},T=\{a, b\}$ and $P$ ... $5$ production rules. Is $L_2$ inherently ambiguous?
answered Apr 28 in Compiler Design mani312 2.3k views
0 votes
2 answers
9
2 votes
2 answers
10
Consider the following statements. $S_1:$ The sequence of procedure calls corresponds to a preorder traversal of the activation tree. $S_2:$ The sequence of procedure returns corresponds to a postorder traversal of the activation tree. Which one of the following options is correct? $S_1$ is true and ... $S_2$ is true $S_1$ is true and $S_2$ is true $S_1$ is false and $S_2$ is false
answered Apr 8 in Compiler Design Yashvir 609 views
2 votes
4 answers
11
Match the following with respect to activation record fields: A 1 → A, D; 2 → B, C B 1 → A, C; 2 → B, D C 1 → B, C; 2 → A, D D 1 → B, D; 2 → A, C Doubt:- Control link points to caller activation record.Can some one confirm?
answered Apr 7 in Compiler Design rish1602 949 views
10 votes
5 answers
12
3 votes
5 answers
14
1 vote
5 answers
15
Every LL(1) grammar is ______ A.SLR(1) B.LALR(1) C.LR(1) D.Both B & C
answered Apr 7 in Compiler Design rish1602 656 views
10 votes
5 answers
16
What is the value of $X$ printed by the following program? program COMPUTE (input, output); var X:integer; procedure FIND (X:real); begin X:=sqrt(X); end; begin X:=2 FIND(X); writeln(X); end. $2$ $\sqrt{2}$ Run time error None of the above
answered Apr 7 in Compiler Design rish1602 3.9k views
2 votes
6 answers
17
I know the parsing logic of bottom up parsers, that they start from the terminal and reduce it to the start symbol. But what really confuses me is the construction of LR(0)/LR(1) sets : Eg : S->Sa|a Then in LR(0) set : S'->.S S->.Sa S->.a Now the dot is in front of S , so shouldn't the S production be generated again and again and make it go to an inf. loop?
answered Apr 7 in Compiler Design rish1602 3.8k views
6 votes
7 answers
18
Consider the grammar given below S⟶ SS | a | ∈ The number of inadequate states in the DFA of LR(1) items is (a) 1 (b) 2 (c) 3 (d) 4
answered Apr 4 in Compiler Design rish1602 3.1k views
37 votes
4 answers
19
Consider the grammar rule $E \rightarrow E1 - E2$ for arith­metic expressions. The code generated is targeted to a CPU having a single user register. The sub­traction operation requires the first operand to be in the register. If $E1$ and $E2$ do not have any com­mon ... first Evaluation of $E1$ and $E2$ should necessarily be interleaved Order of evaluation of $E1$ and $E2$ is of no consequence
answered Mar 25 in Compiler Design iam_ljk 7.8k views
2 votes
2 answers
20
This screenshot is token from the book Ullman, How can following be a lexical error? because "elipseSize" should have a token recorded as an identifier.
answered Mar 21 in Compiler Design adeemajain 912 views
6 votes
5 answers
21
if there is miss spelling in some keyword in a program then this misspelled keyword will be treated as lexical errors or it will be treated as a new identifier and accepted as a token ?? ex - whiel (1) ; here while is misspelled as whiel
answered Mar 14 in Compiler Design adeemajain 1.6k views
9 votes
6 answers
22
Consider the following $\text{ANSI C}$ program: int main () { Integer x; return 0; } Which one of the following phases in a seven-phase $C$ compiler will throw an error? Lexical analyzer Syntax analyzer Semantic analyzer Machine dependent optimizer
answered Mar 1 in Compiler Design gate_1729 3.2k views
1 vote
2 answers
23
Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation $\text{(SDT)}$ ... The actions can be used to type-check syntactically correct boolean variable declarations and boolean expressions. The actions will lead to an infinite loop
answered Mar 1 in Compiler Design Bhartendu Kumar 1.2k views
0 votes
3 answers
24
In the context of compilers, which of the following is/are $\text{NOT}$ an intermediate representation of the source program? Three address code Abstract Syntax Tree $\text{(AST)}$ Control Flow Graph $\text{(CFG)}$ Symbol table
answered Feb 28 in Compiler Design Akash 1234Upadhyay 1.4k views
3 votes
2 answers
25
Consider the following context-free grammar where the set of terminals is $\{a,b,c,d,f\}$ ... $\boxed{1}\;\text{blank} \qquad \boxed{2}\;\text{S} \rightarrow \text{R}f \qquad \boxed{3}\; \text{blank} \qquad \boxed{4}\;\text{blank} $
answered Feb 27 in Compiler Design Harshq 520 views
1 vote
2 answers
26
Consider the following statements. $S_1:$ Every $\text{SLR(1)}$ grammar is unambiguous but there are certain unambiguous grammars that are not $\text{SLR(1)}$. $S_2:$ For any context-free grammar, there is a parser that takes at most $O(n^3)$ time to parse a string of length $n$. ... $S_2$ is false $S_1$ is false and $S_2$ is true $S_1$ is true and $S_2$ is true $S_1$ is false and $S_2$ is false
answered Feb 27 in Compiler Design Harshq 865 views
1 vote
2 answers
27
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 $\text{(DAG)}$. The number of nodes in the $\text{DAG}$ is _____________
answered Feb 21 in Compiler Design Hira Thakur 593 views
3 votes
2 answers
28
Consider the following $\text{ANSI C}$ code segment: z=x + 3 + y->f1 + y->f2; for (i = 0; i < 200; i = i + 2) { if (z > i) { p = p + x + 3; q = q + y->f1; } else { p = p + y->f2; q = q + x + 3; } } Assume that the variable $y$ points to ... the form $\textsf{ y ->f1}$ or $\textsf{y ->f2}$) in the optimized code, respectively, are: $403$ and $102$ $203$ and $2$ $303$ and $102$ $303$ and $2$
answered Feb 21 in Compiler Design Arjun 1.2k views
0 votes
1 answer
29
Consider the following augmented grammar with $\{ \#, @, <, >, a, b, c \}$ ... $I_0 = \text{CLOSURE}(\{S' \rightarrow \bullet S\})$. The number of items in the set $\text{GOTO(GOTO}(I_0<), <)$ is ___________
answered Feb 18 in Compiler Design shashankpal 599 views
1 vote
4 answers
30
Consider the following SDT, S → M {PRINT “2”;} A M → 1 {PRINT “ ”;} A → D {PRINT “1”;} E D → 2 {PRINT “ ”;} E → E {PRINT “ ”;} A E → 3 {PRINT “ ”;} A → S {PRINT “4”;} Y S → 4 {PRINT “ ”;} Y → ∈ {PRINT “ ”;} If the bottom up parsing is used to parse the input string “1234” then the output number produced (without any spaces) is _______
answered Feb 15 in Compiler Design UrbanCsGuy 1.8k views
7 votes
3 answers
31
The number of tokens in following program? # define M 100 int main ( ) { // declare variables int n = 2020; return n % M; } Your Answer:19 Correct Answer: 16 Status: incorrect
answered Feb 10 in Compiler Design adeemajain 2.5k views
4 votes
1 answer
32
Consider the grammar with the following productions. S→aaB/aaC B→b C→c Which of the following option is true ? (A) The grammar is LL(3) (B) The grammar is LL(1) (C) The grammar is LL(2) (D) It can’t be LL(k) grammar for any k, as it contains left factoring.
answered Feb 1 in Compiler Design swettt871 2.5k views
2 votes
1 answer
33
Which of the following is not an intermediate code form? Syntax trees Three address codes Quadrupules Post fix Notation
asked Nov 20, 2020 in Compiler Design jothee 2.3k views
2 votes
1 answer
34
Which of the following are applications of symbol table? Storage allocation Checking type compatibility Suppressing duplicate error messages Choose the correct answer from the options given below: $(a)$ and $(b)$ only $(a)$ and $(c)$ only $(b)$ and $(c)$ only $(a)$ $(b)$ and $(c)$
asked Nov 20, 2020 in Compiler Design jothee 200 views
0 votes
1 answer
35
Find the lexicographic ordering of the bit strings given below based on the ordering $0<1$. $001$ $010$ $011$ $0001$ $0101$ Choose the correct answer from the options given below: $001 < 010 < 011 < 0001 < 0101$ $0001 < 001 < 010 < 0101 < 011$ $0001 < 0101 < 001 < 010 < 011$ $001 < 010 < 0001 < 0101 < 011$
asked Nov 20, 2020 in Compiler Design jothee 238 views
0 votes
1 answer
36
Which of the following can be accessed by transfer vector approach of linking? External data segments External subroutines Data located in other procedure All of these
asked Apr 2, 2020 in Compiler Design Lakshman Patel RJIT 360 views
0 votes
1 answer
37
0 votes
1 answer
38
0 votes
1 answer
39
0 votes
6 answers
40
Context-free grammar can be recognized by finite state automation $2$- way linear bounded automata push down automata both (B) and (C)
asked Apr 2, 2020 in Compiler Design Lakshman Patel RJIT 439 views
To see more, click for all the questions in this category.
...