Online Test 1 - Compiler | Computer Science(CS)
GATE Exam online test 1 Compiler Design | Computer Science(CS)
Questions
Remove the left recursion from the following grammar.
$E \rightarrow Ea|Eb|a|b$
- $E \rightarrow aE'|bE';E'\rightarrow aE'|bE'|\epsilon$
- $E \rightarrow aE'|bE'|\epsilon;E'\rightarrow aE'|bE'$
- $E \rightarrow aE'|bE'|\epsilon;E'\rightarrow aE'|bE'|\epsilon$
- <font size="2">N</font>one of these
A bottom up parser generates
- right most derivation
- right most derivation in reverse
- left most derivation
- left most derivation in reverse
When a computer is first turned ON and restarted, a special type of absolute loader is executed called
- compile and go loader
- boot loader
- boot strap loader
- relating loader
Which of the following statement(s) is/are true?
S1 : Right recursion is needed for termination in predictive parsers.
S2 : Left recursion require more stack space than right.
S3 : Left recursion works fine in bottom up parsers.
- $S_1 and\ S_2$
- $S_1 and\ S_3$
- $S_2 and\ S_3$
- $S_1,S_2\ and\ S_3$
Consider the following grammar:
S$\rightarrow$SS
S$\rightarrow$0
S$\rightarrow$$\epsilon$
Which of the following is true related to the given grammar?
(i) It is ambiguous. (ii) It is left recursive.
(iii) It is LL(1). (iv) It accepts 0+.
- iii only
- iii & iv
- I & ii
- i, ii & iv
The language recognized by the following finite automation is

- aabb* + bab*
- (aab) (empty + (bab))
- (aa + empty) (b + ba) (bab)*
- (aab + ba) (bab)*
A simple two-pass assembler does which of the following the first pass?
- <font size="2">I</font>t allocates space for the literals.
- <font size="2">I</font>t compute<font size="2">s</font> the total length of the program.
- <font size="2">I</font>t builds the symbol table for the symbols and their value.
- <font size="2">A</font>ll of these
The front end of toy compiler performs to
(i) determine validate of a source statement from the viewpoint of the analysis
(ii) determine the content of a source statement
(iii) construct a suitable representation of the source statement for use by subsequent analysis function or by the synthesis phase of the language processor
- (i), (iii)
- (ii), (iii)
- (i), (ii)
- (i), (ii), (iii)
Dynamic linking can cause security concern because
- security is dynamic
- path for searching dynamic libraries is not known till runtime
- linking is insecure
- cryptographic procedures are not available for dynamic linking
The top down parsing method is also called
- recursive descent parsing
- shift reduce parsing
- operator precedence parsing
- none of the above
Which of the below is operator precedence?
- $\epsilon + \epsilon + \dfrac{T}{T}$
- $\epsilon \rightarrow \epsilon + \epsilon $
- $\epsilon \rightarrow T $ $T\rightarrow T + \dfrac{T}{\epsilon}$
- $\epsilon \rightarrow \epsilon + \dfrac{T}{T}$ $\epsilon \rightarrow \dfrac{e}{id}$ $\epsilon \rightarrow \epsilon + \dfrac{T}{T}$
A top down parser generator is
- right most derivation
- left most derivation
- right most derivation in reverse
- left most derivation in reverse
The output of lexical analyzer is
- machine code
- intermediate code
- a stream of tokens
- a parse tree
Handle pruning is the technique used to obtain
- canonical derivation sequence
- canonical reduction sequence
- both (1) and (2) above
- none of the above
The language L = {ak bk |k$\ge$1} is
- type 3 grammar
- type 1 grammar
- type 2 grammar
- type 0 grammar
Which of the following is the most powerful parsing method?
- LL
- <font size="2">C</font>anonical LR
- SLR
- LALR
The expression (ab)C op….. (where ‘OP’ is one of ‘t’, ‘’ and ‘$\uparrow$’ is exponentiation) can be evaluated on a CPU with a single register without storing the value of (ab) if
- ‘OP’ is ‘t’ or ‘*’
- ‘OP’ is ‘$\uparrow$’ or ‘t’
- ‘OP’ is ‘$\uparrow$’ or ‘*’
- not possible to evaluate without storing
Type 0 grammar is
- a phase structure grammar
- no restriction in this grammar
- both (1) and (2) above
- none of the above