Compiler Design questions — page 5 of 5

Q48

GATE CS 2013 CSOptimization and Data FlowMCQ2 marks−2/3 if wrong
Suppose the instruction set architecture of the processor has only two registers. The only allowed compiler optimization is code motion, which moves statements from one place to another while preserving correctness. What is the minimum number of spills to memory in the compiled code?
Show answer without attempting

Answer: B

Q49

GATE CS 2013 CSOptimization and Data FlowMCQ2 marks−2/3 if wrong
What is the minimum number of registers needed in the instruction set architecture of the processor to compile this code segment without any spill to memory? Do not apply any optimization other than optimizing register allocation.
Show answer without attempting

Answer: B

Q36

GATE CS 2012 CSRuntime EnvironmentsMCQ2 marks−2/3 if wrong
Consider the program given below, in a block-structured pseudo-language with lexical scoping and nesting of procedures permitted.
Program main;
   Var ...

   Procedure A1;
      Var ...
      Call A2;
   End A1

   Procedure A2;
      Var ...

      Procedure A21;
         Var ...
         Call A1;
      End A21

      Call A21;
   End A2

   Call A1;
End main.
Consider the calling chain: Main →\rightarrow A1 →\rightarrow A2 →\rightarrow A21 →\rightarrow A1

The correct set of activation records along with their access links is given by
Show answer without attempting

Answer: D

Q52

GATE CS 2012 CSParsingMCQ2 marks−2/3 if wrong
The FIRST and FOLLOW sets for the non-terminals A and B are
Show answer without attempting

Answer: A

Q53

GATE CS 2012 CSParsingMCQ2 marks
The appropriate entries for E1, E2, and E3 are
Show answer without attempting

Answer: C

0/50 correct0 marks

Related topics in GATE CS