Online Test 1 - Compiler | Computer Science(CS)

GATE Exam online test 1 Compiler Design | Computer Science(CS)

18 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Remove the left recursion from the following grammar.
$E \rightarrow Ea|Eb|a|b$

  1. $E \rightarrow aE'|bE';E'\rightarrow aE'|bE'|\epsilon$
  2. $E \rightarrow aE'|bE'|\epsilon;E'\rightarrow aE'|bE'$
  3. $E \rightarrow aE'|bE'|\epsilon;E'\rightarrow aE'|bE'|\epsilon$
  4. <font size="2">N</font>one of these
Question 2 Multiple Choice (Single Answer)

A bottom up parser generates

  1. right most derivation
  2. right most derivation in reverse
  3. left most derivation
  4. left most derivation in reverse
Question 3 Multiple Choice (Single Answer)

When a computer is first turned ON and restarted, a special type of absolute loader is executed called

  1. compile and go loader
  2. boot loader
  3. boot strap loader
  4. relating loader
Question 4 Multiple Choice (Single Answer)

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.

  1. $S_1 and\ S_2$
  2. $S_1 and\ S_3$
  3. $S_2 and\ S_3$
  4. $S_1,S_2\ and\ S_3$
Question 5 Multiple Choice (Single Answer)

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+.

  1. iii only
  2. iii & iv
  3. I & ii
  4. i, ii & iv
Question 6 Multiple Choice (Single Answer)

The language recognized by the following finite automation is

  1. aabb* + bab*
  2. (aab) (empty + (bab))
  3. (aa + empty) (b + ba) (bab)*
  4. (aab + ba) (bab)*
Question 7 Multiple Choice (Single Answer)

A simple two-pass assembler does which of the following the first pass?

  1. <font size="2">I</font>t allocates space for the literals.
  2. <font size="2">I</font>t compute<font size="2">s</font> the total length of the program.
  3. <font size="2">I</font>t builds the symbol table for the symbols and their value.
  4. <font size="2">A</font>ll of these
Question 8 Multiple Choice (Single Answer)

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

  1. (i), (iii)
  2. (ii), (iii)
  3. (i), (ii)
  4. (i), (ii), (iii)
Question 9 Multiple Choice (Single Answer)

Dynamic linking can cause security concern because

  1. security is dynamic
  2. path for searching dynamic libraries is not known till runtime
  3. linking is insecure
  4. cryptographic procedures are not available for dynamic linking
Question 10 Multiple Choice (Single Answer)

The top down parsing method is also called

  1. recursive descent parsing
  2. shift reduce parsing
  3. operator precedence parsing
  4. none of the above
Question 11 Multiple Choice (Single Answer)

Which of the below is operator precedence?

  1. $\epsilon + \epsilon + \dfrac{T}{T}$
  2. $\epsilon \rightarrow \epsilon + \epsilon $
  3. $\epsilon \rightarrow T $ $T\rightarrow T + \dfrac{T}{\epsilon}$
  4. $\epsilon \rightarrow \epsilon + \dfrac{T}{T}$ $\epsilon \rightarrow \dfrac{e}{id}$ $\epsilon \rightarrow \epsilon + \dfrac{T}{T}$
Question 12 Multiple Choice (Single Answer)

A top down parser generator is

  1. right most derivation
  2. left most derivation
  3. right most derivation in reverse
  4. left most derivation in reverse
Question 13 Multiple Choice (Single Answer)

The output of lexical analyzer is

  1. machine code
  2. intermediate code
  3. a stream of tokens
  4. a parse tree
Question 14 Multiple Choice (Single Answer)

Handle pruning is the technique used to obtain

  1. canonical derivation sequence
  2. canonical reduction sequence
  3. both (1) and (2) above
  4. none of the above
Question 15 Multiple Choice (Single Answer)

The language L = {ak bk |k$\ge$1} is

  1. type 3 grammar
  2. type 1 grammar
  3. type 2 grammar
  4. type 0 grammar
Question 16 Multiple Choice (Single Answer)

Which of the following is the most powerful parsing method?

  1. LL
  2. <font size="2">C</font>anonical LR
  3. SLR
  4. LALR
Question 17 Multiple Choice (Single Answer)

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

  1. ‘OP’ is ‘t’ or ‘*’
  2. ‘OP’ is ‘$\uparrow$’ or ‘t’
  3. ‘OP’ is ‘$\uparrow$’ or ‘*’
  4. not possible to evaluate without storing
Question 18 Multiple Choice (Single Answer)

Type 0 grammar is

  1. a phase structure grammar
  2. no restriction in this grammar
  3. both (1) and (2) above
  4. none of the above