# Recent questions tagged compiler-design

1
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
2
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
1 vote
3
Synthesized attribute can easily be simulated by an LL grammar ambiguous grammar LR grammar none of the above
4
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.
5
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.
6
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
7
The structure or format of data is called Syntax Struct Semantic none of the above
8
The graph that shows basic blocks and their successor relationship is called: DAG Control graph Flow graph Hamiltonian graph
9
A top down parser generates Left most derivation Right most derivation Left most derivation in reverse Right most derivation in reverse
10
Syntax directed translation scheme is desirable because It is based on the syntax It is easy to modify Its description is independent of any implementation All of these
11
The output of lexical analyzer is: A set of regular expressions Strings of character Syntax tree Set of tokens
12
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$
13
In a compiler, keywords of a language are recognized during parsing of the program the code generation the lexical analysis of the program dataflow analysis
14
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
15
Which of the following is machine independent optimization? Loop optimization Redundancy Elimination Folding All of the option
16
The grammar $S\rightarrow aSb\mid bSa\mid SS\mid \varepsilon$ is: Unambiguous CFG Ambiguous CFG Not a CFG Deterministic CFG
1 vote
17
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
18
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)
19
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$
20
The ‘K’ in LR (K) cannot be : $0$ $1$ $2$ None of these
21
Consider the following statements related to compiler construction: Lexical Analysis is specified by context-free grammars and implemented by pushdown automata. Syntax Analysis is specified by regular expressions and implemented by finite-state machine. Which of the above statement(s) is/are correct? Only I Only II Both I and II Neither I nor II
22
Which of the following statement(s) regarding a linker software is/are true ? A function of a linker is to combine several object modules into a single load module. A function of a linker is to replace absolute references in an object module by symbolic references to locations in other modules. Only I Only II Both I and II Neither I nor II
23
Consider the following statements. Symbol table is accessed only during lexical analysis and syntax analysis. Compilers for programming languages that support recursion necessarily need heap storage for memory allocation in the run-time environment. Errors violating the condition any variable must be ... of the above statements is/are TRUE? I only I and III only Ⅱ only None of Ⅰ, Ⅱ and Ⅲ
24
Consider the following grammar. $S \rightarrow aSB \mid d$ $B \rightarrow b$ The number of reduction steps taken by a bottom-up parser while accepting the string $aaadbbb$ is___________.
25
Consider the productions $A \rightarrow PQ$ and $A \rightarrow 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$ ... $1$ is $L$-attributed. Only Rule $2$ is $L$-attributed. Neither Rule $1$ nor Rule $2$ is $L$-attributed.
26
Which one indicates a technique of building cross compilers? Beta cross Canadian cross Mexican cross X-cross
1 vote
27
A given grammar is called ambiguous if two or more productions have the same non-terminal on the left hand side a derivation tree has more than one associated sentence there is a sentence with more than one derivation tree corresponding to it brackets are not present in the grammar
The number of tokens in the following C code segment is switch(inputvalue) { case 1 : b =c*d; break; default : b =b++; break; } $27$ $29$ $26$ $24$