• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Code Generation and Optimization

Question 11

A grammar that is both left and right recursive for a non-terminal is
  • Ambiguous
  • Unambiguous
  • Information is not sufficient to decide whether it is ambiguous or Unambiguous.
  • None of the above

Question 12

The least number of temporary variables required to create a three-address code in static single assignment form for the expression a=b * d - c + b * e - c is ______

  • 3

  • 4

  • 5

  • 6

Question 13

In a resident- OS computer, which of the following system software must reside in the main memory under all situations?
  • Assembler
  • Linker
  • Loader
  • Compiler

Question 14

A linker reads four modules whose lengths are 200, 800, 600 and 500 words respectively. If they are loaded in that order, what are the relocation constants?
  • 0, 200, 500, 600
  • 0, 200, 1000, 1600
  • 200, 500, 600, 800
  • 200, 700, 1300, 2100

Question 15

A language L allows declaration of arrays whose sizes are not known during compilation. It is required to make efficient use of memory. Which of the following is true?
  • A compiler using static memory allocation can be written for L
  • A compiler cannot be written for L, an interpreter must be used
  • A compiler using dynamic memory allocation can be written for L
  • None of the above

Question 16

The condition expansion facility of macro processors is provided to
  • test a condition during the execution of the expanded program
  • to expand certain model statements depending upon the value of a condition during the execution of the expanded program
  • to implement recursion
  • to expand certain model statements depending upon the value of a condition during the process of macros expansion

Question 17

The expression (a*b)* c op........ where \'op\' is one of \'+\', \'*\' and \'\' (exponentiation) can be evaluated on a CPU with a single register without storing the value of (a * b) if
  • ‘op’ is ‘+’ or ‘*’
  • \'op’ is ‘↑’ or ‘*’
  • \'op’ is ‘↑’ or ‘+’
  • not possible to evaluate without storing

Question 18

Consider the grammar
S→ bSe
S→ PQR
P→ bPc
P→ ε
Q→ cQd
Q→ ε
R→ dRe
R→ ε
where S,P,Q,R are non-terminal symbols with S being the start symbol; b,c,d,e are terminal symbols and ‘ε’ is the empty string. This grammar generates strings of the form bi, cj, dk, em for some i, j, k, m ≥ 0.
  • (a). What is the condition on the values of i, j, k, m ?
  • (b). Find the smallest string that has two parse trees.

    Question 19

    The pass number for each of the following activities
    1. Object code generation
    2. Literals added to literal table
    3. Listing printed
    4. Address resolution of local symbols
    That occur in a two pass assembler respectively are
    • 1, 2, 1, 2
    • 2, 1, 2, 1
    • 2, 1, 1, 2
    • 1, 2, 2, 2

    Question 20

    Consider the following expression
    u*v+a-b*c
    Which one of the following corresponds to a static single assignment from the above expressions
    • x1 = a - b y1 = p * c x2 = u * v y2 = p + q
    • x 1 = a - b y1 = x2 * c x3 = u * v y2 = x4 + y3
    • x1 = a - b y2 = x1 * c x2 = u * v y3 = x2 + y2
    • p = a - b q = p * c p = u * v q = p + q

    There are 38 questions to complete.

    Last Updated :
    Take a part in the ongoing discussion