Machine-translated by Google. Questions are authored in English.
Top

Intermediate Code Generation Questions and Answers

81.

Among the various ways an Intermediate code is represented, .................. intermediate code representation is close to the source program/language itself and ............. intermediate code representation is close to the target machine.

Exam Year(s)

MH SET - 2021, SET Exam - 2021,

Answer: C

The blanks are filled by High level, Low level.

Compilers use intermediate representations at different levels. A high-level representation, such as a syntax tree, keeps the structure of the source program (loops, array accesses, expressions), so it is close to the source language and suits machine-independent tasks such as type checking.

A low-level representation, such as three-address code close to machine instructions, is near the target machine and suits register allocation and instruction selection. The options that put low level first reverse the two, and 'medium level' is not the term used for the representation near the machine.

Please log in or register to report this question.

82.

A normalised heterogeneous abstract syntax tree must :

(i) Trees with magnitude of node type are called heterogeneous tree
(ii) Normalised heterogeneous tree use a normalised list of children like homogeneous tree
(iii) Nodes have irregular children
(iv) Use more than a single node data type but with normalised child list representation.

Exam Year(s)

MH SET - 2023, SET Exam - 2023,

Answer: A

The correct statements are (i), (ii) and (iv).

In the catalogue of AST patterns, trees with a multitude of node types (the paper's 'magnitude') are called heterogeneous trees (i). A normalised heterogeneous tree uses several node classes, but keeps the children in one normalised list, just as a homogeneous tree does (ii and iv).

Statement (iii), nodes with irregular children (each node class holding its children in its own named fields), describes the other variant, the irregular heterogeneous tree. So it does not belong to the normalised kind, and every option containing (iii) or missing (i), (ii) or (iv) is wrong.

Please log in or register to report this question.

83.

An...........is a data structure that is constructed from input data to a program and from which part or all of the output data of the program is constructed.

Exam Year(s)

MH SET - 2023, SET Exam - 2023,

Answer: C

It is an Intermediate Representation.

An intermediate representation is a data structure built by a program from its input, and from which part or all of its output is in turn produced. In a compiler, the front end builds an IR (an abstract syntax tree, three-address code and so on) from the source program, and the back end generates target code from it.

A symbol table records information about identifiers, a flow graph represents only the control flow, and an object file is the final output, not a structure between input and output.

Please log in or register to report this question.

Answer: C

One purpose is to increase the chances of reusing the machine-independent code optimizer in other compilers.

An intermediate representation separates the front end (source language) from the back end (target machine). Optimizations written on the intermediate code do not depend on either, so the same optimizer can be reused across compilers for different languages and machines.

Parsing and semantic analysis happen before intermediate code is produced, error reporting belongs to the front end, and register allocation is done for a specific machine in the back end, so the other options do not describe its purpose.

Please log in or register to report this question.

85.

Consider the following code segment :

x = u - t;
y = x * v;
x = y + w;
y = t - z;
y = x * y;

The minimum number of total variables required to convert the above code segment to static single assignment form is

Exam Year(s)

Tripura Public Service Commission - 2025,

Answer: D

The minimum number of variables is 10.

In static single assignment form every assignment creates a new variable:

\[ \begin{aligned} x_{1} &= u - t \\ y_{1} &= x_{1} \times v \\ x_{2} &= y_{1} + w \\ y_{2} &= t - z \\ y_{3} &= x_{2} \times y_{2} \end{aligned} \]

That gives five new variables (\(x_{1}, x_{2}, y_{1}, y_{2}, y_{3}\)) plus the five that are only read (u, t, v, w, z): 10 in all. 6, 8 and 9 reuse a name for two assignments or leave out some of the inputs.

Please log in or register to report this question.

86.

High - level intermediate language is

Exam Year(s)

Tripura Public Service Commission - 2019,

Answer: C

A high-level intermediate language is machine independent.

A compiler may use several intermediate representations. A high-level one, such as a syntax tree or three-address code, stays close to the source program and contains nothing about the registers or instructions of a particular processor, so the same front end can serve many targets. Low-level intermediate forms are the ones that become machine dependent.

FORTRAN (printed 'FORTAN') and COBOL are high-level programming languages, not intermediate languages.

Please log in or register to report this question.

Loading…

Other Subjects

Tags: Intermediate Code Generation Questions and Answers || Intermediate Code Generation MCQ Questions and Answers || Intermediate Code Generation GK Questions and Answers || Intermediate Code Generation GK MCQ Questions || Intermediate Code Generation Multiple Choice Questions and Answers || Intermediate Code Generation GK || GK on Intermediate Code Generation || Compiler Design Questions and Answers || Compiler Design MCQ Questions and Answers || Compiler Design GK Questions and Answers || GK on Compiler Design