search
Log In

Recent questions and answers in Compiler Design

2 votes
4 answers
1
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 837 views
10 votes
5 answers
2
3 votes
5 answers
4
1 vote
5 answers
5
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 579 views
9 votes
6 answers
6
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.6k views
2 votes
6 answers
7
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.4k views
6 votes
7 answers
8
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 2.9k views
37 votes
4 answers
9
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.3k views
2 votes
2 answers
10
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 870 views
6 votes
5 answers
11
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.5k views
6 votes
6 answers
12
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 2.6k views
0 votes
2 answers
13
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 902 views
0 votes
3 answers
14
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 931 views
3 votes
2 answers
15
Consider the following context-free grammar where the set of terminals is $\{a,b,c,d,f\}$ ... $1\;\text{blank} \qquad 2\;S \rightarrow Rf \qquad 3\; \text{blank} \qquad 4\;\text{blank} $
answered Feb 27 in Compiler Design Harshq 341 views
1 vote
2 answers
16
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 402 views
1 vote
2 answers
17
Consider the following $C$ code segment: $\begin{array}{lllll} a & = & b & + & c; \\ e & = & a& + & 1; \\ d & = & b & + & c; \\ f & = & d& + & 1; \\ g& = & e&+&f; \end{array}$ 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 340 views
2 votes
2 answers
18
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 744 views
0 votes
1 answer
19
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 385 views
1 vote
4 answers
20
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.7k views
7 votes
3 answers
21
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.3k views
4 votes
1 answer
22
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.3k views
9 votes
4 answers
23
Which one of the following kinds of derivation is used by LR parsers? Leftmost Leftmost in reverse Rightmost Rightmost in reverse
answered Jan 30 in Compiler Design swettt871 5.4k views
45 votes
8 answers
24
30 votes
6 answers
25
Some code optimizations are carried out on the intermediate code because They enhance the portability of the compiler to the target processor Program analysis is more accurate on intermediate code than on machine code The information from dataflow analysis cannot otherwise be used for optimization The information from the front end cannot otherwise be used for optimization
answered Jan 16 in Compiler Design Surya_Dev Chaturvedi 7.1k views
45 votes
3 answers
26
A variable $x$ is said to be live at a statement $s_{i}$ in a program if the following three conditions hold simultaneously: There exists a statement $S_{j}$ that uses $x$ There is a path from $S_{i}$ to $S_{j}$ in the flow graph corresponding to the program The path has no intervening assignment ... of the above control flow graph are $\text{p, s, u}$ $\text{r, s, u}$ $\text{r, u}$ $\text{q, v}$
answered Jan 14 in Compiler Design Vikramaditya19 13k views
2 votes
1 answer
27
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 798 views
2 votes
1 answer
28
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 140 views
0 votes
1 answer
29
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 131 views
0 votes
1 answer
30
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 330 views
0 votes
1 answer
31
0 votes
1 answer
32
0 votes
1 answer
33
0 votes
1 answer
34
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 199 views
0 votes
1 answer
35
Consider an $\varepsilon$-tree CFG. If for every pair of productions $A\rightarrow u$ and $A\rightarrow v$ If $\text{FIRST(u)} \cap \text{FIRST(v)}$ is empty then the CFG has to be $LL(1).$ If the CFG is $LL(1)$ then $\text{FIRST(u)} \cap \text{FIRST(v)}$ has to be empty. Both $(A)$ and $(B)$ None of the above
asked Apr 1, 2020 in Compiler Design Lakshman Patel RJIT 317 views
1 vote
2 answers
37
In a single pass assembler, most of the forward references can be avoided by putting the restriction on the number of strings/lifereacts. that the data segment must be defined after the code segment. on unconditional rump. that the data segment be defined before the code segment.
asked Mar 31, 2020 in Compiler Design Lakshman Patel RJIT 626 views
0 votes
2 answers
38
A linker is given object module for a set of programs that were compiled separately. What information need not be included in an object module? Object mode Relocation bits Names and locations of all external symbols defined in the object module. Absolute addresses of internal symbols.
asked Mar 31, 2020 in Compiler Design Lakshman Patel RJIT 281 views
2 votes
3 answers
39
The identification of common sub-expression and replacement of run time computations by compile-time computations is: Local optimization Constant folding Loop Optimization Data flow analysis
asked Mar 31, 2020 in Compiler Design Lakshman Patel RJIT 417 views
0 votes
1 answer
40
To see more, click for all the questions in this category.
...