0

Compiler Design

Description: Test contains concepts of complier design which mostly asked in ugc net and gate exam.
Number of Questions: 17
Created by:
Tags: Compiler design System Software and Compilers Compiler Design
Attempted 0/17 Correct 0 Score 0

Which of the following is not a compiler construction tool?

  1. Parser generator

  2. Data-flow engine

  3. Automatic code generator

  4. Preprocessor

  5. Syntax-directed translation engine


Correct Option: D
Explanation:

Preprocessor is a cousin of compiler.

Which of the following is not an item regarding each I/O variable of an I/O list for compiling the I/O list?

  1. I/O length

  2. I/O type

  3. Dimension information

  4. Compile time address

  5. Runtime address


Correct Option: D
Explanation:

Compile time address is not a part of I/O list.

A sequence of characters in the source program that is matched by the pattern for a token is called

  1. lexeme

  2. pattern

  3. token

  4. alphabet

  5. identifier


Correct Option: A
Explanation:

A sequence of characters in the source program that is matched by the pattern for a token is called lexeme.

Which of the following is an incorrect statement about copy restore method?

  1. Copy restore method is a hybrid between call by value and call by name.

  2. Copy-in-copy-out is another name for copy restore.

  3. Calling procedure calculates the value of the actual parameter and it then copies to activation record for the called procedure.

  4. During execution of called procedure, the actual parameter value is not affected.

  5. If the actual parameter has L-value, then at return, the value of formal parameter is copied to actual parameter.


Correct Option: A
Explanation:

Copy restore method is a hybrid between call by value and call by reference. Hence, it is an incorrect answer.

When a compiler uses a set of assignment instructions that occur in the program for analysis, it is called

  1. jump analysis

  2. index-check elimination

  3. inlining

  4. analysis available assignment

  5. tail-call optimization


Correct Option: D
Explanation:

When a compiler uses a set of assignment instructions that occur in the program for analysis, it is called analysis available assignment.

Which of the following is not an item of format list for compiling the format list?

  1. Format element type

  2. Format length

  3. Descriptor w[Field width]

  4. Descriptor d[Number of digits]

  5. Replication factor


Correct Option: B
Explanation:

Format length is not an item of format list for compiling the format list.

Which unit of activation record is a static link field that stores the information of data which is outside the local scope?

  1. Control link

  2. Machine status

  3. Local data

  4. Access link

  5. Actual parameter


Correct Option: D
Explanation:

Access link stores the information of data that is outside the local scope. It is also called static link field.

Which error recovery strategy performs local correction on the input to repair the error?

  1. Global correction

  2. System-level recovery

  3. Phrase-level recovery

  4. Panic mode error recovery

  5. Local correction error recovery


Correct Option: C
Explanation:

Phrase-level recovery performs local correction on the input to repair the error.

Annotated parse tree is an output of

  1. code generator

  2. scanner

  3. semantic analyzer

  4. parser

  5. intermediate code generator


Correct Option: C
Explanation:

Semantic analyzer produces annotated parse tree.

Which of the following loop optimization techniques combines the multiple loops that perform different calculation for the same loop iteration?

  1. Loop unrolling

  2. Loop-invariant code motion

  3. Loop jamming

  4. Induction analysis

  5. Strength reduction


Correct Option: C
Explanation:

Loop jamming combines the multiple loops which perform different calculation for the same loop iteration.

Which of the following is not an issue of code generation?

  1. Instruction selection

  2. Evaluation order

  3. Register allocation

  4. Common sub-expression elimination

  5. Target program


Correct Option: D
Explanation:

This is not an issue of code generator. It is a structure preserving transformation which removes repeated expression.

Which of the following is/are an issue of machine-independent optimization?

  1. Register allocation

  2. Structure-preserving transformations

  3. Instruction cost

  4. Memory management

  5. Input and output formats


Correct Option: B
Explanation:

Structure-preserving transformations are an issue of machine-independent optimization.

Which of the following structure-preserving transformations moves the evaluation of expressions from one part of the program to another part of the program?

  1. Code motion

  2. Strength reduction

  3. Variable propagation

  4. Interchanging of statements

  5. Dead-code elimination


Correct Option: A
Explanation:

Code motion moves the evaluation of expressions from one part of the program to another part of the program.

Not reachable statements due to wrongly written function calls is an error generated by which of the following phases of compiler?

  1. Syntax analysis

  2. Semantic analysis

  3. Symbol table

  4. Code optimization

  5. Intermediate code generation


Correct Option: D
Explanation:

Code optimization generates errors like not reachable statements due to wrongly written function calls etc.

Which of the following is the correct type checking expression for the given production rule?

E -> (E1, E2)

  1. {E.type = pointer(E1.type)}

  2. {E.type = tuple(E1.type, E2.type)}

  3. {E.type = if (E1.type = arrow(S,T) & E2.type = S) then T else error}

  4. {E.type = if (E1.type = array(S,T) & E2.type = int) then T else error}

  5. {E.type = if E1.type = pointer(T) then T else error}


Correct Option: B
Explanation:

This is the correct type checking expression for the given production rule.

Which of the following is a compile time error?

  1. Divide by zero

  2. Semantic error

  3. Pointers going

  4. Indices going

  5. Infinite loop


Correct Option: B
Explanation:

Semantic error is a compile time error.

Which of the following is an incorrect option about runtime storage organization?

  1. In storage organization, compiler demands for a block of memory to operating system. The compiler utilizes this block of memory executing the compiled program. This block of memory is called runtime storage.

  2. Runtime storage is divided into parts to hold data and code.

  3. The amount of memory required by data objects is known at the time and hence, data objects also can be placed at the statically determined area of memory.

  4. The size of generated code is dynamic.

  5. In runtime storage, stack is used to manage the active procedure.


Correct Option: D
Explanation:

The size of generated code is fixed. Hence, target code occupies the determined area of memory. Hence, it is an incorrect statement.

- Hide questions