Compiler Design
Exam Duration: 45 Mins Total Questions : 30
Variable prefix property is supported by
(i) LR parsing
(ii) LL parsing
- (a)
(ii) only
- (b)
(i) only
- (c)
Neither (i) nor (ii)
- (d)
Both (i) and (ii)
LR parsing
Left right parsing is supporting thr prefix property.
Consider the language L1 = {wcw\(|\)w is in \(\left( a|b \right) ^{ \ast }\) then which of the following statements is correct about L1 ?
(i) L1 is not context free language
(ii) L1 consists of all words composed of a repeated string of a's and b's separated by c.
(iii) Identifiers recognizing L1 can be embedded in the problem of checking that identifiers are declared before use.
- (a)
(i), (ii) and (iii)
- (b)
(i) and (iii)
- (c)
(i) and (ii)
- (d)
(ii) and (iii)
A hardware device that is cpable of executing a sequence of instructions is known as
- (a)
CPU
- (b)
ALU
- (c)
CU
- (d)
processor
Shift reduce parser are
- (a)
top-down parsers
- (b)
bottom-up parsers
- (c)
top-down or bottom-up parsers
- (d)
None of the above
Bottom-up parsers.
Shift-reduce parsing is the type of bottom-up parsers.
The language which are having many types, but the type of every name and expression must be calculate at compile time is called
- (a)
strongly typed
- (b)
weakly typed
- (c)
dynamic typed
- (d)
None of these
Which of the following is treated as restriction for translation routines that are invoked during parsing and routines must live ?
(i) A grammar that is suitable for parsing may not reflect the natural hierarchical structure of the constructs in the language.
(ii) The parsing method constrains the ordering which nodes in a parse tree are considered.
- (a)
(i) only
- (b)
(ii) only
- (c)
Both (i) and (ii)
- (d)
Neither (i) nor (ii)
Which of the following can be corrected by using minimum hamming distance method ?
- (a)
Syntactic error
- (b)
Semantic error
- (c)
Data flow optimization
- (d)
None of the above
A basic block can be analyzed by
- (a)
a DAG
- (b)
flow graph
- (c)
a graph with cycles
- (d)
None of the above
The value of k, in LR(k) cannot be
- (a)
0
- (b)
1
- (c)
2
- (d)
None of these
Back patching is useful for handling
- (a)
conditional jumps
- (b)
unconditional jumps
- (c)
backward references
- (d)
forward references
Which of the following is correct about run time environment ?
- (a)
The allocation and deallocation of a data object are managed by run time support package and design of the run time support package is influenced by the semantic of procedures.
- (b)
Each execution of a procedure is referred to as activation of the procedure and if procedure is recursive, several of its activation may be alive at the same time
- (c)
Both (a) and (b)
- (d)
Neither (a) nor (b)
In which type of loader, the assembler run in one part of memory and place the assembled machine unstructions and data as they are assembled directly into assigned memory location ?
- (a)
Compile and go loader
- (b)
general loader
- (c)
Absolute loader
- (d)
None of these
Which of the following system programs for going to the production of object code to generate absolute machine code and load into the physical main storage location from which it will be executed immediately upon completion of the assembly ?
- (a)
Two-pass assembler
- (b)
Load and go assembler
- (c)
Microprocessor
- (d)
Compiler
In analyzing the compilation of PL/l program, the description 'created of more optimal matrix' is associated aith
- (a)
assembly and output
- (b)
code generation
- (c)
syntax analysis
- (d)
machine indepedent optimization
The term 'environment' in programming language semntic is sai d as
- (a)
function that maps a name to value held there.
- (b)
function that maps a name to a storage location
- (c)
the function that maps a storage location to the value held there
- (d)
None of the above
A non-relocatable program is one which
- (a)
cannot be made toexecute in any area of storage other than tha one designated for it at the time of its coding or translation
- (b)
consists of a program and relevant information for its relocation
- (c)
can itself perform the relocation of its address sensitive portions.
- (d)
All of the above
A self relocating program is one which
- (a)
cannot be made to execute in any area of storage other than tha one designated for it at the time of its coding or translation
- (b)
consists of a program and relevant information for its relocation
- (c)
can itself perform the relocation of its address sensitive portions.
- (d)
All of the above
A compiler is
- (a)
a program that places programs into memory and orepares them for execution
- (b)
a program that automates the translation of assembly language into machine language
- (c)
a program that accepts a program written in a high level language and produces an object program
- (d)
a program that appears to execute a source program as if it was machine language.
The output of lexical analyser is
- (a)
a set of regular expressions
- (b)
syntax tree
- (c)
set of tokens
- (d)
strings of characters
A top-down parser generates
- (a)
right most derivation
- (b)
right most derivation in reverse
- (c)
left most derivation
- (d)
left most derivation in reverse
Which of the following grammars is LR (1) ?
- (a)
\(A\rightarrow aAa\\ A\rightarrow bAb\\ A\rightarrow a\)
- (b)
\(A\rightarrow aAa\\ A\rightarrow aAb\\ A\rightarrow c\)
- (c)
\(A\rightarrow A+A\\ A\rightarrow a\)
- (d)
Both (a) and (b)
Minimum hamming distance method is used for connection of
- (a)
syntactic errors
- (b)
semantic errors
- (c)
algorithm errors
- (d)
transcription errors
A parser with the valid prefix property is advantageous because
- (a)
it detects errors as soon as possible
- (b)
it detects errors as and when they occur
- (c)
it limit the amount of errorneous output passed to the next phase
- (d)
All of the above
Which of the following classes of statement usually produces no executable code when compiled ?
- (a)
Declaration statements
- (b)
Assignment statements
- (c)
Input and output statements
- (d)
Structural statements
Consider the following C fragment :
for (int x = 0 ; x <=n ; x+ +)
Which type of error detected by the C compiler for the above code ?
- (a)
Lexical error
- (b)
Syntactic error
- (c)
Semantic error
- (d)
Logical error
The top-down parsing method is also called
- (a)
recursive descent parsing
- (b)
Shift-reduce parsing
- (c)
Operator precedence parsing
- (d)
None of the above
Semantic errors can be detected
- (a)
at compile time only
- (b)
at run time only
- (c)
Both (a) and (b)
- (d)
None of the above
Yacc stands for
- (a)
yet accept compiler constructs
- (b)
yet accept compiler
- (c)
yet another compiler constructs
- (d)
yet another compiler
The process of computing the attribute values at the nodes in parse tree is called ............parse tree.
- (a)
annotating
- (b)
decorating
- (c)
Both (a) and (b)
- (d)
Neither (a) nor (b0
In a syntax directed definition terminals are assumed to have synthesized attributes only because
- (a)
the definition does not provide any semantic rules for terminals
- (b)
the definition and declaration does not provide any expression for non-terminals
- (c)
values for attributes of terminals are usually supplied by the lexical analyzer
- (d)
None of the above