search
Log In

Recent questions and answers in Compiler Design

29 votes
6 answers
1
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 6.5k views
42 votes
3 answers
2
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 11.9k views
44 votes
7 answers
3
The minimum number of arithmetic operations required to evaluate the polynomial $P(X) = X^5+4X^3+6X+5$ for a given value of $X$, using only one temporary variable is ______.
answered Jan 8 in Compiler Design rsonx 8.9k views
15 votes
3 answers
4
The following code segment is executed on a processor which allows only register operands in its instructions. Each instruction can have atmost two source operands and one destination operand. Assume that all variables are dead after this code segment. c = a + b; d ... this code segment without any spill to memory? Do not apply any optimization other than optimizing register allocation. 3 4 5 6
answered Jan 5 in Compiler Design reboot 3.4k views
0 votes
2 answers
5
The following program uses six different variables p, q, r, s, t and u. The code is: p=6 q=7 t=p*q s=t+p u=8 u=s*p s=p+u r=r*q t=t+p return t Assume that all operations take their operands from registers, the minimum number of registers needed to ... _____________? Given answer is 5, but my answer is 4. I think that the step u=8 can be skipped since 'u' is being reinitialized in the next step.
answered Jan 5 in Compiler Design reboot 327 views
0 votes
2 answers
6
Definition of Static Single Assignment Static single-assignment form arranges for every value computed by a program to have a unique assignment (aka, “definition”) but p3 = a - b q4 = p3 * c p4 = u * v q5 = p4 + q4 is an valid example of SSA Now, tell me a,b,c,u,v are not assigned or previously recognized Then how this is a valid example of SSA? for ref see here
answered Dec 31, 2020 in Compiler Design ronak.ladhar 175 views
1 vote
3 answers
7
68 votes
9 answers
8
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 Dec 30, 2020 in Compiler Design hmrishavbandy 12.4k views
2 votes
1 answer
9
Make this grammer into unambiguous
answered Dec 29, 2020 in Compiler Design zxy123 494 views
1 vote
1 answer
10
A canonical set of items is given below S→L.>R Q→R. On input symbol > the set has (a).a shift-reduce conflict and a reduce-reduce conflict. (b).a shift-reduce conflict but not a reduce-reduce conflict. (c).a reduce-reduce conflict but not a shift-reduce conflict. (d).neither a shift-reduce nor a reduce-reduce conflict.
answered Dec 22, 2020 in Compiler Design Ashley Varghese Joy 401 views
0 votes
1 answer
11
An integer array $A[i, j]$ has index $i$ ranging from $1$ to $10$ and index $j$ ranging from $1$ to $20$. Integers take $4$ bytes each. Suppose array $A$ is stored starting at byte $0$. Find the location of: $A[4,5]$ $A[10,8]$ $A[3,17]$
answered Dec 16, 2020 in Compiler Design eshita1997 182 views
0 votes
2 answers
12
The number of lexemes in the statement in FORTRAN DO 10 I = 100 is __________ .
answered Dec 13, 2020 in Compiler Design shaurabhpatel47 1.1k views
1 vote
1 answer
13
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 122 views
2 votes
1 answer
14
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 79 views
0 votes
1 answer
15
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 60 views
0 votes
1 answer
16
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 296 views
0 votes
1 answer
17
0 votes
1 answer
18
0 votes
1 answer
19
0 votes
1 answer
20
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 178 views
0 votes
1 answer
21
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 253 views
1 vote
2 answers
23
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 466 views
0 votes
2 answers
24
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 247 views
1 vote
3 answers
25
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 373 views
0 votes
1 answer
26
0 votes
1 answer
27
0 votes
4 answers
28
0 votes
1 answer
29
0 votes
5 answers
30
0 votes
2 answers
31
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\to\epsilon$ and $A \to a)$ to parse a string with $n$ tokens? $n/2$ $n-1$ $2n-1$ $2^n$
asked Mar 30, 2020 in Compiler Design Lakshman Patel RJIT 260 views
0 votes
5 answers
32
0 votes
1 answer
33
A system program that combines the separately complied modules of a program into a form suitable for execution assembler linking loader cross compiler load and go
asked Mar 30, 2020 in Compiler Design Lakshman Patel RJIT 260 views
1 vote
4 answers
34
1 vote
1 answer
36
Which of the following statements is/are false? $S1$: $LR(0)$ grammar and $SLR(1)$ grammar are equivalent $S2$: $LR(1)$ grammar are subset of $LALR(1)$ grammars $S1$ only $S1$ and $S2$ both $S2$ only None of the options
asked Mar 30, 2020 in Compiler Design Lakshman Patel RJIT 580 views
0 votes
1 answer
37
The optimization phase in a compiler generally Reduces the space of the code Optimizes the code to reduce execution time Both (A) and (B) Neither (A) nor (B)
asked Mar 30, 2020 in Compiler Design Lakshman Patel RJIT 616 views
0 votes
1 answer
38
Which of the following statements is/are true in the context of interpreters? $S1$: Interpreters process program according to the logical flow of control through the program. $S2$: Interpreter translates and executes the error-free first instruction before it goes to the second. $S3$: Interpreter ... interpreted languages. Only $S1$ Only $S3$ Only $S1$, $S2$ and $S3$ Only $S1$, $S2$ and $S4$
asked Mar 30, 2020 in Compiler Design Lakshman Patel RJIT 445 views
0 votes
1 answer
39
In a two pass compiler, during the first pass : user defined address symbols are correlated with their binary equivalent the syntax of the statement is checked and mistakes, if any, are listed object program is generated semantic of the source program is elucidated
asked Mar 28, 2020 in Compiler Design jothee 114 views
0 votes
0 answers
40
A single instruction in an assembly language program contains : one micro operation one macro operation one instruction to be completed in a single pulse one machine code instruction
asked Mar 28, 2020 in Compiler Design jothee 143 views
To see more, click for all the questions in this category.
...