Compiler-Design

Question 1
Which of the following comparisons between static and dynamic type checking is incorrect?
A
Dynamic type checking slows down the execution
B
Dynamic type checking offers more flexibility to the programmers
C
In contrast to Static type checking, dynamic type checking may cause failure in runtime due to type errors
D
Unlike static type checking, dynamic type checking is done during compilation
       Compiler-Design       Compilers       ISRO-2018
Question 1 Explanation: 
→ Type checking is the process of verifying and enforcing the constraints of types, and it can occur either at compile time (i.e. statically) or at runtime (i.e. dynamically).
→ Type checking is all about ensuring that the program is type-safe, meaning that the possibility of type errors is kept to a minimum.
→ A language is statically-typed if the type of a variable is known at compile time instead of at runtime. Common examples of statically-typed languages include Ada, C, C++, C#, JADE, Java, Fortran, Haskell, ML, Pascal, and Scala.
→ Dynamic type checking is the process of verifying the type safety of a program at runtime. Common dynamically-typed languages include Groovy, JavaScript, Lisp, Lua, Objective-C, PHP, Prolog, Python, Ruby, Smalltalk and Tcl.
Question 2
Incremental Compiler is a compiler
A
which is written in a language that is different from the source language
B
compiles the whole source code to generate object code afresh
C
compiles only those portion of source code that has been modified.
D
that runs on one machine but produces object code for another machine
       Compiler-Design       Compilers       ISRO-2018
Question 2 Explanation: 
Types of compilers

1. Incremental compiler: It rebuilds all program modules, incremental compiler re-compiles only those portions of a program that have been modified.
2. Cross-compiler: If the compiled program can run on a computer whose CPU or operating system is different from the one on which the compiler runs, the compiler is a cross-compiler.
3. A bootstrap compiler: is written in the language that it intends to compile. A program that translates from a low-level language to a higher level one is a decompiler.
4. Source-to-source compiler or transpiler: A program that translates between high-level languages is usually called a source-to-source compiler or transpiler.
Question 3
DU-chains(Definition-Use) in compiler design
A
Consist of a definition of a variable and all its uses, reachable from that definition
B
Are created using a form of static code analysis
C
Are prerequisite for many compiler optimization including constant propagation and common sub-expression elimination
D
All of the above
       Compiler-Design       Compilers       ISRO-2018
Question 3 Explanation: 
→ A Use-Definition Chain (UD Chain) is a data structure that consists of a use, U, of a variable, and all the definitions, D, of that variable that can reach that use without any other intervening definitions. A definition can have many forms but is generally taken to mean the assignment of some value to a variable (which is different from the use of the term that refers to the language construct involving a data type and allocating storage).
→ A counterpart of a UD Chain is a Definition-Use Chain (DU Chain), which consists of a definition, D, of a variable and all the uses, U, reachable from that definition without any other intervening definitions.
→ Both UD and DU chains are created by using a form of static code analysis known as data flow analysis. Knowing the use-def and def-use chains for a program or subprogram is a prerequisite for many compiler optimizations, including constant propagation and common subexpression elimination.
Question 4
Which of the following comment about peephole optimization is true?
A
It is applied to a small part of the code and applied repeatedly
B
It can be used to optimize intermediate code
C
It can be applied to a portion of the code that is not contiguous
D
It is applied in the symbol table to optimize the memory requirements.
       Compiler-Design       Code-Optimization       ISRO-2018
Question 4 Explanation: 
→ Peephole optimization is a kind of optimization performed over a very small set of instructions in a segment of generated code. The set is called a "peephole" or a "window". It works by recognizing sets of instructions that can be replaced by shorter or faster sets of instructions.

Replacement Rules:
1. Null sequences – Delete useless operations.
2. Combine operations – Replace several operations with one equivalent.
3. Algebraic laws – Use algebraic laws to simplify or reorder instructions.
4. Special case instructions – Use instructions designed for special operand cases.
5. Address mode operations – Use address modes to simplify code.
Question 5
Relative to the program translated by a compiler, the same program when interpreted runs
A
Faster
B
Slower
C
At the same speed
D
May be faster or slower
       Compiler-Design       Compilers       ISRO CS 2008
Question 5 Explanation: 

→ Interpreter translates program one statement at a time. Scans the entire program and translates it as a whole into machine code. It takes less amount of time to analyze the source code but the overall execution time is slower.

→ Compiler scans the entire program and translates it as a whole into machine code. It takes large amount of time to analyze the source code but the overall execution time is comparatively faster.
Question 6
The output of a lexical analyzer is
A
A parse tree
B
Intermediate code
C
Machine code
D
A stream of tokens
       Compiler-Design       Compilers       ISRO-2017 May
Question 6 Explanation: 
Explanation: The output of a lexical analyzer is a stream of tokens.
Question 7
Which of the following class of statement usually produces no executable code when compiled?
A
declaration
B
assignment statements
C
input and output statements
D
structural statements
       Compiler-Design       Code-Optimization       ISRO CS 2008
Question 7 Explanation: 

Each statement is classified as executable or non-executable.

Executable Statements

1.Arithmetic, logical, statement label (ASSIGN), and character assignment statements

2.Unconditional GO TO, assigned GO TO, and computed GO TO statements

3.Arithmetic IF and logical IF statements

4.Block IF, ELSE IF, ELSE, and END IF statements

5.CONTINUE statement

6.STOP and PAUSE statements

7.DO statement

8.READ, WRITE, and PRINT statements

9.REWIND, BACKSPACE, ENDFILE, OPEN, CLOSE, and INQUIRE statements

10.CALL and RETURN statements

11.END statement

Non-executable Statements

1.PROGRAM, FUNCTION, SUBROUTINE, ENTRY, and BLOCK DATA statements

2.DIMENSION, COMMON, EQUIVALENCE, IMPLICIT, PARAMETER, EXTERNAL, INTRINSIC, and SAVE statements

3.INTEGER, REAL, DOUBLE PRECISION, COMPLEX, LOGICAL, and CHARACTER type-statements

4.DATA statement

5.FORMAT statement

6.Statement function statement
Question 8
The access time of the symbol table will be logarithmic if it is implemented by
A
Linear list
B
Search tree
C
Hash table
D
Self organization list
       Compiler-Design       Symbol-Table       ISRO-2016
Question 8 Explanation: 
Access time of the symbolic table will be logarithmic if it is implemented by search time.
Question 9
Recursive descent parsing is an example of
A
Top-down parsers
B
Bottom-up parsers
C
Predictive parsers
D
None of the above
       Compiler-Design       Parsers       ISRO-2016
Question 9 Explanation: 
→ A recursive descent parser is a kind of top-down parser built from a set of mutually recursive procedures (or a non-recursive equivalent) where each such procedure implements one of the nonterminals of the grammar.
→ Thus the structure of the resulting program closely mirrors that of the grammar it recognizes.
Question 10
A top-down parser generates
A
Rightmost Derivation
B
Rightmost derivation in reverse
C
Leftmost derivation
D
Leftmost derivation in reverse
       Compiler-Design       Parsers       ISRO-2016
Question 10 Explanation: 
→ Top-down parsing can be viewed as an attempt to find leftmost derivations of an input-stream by searching for parse-trees using a top-down expansion of the given formal grammar rules.
→ The inclusive choice is used to accommodate ambiguity by expanding all alternative right-hand-sides of grammar rules.
Question 11
Peephole optimization is a form of
A
Loop optimization
B
Local optimization
C
Constant folding
D
Data flow analysis
       Compiler-Design       Code-Optimization       ISRO-2016
Question 11 Explanation: 
→ Peephole optimization technique works locally on the source code to transform it into an optimized code.
→ By locally, we mean a small portion of the code block at hand.
→ These methods can be applied on intermediate codes as well as on target codes.
Question 12
Substitution of values for names (whose values are constants) is done in
A
Local optimization
B
Loop optimization
C
Constant folding
D
Strength reduction
       Compiler-design       Code-Optimization       ISRO CS 2009
Question 12 Explanation: 
Expressions with constant operands can be evaluated at compile time, thus improving run-time performance and reducing code size by avoiding evaluation at compile-time.
Example:
In the code fragment below, the expression (3 + 5) can be evaluated at compile time and replaced with the constant 8.

int f (void)
{
return 3 + 5;
}

Below is the code fragment after constant folding.

int f (void)
{
return 8;
}
Question 13
Which one of the following is correct about the statements are given below? I.  All function calls are resolved at compile time in C language II. All function calls are resolved at compile time in C++ language
A
Only II is correct
B
Both I and II are correct
C
Only I is correct
D
Both I and II are incorrect
       Compiler-Design       Compilers       ISRO-2016
Question 13 Explanation: 
Both statements are wrong. I. Logical errors can’t solve in compile time. Like dividing by error.
II. In c++ also we have to write exceptions.
Question 14
A simple two-pass assembler does which of the following in the first pass:
A
Checks to see if the instructions are legal in the current assembly mode
B
It allocates space for the literals.
C
It builds the symbol table for the symbols and their values.
D
All of these
       Compiler-Design       Assembler       ISRO-2016
Question 14 Explanation: 
2-pass Assembler can perform all of above operations.
Question 15
In compiler terminology reduction in strength means
A
Replacing run time computation by compile time computation
B
Removing loop invariant computation
C
Removing common subexpressions
D
replacing a costly operation by a relatively cheaper one
       Compiler-Design       Code-Optimization       ISRO CS 2011
Question 15 Explanation: 
An optimization method in which an operator is changed to a less-expensive operator;
Example: Exponentiation is replaced by multiplication and multiplication is in return replaced by addition.(x * 2 becomes x + x)
Question 16
Which of the following statements about peephole optimization is False?
A
It is applied to a small part of the code
B
It can be used to optimize intermediate code
C
To get the best out of this, it has to be applied repeatedly
D
It can be applied to the portion of the code that is not contiguous
       Compiler-Design       Code-Optimization       ISRO CS 2011
Question 16 Explanation: 
Peephole optimization is a type of Code Optimization performed on a small part of the code. It is performed on the very small set of instructions in a segment of code.
It basically works on the theory of replacement in which a part of code is replaced by shorter and faster code without change in output.
Question 17
Which variable does not drive a terminal string in grammar?
S → AB
A → a
B → b
B → C
A
A
B
B
C
C
D
S
       Compiler-Design       Context-free-grammar       ISRO CS 2011
Question 17 Explanation: 
C is the useless variable as there is no production rule which replaces C with a terminal. Hence it does not derive any non terminal.
Question 18
Shift reduce parsing belongs to a class of
A
bottom up parsing
B
top down parsing
C
recursive parsing
D
predictive parsing
       Compiler-Design       Parsers       ISRO CS 2013
Question 18 Explanation: 
→ A shift-reduce parser is a class of efficient, table-driven bottom-up parsing methods for computer languages and other notations formally defined by a grammar.
→ The parsing methods most commonly used for parsing programming languages, LR parsing and its variations, are shift-reduce methods.

Question 19
Which of the following productions eliminate left recursion in the productions given below:
S → Aa | b
A → Ac | Sd | ε
A
S → Aa | b
A → bdA’
A’ → A’c
| A’ba | A | ε
B
S → Aa | b
A → A’ |
bdA’,
A’ → cA’
| adA’ | ε
C
S → Aa | b
A → A’c |
A’d
A’ → bdA’
| cA | ε
D
S → Aa | b
A → cA’ |
adA’ | bdA’
A’ → A | ε
       Compiler-Design       Parsers       ISRO CS 2013
Question 19 Explanation: 
Question 20

A bottom-up parser generates :

A
Leftmost derivation in reverse
B
Right-most derivation in reverse
C
Left-most derivation
D
Right-most derivation
       Compiler-Design       Syntax-tree-and-context-flow-graph       UGC-NET JUNE Paper-2
Question 20 Explanation: 
A bottom-up parser uses Right-most derivation in reverse order to decide “What to Reduce”.
Question 21
Identify the correct nodes and edges in the given intermediate code:
(1) i=1
(2) t1=5*I
(3) t2=4*t1
(4) t3=t2
(5) a[t3]=0
(6) i=i+1;
(7) if i<15 goto(2)
A
33
B
44
C
43
D
34
       Compiler-Design       Nielit Scentist-B [02-12-2018]
Question 21 Explanation: 
Step-1: Initialization we are taking one node
Step-2: From 2nd statement to 6th statement we are performing some tasks.
Step-3: It indicate if condition, so it’s another statement. And the back loop indicates goto statement.
Here, total 3 nodes and 3 edges using control flow graph.

In options they have to give like this
3 and 3
4 and 4
4 and 3
3 and 4
But they combines the node value and edge value. It seems different value.
Question 22
__number of queues are needed to implement symbol and is acting as permanent database
A
Variable Table
B
Terminal Table
C
Keyword Table
D
Identifier Table
       Compiler-Design       Nielit Scentist-B [02-12-2018]
Question 22 Explanation: 
Symbol Table is an important data structure created and maintained by the compiler in order to keep track of semantics of variable i.e. it stores information about scope and binding information about names, information about instances of various entities such as variable and function names, classes, objects, etc.
Symbol Table entries: Each entry in symbol table is associated with attributes that support
→ compiler in different phases.
→ Items stored in Symbol table:
→ Variable names and constants
→ Procedure and function names
→ Literal constants and strings
→ Compiler generated temporaries
→ Labels in source languages
Question 23
Identify the total number of tokens in the given statements printf(“A%B=”, &i);
A
7
B
8
C
9
D
13
       Compiler-Design       Nielit Scentist-B [02-12-2018]
Question 23 Explanation: 
The tokens are
Printf
(
“A%B=”
,
&
I
)
;
Question 24
Which of the following code replacements is an example of operator strength reduction?
A
Replace P^2 by P*P
B
Replace P*16 by P<< 4
C
Replace pow(P,3) by P*P*P
D
Replace (P <<5) -P by P*3
       Compiler-Design       Nielit Scentist-B [02-12-2018]
Question 24 Explanation: 
Strength Reduction :
It is a compiler optimization where expensive operations are replaced with equivalent but less expensive operations. The classic example of strength reduction converts "strong" multiplications inside a loop into "weaker" additions – something that frequently occurs in array addressing.
Examples:
Replacing a multiplication within a loop with an addition
Replacing an exponentiation within a loop with a multiplication
According to options, Option B is most suitable answer.
Question 25
____ merges the bodies of two loops.
A
Loop rolling
B
Loop folding
C
Loop merge
D
Loop jamming
       Compiler-Design       Nielit Scentist-B [02-12-2018]
Question 25 Explanation: 
→ Loop fusion (or loop jamming) is a compiler optimization and loop transformation which replaces multiple loops with a single one.
→ Loop fission (or loop distribution) is a compiler optimization in which a loop is broken into multiple loops over the same index range with each taking only a part of the original loop's body.
Question 26
____ merges the bodies of two loops.
A
Loop rolling
B
Loop folding
C
Loop merge
D
Loop jamming
       Compiler-Design       Nielit Scentist-B [02-12-2018]
Question 26 Explanation: 
→ Loop fusion (or loop jamming) is a compiler optimization and loop transformation which replaces multiple loops with a single one.
→ Loop fission (or loop distribution) is a compiler optimization in which a loop is broken into multiple loops over the same index range with each taking only a part of the original loop's body.
Question 27
Which of the following can be accessed by transfer vector approach of linking?
A
External data segments
B
External subroutines
C
data located in other procedure
D
All of these
       Compiler-Design       External-subroutines       Nielit Scientist-C 2016 march
Question 27 Explanation: 
● The transfer vector approach is straightforward, but requires additional memory at execution time for the transfer vector and additional time due to the indirect references. Indexing or indirection on externals may not occur correctly with the transfer vector approach.
● Data segment stores program data. This data could be in form of initialized or uninitialized variables, and it could be local or global.
● External subroutines are routines/procedures that are created and maintained separately from the program that will be calling them
Question 28
YACC builds up
A
SLR parsing table
B
Canonical LR parsing table
C
LALR parsing table
D
None of these
       Compiler-Design       Parsers       Nielit Scientist-C 2016 march
Question 28 Explanation: 
● YACC (Yet Another Compiler-Compiler) is a computer program.
● It is a Look Ahead Left-to-Right (LALR) parser generator, generating a parser, the part of a compiler that tries to make syntactic sense of the source code, specifically a LALR parser, based on an analytic grammar written in a notation similar to Backus–Naur Form (BNF)
Question 29
Micro program is
A
the name of source program in micro computers
B
the set of instructions indicating the primitive operations in a system
C
primitive form of macros used in assembly language programming
D
program of very small size
       Compiler-Design       Micro-Program       Nielit Scientist-C 2016 march
Question 29 Explanation: 
● Micro program is a set of microinstructions that defines the individual operations that a computer carries out in response to a machine-language instruction.
● A ​ microinstruction​ is a bit pattern in which each bit (or combination of bits) drives the control signals of the hardware.
Question 30
What is the maximum number of reduce moves that can be taken by a bottom up parser for a grammar with no epsilon and unit production(i.e., of type A →   and A →  a) to parse a string with n tokens?
A
n/2
B
n-1
C
2n-1
D
2n
       Compiler-Design       Parsers       Nielit Scientist-B CS 22-07-2017
Question 30 Explanation: 
Since it is given that the grammar cannot have:
1) epsilon production
2) production of the form A → a
Consider the grammar:
S → Sa | a
If we were to derive the string “aaa” whose length is 3 then the number of reduce moves that would have been required are shown below:
S→ Sa
→Saa
→aaa
This shows us that it has three reduce moves. The string length is 3 and the number of reduce moves is also 3. So presence of such kinds of production might give us the answer “n” for maximum number of reduce moves. But these productions are not allowed as per the question.
Also note that if a grammar does not have unit production then the maximum number of reduce moves can not exceed “n” where “n” denotes the length of the string.
3) No unit productions
Consider the grammar:
S→ A
A→ B
B→C
C→a
If we were to derive the string “a” whose length is 1 then the number of reduce moves that would have been required are shown below:
S→ A
A→ B
B→C
C→a
This shows us that it has four reduce moves. The string length is 1 and the number of reduce moves is 4. So presence of such kind of productions might give us the answer “n+1” or even more, for maximum number of reduce moves. But these productions are not allowed as per the question.
Now keeping in view the above points suppose we want to parse the string “abcd”. (n = 4) using bottom-up parsing where strings are parsed finding the rightmost derivation of a given string backwards. So here we are concentrating on deriving rightmost derivations only.
We can write the grammar which accepts this string which in accordance to the question, (i.e., with no epsilon- and unit-production (i.e., of type A → є and A → B) and no production of the form A→a) as follows:
S→aB
B→bC
C→cd
The Right Most Derivation for the above is:
S → aB (Reduction 3)
→ abC (Reduction 2)
→ abcd (Reduction 1)
We can see here the number of reductions present is 3.
We can get less number of reductions with some other grammar which also doesn’t produce unit or epsilon productions or production of the form A→a:
S→abA
A→ cd
The Right Most Derivation for the above is:
S → abA (Reduction 2)
→ abcd (Reduction 1)
Hence 2 reductions.
But we are interested in knowing the maximum number of reductions which comes from the 1st grammar. Hence total 3 reductions as maximum, which is (n – 1) as n = 4 here.
Question 31
In a compiler, keywords of a language are recognized during
A
Parsing of the program
B
the code generation
C
the lexical analysis of the program
D
dataflow analysis
       Compiler-Design       Compilers       Nielit Scientist-B CS 22-07-2017
Question 31 Explanation: 
Lexical analysis is the first phase of a compiler. It takes the modified source code from language preprocessors that are written in the form of sentences.
The lexical analyzer breaks these syntaxes into a series of tokens, by removing any whitespace or comments in the source code.
In programming language, keywords, constants, identifiers, strings, numbers, operators and punctuations symbols can be considered as tokens.
Question 32
A system program that combines the separately compiled modules of a program into a form suitable for execution
A
Assembler
B
linking loader
C
cross compiler
D
load and go
       Compiler-Design       Linker-Loader       Nielit Scientist-B CS 22-07-2017
Question 32 Explanation: 
An assembler is a type of computer program that interprets software programs written in assembly language into machine language, code and instructions that can be executed by a computer.
A loader which combines the functions of a relocating loader with the ability to combine a number of program segments that have been independently compiled into an executable program.
A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running.
Question 33
Which of the following statements is false?
A
There exist parsing algorithms for some programming languages whose complexities are less than O(n3)
B
A programming language which allows recursion can be implemented with static storage allocation
C
L-attributed definition can be evaluated in the framework of bottom-up parsing
D
Code improving transformation can be performed at both source language and intermediate code level.
       Compiler-Design       Nielit STA [02-12-2018]
Question 33 Explanation: 
→ Statement I is true, as the bottom up and top down parser take O(n) time to parse the string , i.e. only one scan of input is required.
→ Statement II is false, as a programming language which allows recursion requires dynamic storage allocation.
→ Statement III is True, as L-attributed definition (assume for instance the L-attributed definition has synthesized attribute only) can be evaluated in bottom up framework.
→ Statement IV is true,Code improving transformations can be performed at both source language and intermediate code level. For example implicit type casting is also a kind of code improvement which is done during semantic analysis phase and intermediate code optimization is a topic itself which uses various techniques to improve the code such as loop unrolling, loop invariant.
Question 34
In a single pass assembler, most of the forward references can be avoided by putting the restriction
A
on the number of strings/lifereacs
B
that the data segment must be defined after the code segment
C
on unconditional rump
D
that the data segment be defined before the code segment
       Compiler-Design       Assembler       Nielit Scientist-B CS 2016 march
Question 34 Explanation: 
Data segment − It is represented by .data section and the .bss. The .data section is used to declare the memory region, where data elements are stored for the program. This section cannot be expanded after the data elements are declared, and it remains static throughout the program.
The .bss section is also a static memory section that contains buffers for data to be declared later in the program. This buffer memory is zero-filled.
Code segment − It is represented by .text section. This defines an area in memory that stores the instruction codes. This is also a fixed area.
Question 35

The grammar S ⟶ (S) | SS | ∈ is not suitable for predictive parsing because the grammar is

A
An Operator Grammar
B
Right Recursive
C
Left Recursive
D
Ambiguous
       Compiler-Design       Parsers       UGC-NET DEC Paper-2
Question 35 Explanation: 
The grammar is ambiguous, as to derive string ( )( )( ) more than one parse tree exists.
Question 36
Pseudo-instructions are
A
assembler directives
B
instructions in any program that have no corresponding machine code instruction
C
instruction in any program whose presence or absence will not change the output for any input
D
none of these
       Compiler-Design       Assembler       NieLit STA 2016 March 2016
Question 36 Explanation: 
Pseudo Instructions are special commands to the assembler about the positioning of the program, the address the program should presumed to be assembled at, the name of the module, data declarations, the title and printing options for the program, defining and calling macros, macro looping and test, and end of source code. Unless a machine instruction is issued, these do not generate executable code.
Question 37

Consider the following Grammar G :

S➝ A | B
A➝ a | c
B➝ b | c

Where {S,A,B} is the set of non-terminals, {a,b,c} is the set of terminals.

Which of the following statement(s) is/are correct ?

    S1 : LR(1) can parse all strings that are generated using grammar G.
    S2 : LL(1)  can parse all strings that are generated using grammar G.

Choose the correct answer from the code given below :

Code :
A
Both S1 and S2
B
Only S2
C
Neither S1 nor S2
D
Only S1
       Compiler-Design       Parsers       UGC-NET DEC Paper-2
Question 37 Explanation: 
For generating string “c” we have two different parse trees.

Since the grammar is Ambiguous so the strings generated by the grammar G can’t be parsed by LR(1) or LL(1) parser.
Question 38
The identification of common sub-expression and replacement of run time computations by compile-time computations is:
A
Local optimization
B
Constant folding
C
Loop Optimization
D
Data flow analysis
       Compiler-Design       Code Optimization       Nielit Scientist-B CS 4-12-2016
Question 38 Explanation: 
● Constant folding is the process of recognizing and evaluating constant expressions at compile time rather than computing them at runtime.It can more accurately propagate constants and simultaneously remove dead code
● Global optimization refers to finding the optimal value of a given function among all possible solution whereas local optimization finds the optimal value within the neighboring set of candidate solution.
● Loop optimization is the process of increasing execution speed and reducing the overheads associated with loops. It plays an important role in improving cache performance and making effective use of parallel processing capabilities. Most execution time of a scientific program is spent on loops; as such, many compiler optimization techniques have been developed to make them faster.
● Data-flow analysis is a technique for gathering information about the possible set of values calculated at various points in a computer program.
Question 39
The structure or format of data is called:
A
Syntax
B
Struct
C
Semantic
D
none of the above
       Compiler-Design       Basics       Nielit Scientist-B CS 4-12-2016
Question 39 Explanation: 
Semantics defines how a particular pattern to be interpreted, and what action is to be taken based on that interpretation.
Question 40
The graph that shows basic blocks and their successor relationship is called:
A
DAG
B
Control graph
C
Flow graph
D
Hamiltonian graph
       Compiler-Design       Code-Optimization       Nielit Scientist-B CS 4-12-2016
Question 40 Explanation: 
→ Flow graph shows the basic blocks
→ A flow graph is a form of digraph associated with a set of linear algebraic or differential equations.
Definition: "A signal flow graph is a network of nodes (or points) interconnected by directed branches, representing a set of linear algebraic equations. The nodes in a flow graph are used to represent the variables, or parameters, and the connecting branches represent the coefficients relating these variables to one another. The flow graph is associated with a number of simple rules which enable every possible solution [related to the equations] to be obtained."
Question 41
A top down parser generates:
A
Leftmost derivation
B
rightmost derivation
C
Leftmost derivation in reverse
D
Rightmost derivation in reverse
       Compiler-Design       Compilers       Nielit Scientist-B CS 4-12-2016
Question 41 Explanation: 
● When the parser starts constructing the parse tree from the start symbol and then tries to transform the start symbol to the input, it is called top-down parsing.
● Top-down parsing can be viewed as an attempt to find leftmost derivations of an input-stream by searching for parse-trees using a top-down expansion of the given formal grammar rules.
Question 42
Syntax directed translation scheme is desirable because:
A
It is based on the syntax
B
It is easy to modify
C
Its description is independent of any implementation
D
All of these
       Compiler-Design       Syntax-Directed-Translation       Nielit Scientist-B CS 4-12-2016
Question 42 Explanation: 
Syntax-directed translation refers to a method of compiler implementation where the source language translation is completely driven by the parser.
A common method of syntax-directed translation is translating a string into a sequence of actions by attaching one such action to each rule of a grammar.
Question 43
The output of lexical analyzer is:
A
A set of regular expressions
B
Strings of character
C
Syntax tree
D
Set of tokens
       Compiler-Design       Compilers       Nielit Scientist-B CS 4-12-2016
Question 43 Explanation: 
● Lexical analysis is the first phase of a compiler. It takes the modified source code from language preprocessors that are written in the form of sentences.
● The lexical analyzer breaks these syntaxes into a series of tokens, by removing any whitespace or comments in the source code.
Question 44
Given the following expression grammar:
E→ E*F | F+E |F
F→ F-F | id
Which of the following is true?
A
* has higher precedence than +
B
– has higher precedence than *
C
+ and – have same precedence
D
+ has higher precedence than *
       Compiler-Design       Associativity-and-Precedence       ISRO CS 2015
Question 44 Explanation: 
The operator which is in low level that can have high preference.
Order of precedence is *, +, -.
Here * and + have equal preference, '-' can have higher precedence than + and *.
Question 45
The number of tokens in the following C statement is
printf(“i=%d, &i=%x”, i&i);
A
13
B
6
C
10
D
0
       Compiler-Design       Compilers       ISRO CS 2015
Question 45 Explanation: 

Question 46
Which grammar rules violate the requirement of the operator grammar? A, B, C are variables and a, b, c are terminals 1) A → BC 2) A → CcBb 3) A → BaC 4) A → ε
A
1 only
B
1 and 2 only
C
1 and 3 only
D
1 and 4 only
       Compiler-Design       Parsers       ISRO CS 2015
Question 46 Explanation: 
Operator values doesn't contains nullable values and two adjacent non-terminals on RHS production.
i) On RHS it contains two adjacent non-terminals.
ii) Have nullable values.
Question 47
Which one of the following is a top-down parser?
A
Recursive descent parser
B
Shift left associative parser
C
SLR(k) parser
D
LR(k) parser
       Compiler-Design       Parsers       ISRO CS 2015
Question 47 Explanation: 

Question 48
YACC stands for
A
yet accept compiler constructs
B
yet accept compiler compiler
C
yet another compiler construct
D
yet another compiler compiler
       Compiler-Design       Parsers       ISRO CS 2015
Question 48 Explanation: 
→ Yacc (Yet Another Compiler-Compiler) is a computer program for the Unix operating system developed by Stephen C. Johnson.
→ It is a Look Ahead Left-to-Right (LALR) parser generator, generating a parser, the part of a compiler that tries to make syntactic sense of the source code, specifically a LALR parser, based on an analytic grammar written in a notation similar to Backus-Naur Form (BNF)
Question 49
Which statement is true?
A
LALR parser is more powerful and costly as compare to other parsers
B
All CFG’s are LP and not all grammars are uniquely defined
C
Every SLR grammar is unambiguous but not every unambiguous grammar is SLR
D
LR(K) is the most general backtracking shift reduce parsing method
       Compiler-Design       Parsers       ISRO CS 2015
Question 49 Explanation: 

Option-A: LR > LALR > SLR

Canonical LR parser is more powerful than LALR parser. So, it FALSE

Option-B: Here, LP is linear precedence. Every grammar generated by LP are CFG but all CFG's are not LP. So, it is false

Option-C: TRUE

Option-D: LR(K) is general non backtracking shift reduce parsing method. So, It is false
Question 50

With respect to compiler design, "recursive descent" is a ____ parsing technique that reads the inputs from ____.

A
top-down, right to left
B
top-down, left to right
C
bottom up, right to left
D
bottom up, left to right
       Compiler-Design       Parsers       JT(IT) 2018 PART-B Computer Science
Question 50 Explanation: 
A recursive descent parser is a kind of top-down parser built from a set of mutually recursive procedures (or a non-recursive equivalent) where each such procedure implements one of the nonterminals of the grammar. Thus the structure of the resulting program closely mirrors that of the grammar it recognizes.
→ Top down parsers reads the input from left to right and bottom up parsers are reads the input from left to right and reverse.
Question 51

Which of the following is NOT a bottom up, shift reduce parser?

A
LR parser
B
LL parser
C
SLR parser
D
LALR parser
       Compiler-Design       Parsers       JT(IT) 2018 PART-B Computer Science
Question 51 Explanation: 
Bottom Up SR Parsers are:
1. SLR
2. LALR
3. CLR
4. LR(0)
Top Down parser:
1. Recursive descent
2. Non Recursive descent(LL(1))
Question 52
Which of the following is machine independent optimization?
A
Loop optimization
B
Redundancy Elimination
C
Folding
D
All of the options
       Compiler-Design       Nielit Scientist-B 17-12-2017
Question 52 Explanation: 

Question 53
Which of the following statements is/ are false?
S1: LR(0) grammar and SLR(1) grammar are equivalent
S2: LR(1) grammar are subset of LALR(1) grammars
A
S1 only
B
S1 and S2 both
C
S2 only
D
None of the options
       Compiler-Design       Nielit Scientist-B 17-12-2017
Question 53 Explanation: 
The space of grammars:

Question 54
The optimization phase in a compiler gererally:
A
The optimization phase in a compiler gererally:
B
Optimization the code to reduce execution time
C
Both (A) and (B)
D
Neither (A) nor (B)
       Compiler-Design       Nielit Scientist-B 17-12-2017
Question 54 Explanation: 
→ An optimizing compiler is a compiler that tries to minimize or maximize some attributes of an executable computer program.
→ The most common requirement is to minimize the time taken to execute a program; a less common one is to minimize the amount of memory occupied.
→ The growth of portable computers has created a market for minimizing the power consumed by a program
Question 55

Which of the following phases of the compilation process is also known as parsing?

A
Lexical analysis
B
Code optimization
C
Syntax analysis
D
Semantic analysis
       Compiler-Design       Parsers       JT(IT) 2018 PART-B Computer Science
Question 55 Explanation: 
Parsing, syntax analysis, or syntactic analysis is the process of analysing a string of symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal grammar. The term parsing comes from Latin pars (orationis), meaning part (of speech).
Question 56
Resolution of externally defined symbols is performed by____
A
Linker
B
Loader
C
Compiler
D
Editor
       Compiler-Design       Linker       KVS 22-12-2018 Part-B
Question 56 Explanation: 
→ A linker is a computer utility program that takes one or more object files generated by a compiler and combines them into a single executable file, library file, or another 'object' file.
→ A loader is a major component of an operating system that ensures all necessary programs and libraries are loaded, which is essential during the startup phase of running a program.
→ It places the libraries and programs into the main memory in order to prepare them for execution.
Question 57
Which of the following are language processor?
A
Assembler and editor
B
Compiler and word processor
C
Only Assembler and compiler
D
Assembler,Compiler and Interpreter
       Compiler-Design       Compilers-and-Parsers       KVS 22-12-2018 Part-B
Question 57 Explanation: 
→ Compiler : Compilers are used to convert high level languages (like C, C++ ) into machine code Example : gcc , Microsoft Visual Studio
→ Assembers : Assembler are used to convert assembly language code into machine code.
→ Interpreter : An interpreter is a computer program which executes a statement directly (at runtime).
→ Examples: python , LISP
Question 58
Synthesized attribute can easily be simulated by an
A
LL grammar
B
ambiguous grammar
C
LR grammar
D
none of the above
       Compiler-Design       Syntax-Directed-Translation       Nielit Scientific Assistance CS 15-10-2017
Question 58 Explanation: 
● A ​ Synthesized attribute ​ is an attribute of the nonterminal on the left-hand side of a production.
● Synthesized attributes represent information that is being passed up the parse tree.
● LR-attributed grammars allow the attributes to be evaluated on LR parsing. As a result, attribute evaluation in LR-attributed grammars can be incorporated conveniently in bottom-up parsing.
Question 59
Consider an ε-tree CFG. If for every pair of productions A → u and A → v
A
if FIRST(u) ∩ FIRST(v) is empty then the CFG has to be LL(1)
B
If the CFG is LL(1) then FIRST(u) ∩ FIRST(v) has to be empty
C
Both (A) and (B)
D
None of the above
       Compiler-Design       Parsers       Nielit Scientific Assistance CS 15-10-2017
Question 59 Explanation: 
The condition for a grammar to be LL(1)
Theorem: A context free grammar G=(V​ T​ , V​ N​ , S,P) is LL(1) if and if only if for every nonterminal A and every strings of symbols ⍺,β such that ⍺≠β and A → ⍺,β we have
1. First(⍺) ∩ First (β) ∩ Follow(A)=Θ.
2. If ⍺ *⇒ ε then First(β) ∩ Follow(A)= Θ.
If grammar is epsilon free then condition 2 is not required.
Now as per condition 1, for every non-terminal A, if we have A → u and A→v
And First(u) First(v) = φ and CFG is epsilon free then it must be LL(1) and if epsilon free CFG is LL(1) then it must satisfy the condition 1.
Question 60

Which of the following checks are not included in semantic analysis done by the compiler:

A
Type checks
B
Spelling checks
C
Uniquencess checks
D
Flow of control checks
       Compiler-Design       Compilers       JT(IT) 2016 PART-B Computer Science
Question 60 Explanation: 
The following tasks should be performed in semantic analysis:
1. Scope resolution
2. Type checking
3. Array-bound checking
Question 61
In a computer, keywords of a language are recognized during
A
Parsing of the program
B
Code generation
C
Lexical analysis of the program
D
Data flow diagrams
       Compiler-Design       Compilers-and-Parsers       KVS 30-12-2018 Part B
Question 61 Explanation: 
Lexical analyzer reads the characters from source code and convert it into tokens.
Different tokens or lexemes are:
→Keywords
→Identifiers
→Operators
→Constants
Question 62
Match the description of several parts of a classic optimizing compiler in List - I, with the names of those parts in List - II:
A
(a)-(iii), (b)-(iv), (c)-(ii), (d)-(i)
B
(a)-(iv), (b)-(iii), (c)-(ii), (d)-(i)
C
(a)-(ii), (b)-(iv), (c)-(i), (d)-(iii)
D
(a)-(ii), (b)-(iv), (c)-(iii), (d)-(i)
       Compiler-Design       Compilers       UGC NET CS 2017 Nov- paper-2
Question 62 Explanation: 
Parser→ A part of a compiler that is responsible for recognizing synta
Scanner→ An IR-to-IR transformer that tries to improve the IR program in some way (Intermediate representation)
Semantic Analysis→ A part of a compiler that understand the meaning of variable names and other symbols and checks that they are used in ways consistent with their definitions
Optimizer→ An IR-to-IR transformer that tries to improve the IR program in some way (Intermediate representation)
Question 63
In Distributed system, the capacity of a system to adapt the increased service load is called __________ .
A
Tolerance
B
Scalability
C
Capability
D
Loading
       Compiler-Design       Linker-Loader       UGC NET CS 2017 Nov- paper-2
Question 63 Explanation: 
→ The capacity of a system to adapt the increased service load is called scalability.
→ Scalability is the capability of a system, network, or process to handle a growing amount of work, or its potential to be enlarged to accommodate that growth.
Note: A scalable system is any system that is flexible with its number of components.
Question 64
Consider the following statements related to compiler construction :
I. Lexical Analysis is specified by context-free grammars and implemented by pushdown automata.
II. Syntax Analysis is specified by regular expressions and implemented by finite-state machine.
Which of the above statement(s) is/are correct ?
A
Only I
B
Only II
C
Both I and II
D
Neither I nor II
       Compiler-Design       Compilers       UGC NET CS 2017 Jan -paper-2
Question 64 Explanation: 
FALSE: Lexical Analysis is specified by regular grammars and implemented by finite automata.
FALSE: Syntax Analysis is specified by context-free grammars and implemented by pushdown automata.
Question 65
In compiler optimization, operator strength reduction uses mathematical identities to replace slow math operations with faster operations. Which of the following code replacements is an illustration of operator strength reduction ?
A
Replace P + P by 2 * P or Replace 3 + 4 by 7.
B
Replace P * 32 by P << 5
C
Replace P * 0 by 0
D
Replace (P << 4) – P by P * 15
       Compiler-Design       Code-Optimization       UGC NET CS 2016 Aug- paper-2
Question 65 Explanation: 
Option (A)​ is not correct because multiplication operation can be performed faster using Left-Shift(<<) operator instead of "+" operator and "3+4=7" is the example of Folding machine independent optimization method instead of operator strength reduction .
Option(B)​ is correct because here to speedup the multiplication operation, * operator is replaced by Left-Shift operator.
Option(C)​ is not correct because the method used for compiler optimization is not correct. For given statements to perform compiler optimization, we simply eliminate such statements from the code and this method of elimination is called as Algebraic Simplification.
Option(D)​ is also not correct because bitwise operator is more faster than multiplication.
Question 66
Which of the following are the principles tasks of the linker?
I. Resolve external references among separately compiled program units.
II. Translate assembly language to machine code.
III. Relocate code and data relative to the beginning of the program.
IV. Enforce access-control restrictions on system libraries
A
I and II
B
I and III
C
II and III
D
I and IV
       Compiler-Design       Linker-Loader       UGC NET CS 2016 Aug- paper-2
Question 66 Explanation: 
Linker:
A linker or link editor is a computer utility program that takes one or more object files generated by a compiler and combines them into a single executable file, library file, or another 'object' file.
Principles:
1. Resolve external references among separately compiled program units
2. Relocate code and data relative to the beginning of the program.
→ Assembler, Translate assembly language to machine code.
Question 67
In _______, the bodies of the two loops are merged together to form a single loop provided that they do not make any references to each other.
A
Loop unrolling
B
Strength reduction
C
Loop concatenation
D
Loop jamming
       Compiler-Design       Code-Optimization       UGC NET CS 2016 July- paper-2
Question 67 Explanation: 
Loop Unrolling:​ Loop unrolling refers to method of decreasing the number of time a loop is executed.
Strength reduction:​ It is a machine independent code optimization technique in which a costly operation(operation which takes more time to execute) is replaced with the cheaper. operation(operation which takes less execution time)
Loop Jamming:​ It is a loop optimization technique in which bodies of two loops are combined together to decrease the number of loops.
Question 68
​Which of the following is not typically a benefit of dynamic linking?
I. Reduction in overall program execution time.
II. Reduction in overall space consumption in memory.
III. Reduction in overall space consumption on disk.
IV. Reduction in the cost of software updates.
A
I and IV
B
I only
C
II and III
D
IV only
       Compiler-Design       Linker-Loader       UGC NET CS 2016 July- paper-2
Question 68 Explanation: 
TRUE: Reduction in overall program execution time.
FALSE: Reduction in overall space consumption in memory.
FALSE: Reduction in overall space consumption on disk.
FALSE: Reduction in the cost of software updates.
Note: Except statement-I remaining all statements are not related to dynamic linking.
Question 69
Which of the following is FALSE?
A
The grammar S → a Sb |bSa|SS|∈, where S is the only non-terminal symbol and ∈ is the null string, is ambiguous.
B
SLR is powerful than LALR.
C
An LL(1) parser is a top-down parser.
D
YACC tool is an LALR(1) parser generator.
       Compiler-Design       Parsers       UGC NET CS 2016 July- paper-2
Question 69 Explanation: 
A grammar is said to be ambiguous if and only if it can generate parse trees of both ​ Left ​ Most Derivation or Right Most Derivation.
In this grammar we are having two different parse trees For string "aabb" using leftmost derivation only.

Statement B is wrong because in LALR we use lookahead symbols to put the reduce entries into the parsing table. Because of which number of blank entries in LALR parser are more than that of SLR parser which in turn increases the error detection capability of LALR parser. So LALR parser is more powerful than SLR.
Statement C is true because LL(1) parser is a top-down parser
Statement D is also true because YACC(Yet Another Compiler Compiler) is a tool which generates LALR parser for a given grammar.
Question 70
Loop unrolling is a code optimization technique:
A
that avoids tests at every iteration of the loop.
B
that improves performance by decreasing the number of instructions in a basic block.
C
that exchanges inner loops with outer loops
D
that reorders operations to allow multiple computations to happen in parallel
       Compiler-Design       Code-Optimization       UGC NET CS 2015 Dec- paper-2
Question 70 Explanation: 
→ Loop unrolling is a code optimization technique that avoids tests at every iteration of the loop.
→ The goal of loop unwinding is to increase a program's speed by reducing (or) eliminating instructions that control the loop, such as pointer arithmetic and "end of loop" tests on each iteration.
Question 71
The translator which performs macro calls expansion is called:
A
Macro processor
B
Micro preprocessor
C
Macro preprocessor
D
Dynamic Linker
       Compiler-Design       Pre-Processor       UGC NET CS 2015 Jun- paper-2
Question 71 Explanation: 
→ The C preprocessor is a macro preprocessor (allows you to define macros) that transforms your program before it is compiled. These transformations can be inclusion of header file, macro expansions,etc,...
→ All preprocessing directives begins with a # symbol. For example,
#define PI 3.14
Question 72
Which one from the following is false?
A
LALR parser is Bottom up parser
B
A parsing algorithm which performs a left to right scanning and a right most deviation is RL (1)
C
LR parser is Bottom up parser.
D
In LL(1), the 1 indicates that there is a one - symbol look - ahead.
       Compiler-Design       Parsers       UGC NET CS 2015 Jun- paper-2
Question 72 Explanation: 
TRUE: LALR parser is Bottom up parsers.
TRUE: LR parser is Bottom up parser. It has SLR, LALR and SLR.
TRUE: In LL(1), the 1 indicates that there is a one - symbol look - ahead.
FALSE: A parsing algorithms scans right to left and reverse order.
Question 73
Which phase of compiler generates stream of atoms?
A
Syntax Analysis
B
Lexical Analysis
C
Code Generation
D
Code Optimization
       Compiler-Design       Phases-of-Compilers       UGC NET CS 2015 Jun- paper-2
Question 73 Explanation: 
Syntax analysis: understanding the structure of the source code
1. Tokenizing: creating a stream of “atoms”
2. Parsing: matching the atom stream with the language grammar
XML output = one way to demonstrate that the syntax analyzer works
Question 74
Which activity is not included in the first pass of two pass assemblers ?
A
Build the symbol table
B
Construct the intermediate code
C
Separate mnemonic opcode and operand fields
D
None of the above
       Compiler-Design       Assembler       UGC NET CS 2004 Dec-Paper-2
Question 74 Explanation: 
Two Pass Assemblers:
Pass-1:
1. Assign addresses to all statements in the program
2. Save the values assigned to all labels for use in Pass2
3. Perform some processing of assembler directives
Pass-2:
1. Assemble instructions Generate data values defined by BYTE,WORD
2. Perform processing of assembler directives not done in Pass 1
3. Write the object program and the assembly listing
Question 75
Code optimization is responsibility of :
A
Application programmer
B
System programmer
C
Operating system
D
All of the above
       Compiler-Design       Code-Optimization       UGC NET CS 2004 Dec-Paper-2
Question 75 Explanation: 
Code optimization is responsibility of system programmer.
Question 76
Which activity is included in the first pass of two pass assemblers ?
A
Build the symbol table
B
Construct the intermediate code
C
Separate mnemonic opcode and operand fields
D
None of these
E
A,B and C
       Compiler-Design       Assembler       UGC NET CS 2004 Dec-Paper-2
Question 76 Explanation: 
Two Pass Assemblers:
Pass-1:
1. Assign addresses to all statements in the program
2. Save the values assigned to all labels for use in Pass2
3. Perform some processing of assembler directives
Pass-2:
1. Assemble instructions Generate data values defined by BYTE,WORD
2. Perform processing of assembler directives not done in Pass-1
3. Write the object program and the assembly listing.
Activities:
1. Build the symbol table
2. Construct the intermediate code
3. Separate mnemonic opcode and operand fields
Question 77
In two pass assembler the symbol table is used to store :
A
Label and value
B
Only value
C
Mnemonic
D
Memory Location
       Compiler-Design       Assembler       UGC NET CS 2004 Dec-Paper-2
Question 77 Explanation: 
In two pass assembler the symbol table is used to store memory location.
Question 78
A Top-down Parser generates :
A
Leftmost derivation
B
Rightmost derivation
C
Rightmost derivation in reverse
D
Leftmost derivation in reverse
       Compiler-Design       Parsers       UGC NET CS 2005 Dec-Paper-2
Question 78 Explanation: 
→ Top-down parsing can be viewed as an attempt to find leftmost derivations of an input-stream by searching for parse-trees using a top-down expansion of the given formal grammar rules.
→ Inclusive choice is used to accommodate ambiguity by expanding all alternative right-hand-sides of grammar rules.
Question 79
A general macroprocessor is an in built function of :
A
Loader
B
Linker
C
Editor
D
Assembler
       Compiler-Design       Assembler       UGC NET CS 2005 Dec-Paper-2
Question 79 Explanation: 
→ A macro processor is a program that copies a stream of text from one place to another, making a systematic set of replacements as it does so.
→ Macro processors are often embedded in other programs, such as assemblers and compilers. Sometimes they are standalone programs that can be used to process any kind of text.
Question 80
Which activities is not included in the first pass of two pass assembler ?
A
build the symbol table
B
construct the Intermediate code
C
separate mnemonic opcode and operand field.
D
none of these
       Compiler-Design       Assembler       UGC NET CS 2005 Dec-Paper-2
Question 80 Explanation: 
Two Pass Assemblers:
Pass-1:
1. Assign addresses to all statements in the program
2. Save the values assigned to all labels for use in Pass2
3. Perform some processing of assembler directives
Pass-2:
1. Assemble instructions Generate data values defined by BYTE,WORD
2. Perform processing of assembler directives not done in Pass 1
3. Write the object program and the assembly listing
Question 81
Which of the statements related to Compilers is wrong ?
A
Lexical analysis is breaking the input into tokens
B
Syntax analysis is for parsing the phrase
C
Syntax analysis is for analyzing the semantic
D
None of these
       Compiler-Design       Compilers       UGC NET CS 2005 june-paper-2
Question 81 Explanation: 
TRUE: Lexical analysis is breaking the input into tokens
TRUE: Syntax analysis is for parsing the phrase
FALSE: Syntax analysis is for analyzing the semantic. For analysing semantics we are using semantic analysis but not syntax analysis
Question 82
The dynamic binding occurs during the :
A
Compile time
B
Run time
C
Linking time
D
Pre-processing time.
       Compiler-Design       Run-Time-Environment       UGC NET CS 2005 june-paper-2
Question 82 Explanation: 
The dynamic binding occurs during the run time. The method being called upon an object or the function being called with arguments is looked up by name at runtime.
Question 83
Symbol Table can be used for :
A
Checking type compatibility
B
Suppressing duplication of error message
C
Storage allocation
D
All of these
       Compiler-Design       Symbol-Table       UGC NET CS 2005 june-paper-2
Question 83 Explanation: 
A symbol table can be used for
1. To store the names of all entities in a structured form at one place.
2. To verify if a variable has been declared.
3. To implement type checking, by verifying assignments and expressions in the source code are semantically correct.
4. To determine the scope of a name (scope resolution).
Question 84
A compiler for a high level language that runs on one machine and produces code for a different machine is called :
A
Optimizing
B
One pass compiler
C
Cross compiler
D
Multipass compiler
       Compiler-Design       Compilers       UGC NET CS 2006 Dec-paper-2
Question 84 Explanation: 
→ Incremental compiler: The compiler which compiles only the changed lines from the source code and update the object code
→ Threaded code compiler: The compiler which simply replace a string by an appropriate binary code.
→ Cross compiler: The compiler used to compile a source code for different kinds platform.
**One pass assembler and two pass assemblers are available.
Question 85
The ‘K’ in LR(R) cannot be :
A
0
B
1
C
2
D
None of these
       Compiler-Design       Parsers       UGC NET CS 2006 Dec-paper-2
Question 85 Explanation: 
→ The name LR is often followed by a numeric qualifier, as in LR(1) or sometimes LR(k). To avoid backtracking or guessing, the LR parser is allowed to peek ahead at k lookahead input symbols before deciding how to parse earlier symbols.
→ Typically k is 1 and is not mentioned. The name LR is often preceded by other qualifiers, as in SLR and LALR. The LR(k) condition for a grammar was suggested by Knuth to stand for "translatable from left to right with bound k."
Question 86
Peer-hole optimization is a form of :
A
loop optimization
B
local optimization
C
constant folding
D
data flow analysis
       Compiler-Design       Code-Optimization       UGC NET CS 2006 Dec-paper-2
Question 86 Explanation: 
→ Peephole optimization is a kind of optimization performed over a very small set of instructions in a segment of generated code. The set is called a "peephole" or a "window". It works by recognizing sets of instructions that can be replaced by shorter or faster sets of instructions.
Common techniques:
Null sequences
Combine operations
Algebraic laws
Special case instructions
Address mode operations
Constant folding
Question 87
A permanent database of a general model of compiler is ____________ .
A
Identifier table
B
Page map table
C
Literal table
D
Terminal table
       Compiler-Design       Compilers       UGC NET CS 2006 Dec-paper-2
Question 87 Explanation: 
A permanent database of a general model of compiler is terminal table. A permanent database that has entry for each terminal symbols such as arithmetic operators, keywords, punctuation characters such as ‘;’, ‘,’etc Fields: Name of the symbol.
Question 88
Tasks done in parsing are :
A
Check the validity of a source string
B
Determine the syntactic structure of a source string
C
Both (A) and (B)
D
None of these
       Compiler-Design       Parsers        UGC NET CS 2006 June-Paper-2
Question 88 Explanation: 
Tasks done in parsing are check the validity of a source string and determine the syntactic structure of a source string.
Question 89
YACC builds up __________ parsing table.
A
LALR
B
LR
C
SLR
D
LLR
       Compiler-Design       Parsers       UGC NET CS 2006 June-Paper-2
Question 89 Explanation: 
Yacc (Yet Another Compiler-Compiler):
It is a Look Ahead Left-to-Right (LALR) parser generator, generating a parser, the part of a compiler that tries to make syntactic sense of the source code, specifically a LALR parser, based on an analytic grammar written in a notation similar to Backus–Naur Form (BNF).
**YACC builds up LALR parsing table.
Question 90
The action of passing the source program into the proper syntactic class is known as :
A
Syntax analysis
B
Lexical analysis
C
Interpretation analysis
D
Uniform symbol generation
       Compiler-Design       Parsers       UGC NET CS 2006 June-Paper-2
Question 90 Explanation: 
Lexical analysis is the first phase of a compiler. It takes the modified source code from language preprocessors that are written in the form of sentences. The lexical analyzer breaks these syntaxes into a series of tokens, by removing any whitespace or comments in the source code.
Question 91
The dynamic binding occurs during the :
A
Compile time
B
Run time
C
Linking time
D
Pre - processing time
       Compiler-Design       Run-Time-Environment       UGC NET CS 2006 June-Paper-2
Question 91 Explanation: 
The dynamic binding occurs during the run time. The method being called upon an object or the function being called with arguments is looked up by name at runtime.
Question 92
Shift-Reduce parsers perform the following :
A
Shift step that advances in the input stream by K(K > 1) symbols and Reduce step that applies a completed grammar rule to some recent parse trees, joining them together as one tree with a new root symbol.
B
Shift step that advances in the input stream by one symbol and Reduce step that applies a completed grammar rule to some recent parse trees, joining them together as one tree with a new root symbol.
C
Shift step that advances in the input stream by K(K = 2) symbols and Reduce step that applies a completed grammar rule to form a single tree.
D
Shift step that does not advance in the input stream and Reduce step that applies a completed grammar rule to form a single tree.
       Compiler-Design       Parsers       UGC NET CS 2014 Dec-Paper-2
Question 92 Explanation: 
Shift-Reduce parsers perform shift step that advances in the input stream by one symbol and Reduce step that applies a completed grammar rule to some recent parse trees, joining them together as one tree with a new root symbol.
Question 93
Which of the following is true ?
A
Canonical LR parser is LR (1) parser with single look ahead terminal
B
All LR(K) parsers with K > 1 can be transformed into LR(1) parsers.
C
Both (A) and (B)
D
None of the above
       Compiler-Design       Parsers       UGC NET CS 2014 Dec-Paper-2
Question 93 Explanation: 
TRUE: Canonical LR parser is LR (1) parser with single look ahead terminal
TRUE: All LR(K) parsers with K > 1 can be transformed into LR(1) parsers.
Question 94
In a two-pass assembler, symbol table is
A
Generated in first pass
B
Generated in second pass
C
Not generated at all
D
Generated and used only in second pass
       Compiler-Design       Symbol-table       UGC NET CS 2014 Dec-Paper-2
Question 94 Explanation: 
→ In a two-pass assembler, symbol table is generated in first pass.
→ The first pass of the assembler reads and processes the assembly program one line at a time. In processing a single line of the assembly program the assembler can make addition(s) to the symbol table, add a (possibly partial) SML instruction to the Simpletron's memory.
→ The purpose of the second pass is to complete the partial instructions written in the first pass.
Question 95
Debugger is a program that
A
allows to examine and modify the contents of registers
B
does not allow execution of a segment of program
C
allows to set breakpoints, execute a segment of program and display contents of register
D
All of the above
       Compiler-Design       Debugger       UGC NET CS 2014 Dec-Paper-2
Question 95 Explanation: 
Debugger is a program that allows to set breakpoints, execute a segment of program and display contents of register.
Question 96
A grammar G is LL(1) if and only if the following conditions hold for two distinct productions A → α | β
  1. First (α) ∩ First (β) ≠ {a} where a is some terminal symbol of the grammar.
  2. First (α) ∩ First (β) ≠ λ
III. First (α) ∩ Follow (A) = φ if λ ∈ First (β)
A
I and II
B
I and III
C
II and III
D
I, II and III
       Compiler-Design       Parsers       UGC NET CS 2014 June-paper-2
Question 96 Explanation: 
A grammar G is LL(1) if and only if the following conditions hold for two distinct productions:
A → α | β
1. First (α) and First (β) must be disjoint if none of α and β contains NULL move.
2. At most one of the strings α or β can drive NULL move i.e. α → NULL(since First (α) and First (β) are disjoint). In this case, First (β) and Follow(A) must be disjoint.
Hence the answer is option(D).
Question 97
Which of the following suffices to convert an arbitrary CFG to an LL(1) grammar ?
A
Removing left recursion alone
B
Removing the grammar alone
C
Removing left recursion and factoring the grammar
D
None of the above
       Compiler-Design       Parsers       UGC NET CS 2014 June-paper-2
Question 97 Explanation: 
→ Left recursion removing (or) factoring the given grammar are not sufficient to convert an arbitrary CFG to an LL(1) grammar.
→ To convert an arbitrary CFG to an LL(1) grammar we need to remove the left recursion and as well as left factoring without that we cannot convert.
Question 98
A shift reduce parser suffers from
A
shift reduce conflict only
B
reduce reduce conflict only
C
both shift reduce conflict and reduce reduce conflict
D
shift handle and reduce handle conflicts
       Compiler-Design       Parsers       UGC NET CS 2014 June-paper-2
Question 98 Explanation: 
→ A shift-reduce parser scans and parses the input text in one forward pass over the text, without backing up. (That forward direction is generally left-to-right within a line, and top-to-bottom for multi-line inputs.) The parser builds up the parse tree incrementally, bottom up, and left to right, without guessing or backtracking.
A shift-reduce parser works by doing some combination of Shift steps and Reduce steps, hence the name.
→ A Shift step advances in the input stream by one symbol. That shifted symbol becomes a new single-node parse tree.
→ A Reduce step applies a completed grammar rule to some of the recent parse trees, joining them together as one tree with a new root symbol.
*** A shift reduce parser suffers from both shift reduce conflict and reduce reduce conflict.
Question 99
The grammar S ⟶ (S) | SS | ∈ is ​ not​ suitable for predictive parsing because the grammar is
A
An Operator Grammar
B
Right Recursive
C
Left Recursive
D
Ambiguous
       Compiler-Design       Parsers       UGC NET CS 2018-DEC Paper-2
Question 99 Explanation: 
The grammar is ambiguous, as to derive string ()()() more than one parse tree exists.
Question 100
Consider the following Grammar G :
S ➝ A | B
A➝ a | c
B➝ b | c
Where {S,A,B} is the set of non-terminals, {a,b,c} is the set of terminals.
Which of the following statement(s) is/are correct ?
S​ 1​ : LR(1) can parse all strings that are generated using grammar G.
S​ 2​ : LL(1) can parse all strings that are generated using grammar G.
A
Both S​ 1​ and S​ 2
B
Only S​ 2
C
Neither S​ 1​ nor S​ 2
D
Only S​ 1
       Compiler-Design       Parsers       UGC NET CS 2018-DEC Paper-2
Question 100 Explanation: 
For generating string “c” we have two different parse trees.

Since the grammar is Ambiguous so the strings generated by the grammar G can’t be parsed by LR(1) or LL(1) parser.
Question 101
Consider the following two Grammars :
G1 : S → SbS|a
G2 : S → aB|ab, A→GAB|a, B→ABb|b
Which of the following option is correct ?
A
Only G1 is ambiguous
B
Only G2 is ambiguous
C
Both G1 and G2 are ambiguous
D
Both G1 and G2 are not ambiguous
       Compiler-Design       Ambiguous-and-Unambiguous-Grammar       UGC NET CS 2018 JUNE Paper-2
Question 101 Explanation: 
A grammar is said to be ambiguous if we get two different parse trees using either Leftmost derivation only or Rightmost derivation only.
To generate string “ababa” using G1 grammar the two different parse tree possible are:
Question 102
A bottom-up parser generates :
A
Leftmost derivation in reverse
B
Right-most derivation in reverse
C
Left-most derivation
D
Right-most derivation
       Compiler-Design       Parsers       UGC NET CS 2018 JUNE Paper-2
Question 102 Explanation: 
A bottom-up parser uses Right-most derivation in reverse order to decide “What to Reduce”.
Question 103
In compiler design ‘reducing the strength’ refers to
A
reducing the range of values of input variables.
B
code optimization using cheaper machine instructions.
C
reducing efficiency of program.
D
None of the above
       Compiler-Design       Compilers       UGC NET CS 2012 Dec-Paper-2
Question 103 Explanation: 
In compiler design ‘reducing the strength’ refers to code optimization using cheaper machine instructions.
Example:
Dividing by 2→ Use right shift by 2.
Multiplication by 2→ Use left shift by 2.
Question 104
Given the following expressions of a grammar
E → E * F / F + E / F
F → F – F / id
Which of the following is true ?
A
* has higher precedence than +
B
– has higher precedence than *
C
+ and – have same precedence
D
+ has higher precedence than *
       Compiler-Design       Grammars       UGC NET CS 2012 Dec-Paper-2
Question 104 Explanation: 
The operator which is in low level that can have high preference.
Order of precedence is *, +, -.
Here * and + have equal preference, '-' can have higher precedence than + and *.
Question 105
Which of the following is true while converting CFG to LL(I) grammar ?
A
Remove left recursion alone
B
Factoring grammar alone
C
Both of the above
D
None of the above
       Compiler-Design       Parsers       UGC NET CS 2012 Dec-Paper-2
Question 105 Explanation: 
→ A grammar could be LL(1) if and only if it is unambiguous and is not left recursive and left factoring grammar.
→ Since for converting a grammar to LL(1) 3 conditions mentioned above are required.
→ Unambiguous grammar is not mentioned in options. So option (D) is the correct.
Question 106
Which of the following is the most powerful parsing method ?
A
LL(I)
B
Canonical LR
C
SLR
D
LALR
       Compiler-Design       Parsers       UGC NET CS 2012 Dec-Paper-2
Question 106 Explanation: 
Canonical LR is most powerful.
LR > LALR > SLR.
But real time compilers using LALR only
Question 107
Given the following statements :
S1: SLR uses follow information to guide reductions. In case of LR and LALR parsers, the lookaheads are associated with the items and they make use of the left context available to the parser.
S2: LR grammar is a larger subclass of context free grammar as compared to that SLR and LALR grammars.
Which of the following is true ?
A
S1 is not correct and S2 is not correct.
B
S1 is not correct and S2 is correct.
C
S1 is correct and S2 is not correct.
D
S1 is correct and S2 is correct.
       Compiler-Design       Parsers       UGC NET CS 2013 Dec-paper-2
Question 108
Which of the following derivations does a top-down parser use while parsing an input string? The input is scanned from left to right.
A
Leftmost derivation
B
Leftmost derivation traced out in reverse
C
Rightmost derivation traced out in reverse
D
Rightmost derivation
       Compiler-Design       Parsers       UGC NET CS 2013 Dec-paper-2
Question 108 Explanation: 
→ Top down parsers using leftmost derivation and the input is scanned from left to right.
→ Bottom up parsers using rightmost derivation in reverse.
Question 109
The scheme of which interpreter translates the source program is known as
A
Paragraph by paragraph
B
Instruction by instruction
C
Line by line
D
None of the above
       Compiler-Design       Interpreter       UGC NET CS 2011 June-Paper-2
Question 109 Explanation: 
→ Compiler translates the entire source program into once. So, it is faster than interpreter.
→ Interpreter translates the source program into line by line. So, it is slower than compiler.
Question 110
Portable program means
A
Program with wheels
B
Independent from its authors
C
Independent of platform
D
None of the above
       Compiler-Design       Compilers       UGC NET CS 2011 June-Paper-2
Question 110 Explanation: 
Portable program means independent of platform. We can run same program in any operating system like windows,linux,unix,etc..,
Question 111
In which way(s) a macro processor for assembly language can be implemented ?
A
Independent two-pass processor
B
Independent one-pass processor
C
Expand macro calls and substitute arguments
D
All of the above
       Compiler-Design       Assembler       UGC NET CS 2011 June-Paper-2
Question 111 Explanation: 
Different ways a macro processor for assembly language can be implemented.
1. Independent two-pass processor
2. Independent one-pass processor
3. Expand macro calls and substitute arguments
Question 112
Given the production rules of a grammar G1 as
S1 → AB | aaB
A → a | Aa
B → b
and the production rules of a grammar G2 as
S2 → aS2bS2 | bS2aS2 | λ
Which of the following is correct statement ?
A
G1 is ambiguous and G2 is not ambiguous.
B
G1 is ambiguous and G2 is ambiguous.
C
G1 is not ambiguous and G2 is ambiguous.
D
G1 is not ambiguous and G2 is not ambiguous.
       Compiler-Design       Ambiguous-and-Unambiguous-Grammar       UGC NET CS 2013 June-paper-2
Question 112 Explanation: 

Question 113
Given a grammar : S1 → Sc, S → SA | A, A → aSb | ab, there is a rightmost derivation
     S1 ⇒ Sc ⇒ SAC ⇒ SaSbc
Thus, SaSbc is a right sentential form, and its handle is
A
SaS
B
bc
C
Sbc
D
aSb
       Compiler-Design       Handles       UGC NET CS 2013 June-paper-2
Question 113 Explanation: 
A “handle” of a string is a substring that matches the RHS of a production and whose reduction to the non-terminal (on the LHS of the production) represents one step along the reverse of a rightmost derivation toward reducing to the start symbol.
And in above question aSb is a handle because it's reduction to the LHS of production A → aSb represents one step along the reverse of a rightmost derivation toward reducing to the start symbol.
Question 114
The equivalent production rules corresponding to the production rules S → Sα1 | Sα2 | β1 | β2 is
A
S → β1 | β2, A → α1A | α2A | λ
B
S → β1| β2 | β1A | β2A, A → α1A | α2A
C
S → β1 | β2, A → α1A | α2A
D
S → β1 | β2 | β1A | β2A, A → α1A | α2A | λ
       Compiler-Design       Grammars       UGC NET CS 2013 June-paper-2
Question 114 Explanation: 
Given grammar can generate { β1, β2 , β2α2, , β2 α1, , β1α2, , β1α1 , β1 α1α2..................}
Option A can generate only {β1, β2} so it is not a correct option.
Option B is not correct because it have no terminating point strings containing {α1 , α2}
Option C is not correct because it can generate only {β1, β2}
Option D is correct answer because it can generate all the strings generated by given grammar.
Question 115
Which is the correct statement(s) for Non Recursive predictive parser ?
S1 : First(α) = { t | α⇒ *tβ for some string β}⇒ *tβ
S2 : Follow(X) = { a | S⇒ *αXaβ for some strings α and β}
A
Both statements S1 and S2 are incorrect.
B
S1 is incorrect and S2 is correct.
C
S1 is correct and S2 is incorrect.
D
Both statements S1 and S2 are correct.
       Compiler-Design       Parsers       UGC NET CS 2013 June-paper-2
Question 115 Explanation: 
Statement-1: → See the symbol (⇒ *) means after some step , here * represent an arbitrary number of steps. * is not part of terminal.
→ So if alpha after some step has t as first symbol (terminal) in some sentential form , then first(alpha) must be {t}
Statement-2:
α→∗tβ Here First(α) = {*} .
S→∗αXaβ
Follow(X) = {a}
So Statement S2 is correct.
Question 116
‘Macro’ in an assembly level program is _______.
A
sub program
B
a complete program
C
a hardware portion
D
relative coding
       Compiler-Design       Macros       UGC NET CS 2010 Dec-Paper-2
Question 116 Explanation: 
→ A macro is a sequence of instructions, assigned by a name and could be used anywhere in the program.
→ A macro is an extension to the basic ASSEMBLER language. They provide a means for generating a commonly used sequence of assembler instructions/statements.
→ The sequence of instructions/statements will be coded ONE time within the macro definition. Whenever the sequence is needed within a program, the macro will be "called".
Question 117
Grammar of the programming is checked at ________ phase of compiler
A
semantic analysis
B
code generation
C
syntax analysis
D
code optimization
       Compiler-Design       Phases-of-Compilers       UGC NET CS 2010 Dec-Paper-2
Question 117 Explanation: 
→ Grammar of the programming is checked at syntax phase of compiler.
→ logical errors will checked in semantic analysis.
→ Code optimization and code generation is not related to checking errors. It is reducing statement or performing optimization.
Question 118
Macro-processors are ______.
A
Hardware
B
Compiler
C
Registers
D
None of the above
       Compiler-Design       Macros       UGC NET CS 2010 Dec-Paper-2
Question 118 Explanation: 
→ A macro processor is a program that copies a stream of text from one place to another, making a systematic set of replacements as it does so.
→ Macro processors are often embedded in other programs, such as assemblers and compilers.
Question 119
Which of the following expression is represented by the parse tree ?

A
(A + B) * C
B
A + * BC
C
A + B * C
D
A * C + B
       Compiler-Design       Parsers       UGC NET CS 2010 June-Paper-2
Question 119 Explanation: 
Parse tree is always following inorder traversal. It visit left,root and right.

Question 120
Consider the following left associative operators in decreasing order of precedence :
– subtraction (highest precedence)
* multiplication
$ exponentiation (lowest precedence)
What is the result of the following expression ?
3 – 2 * 4 $ | * 2**3
A
– 61
B
64
C
512
D
4096
       Compiler-Design       Compiler-Design       UGC NET CS 2010 June-Paper-2
Question 120 Explanation: 
Actually they are given in wrong order.
But according to given question, we are giving precedence is
(((3 – 2) *) 4 $ | * (2**3))
Step-1: 3-2=1
Step-2: 1*4=4
Step-3: 2*3=6
Step-4: 46=4096
Note: When we are assuming ** is single(*) and there is no |* are useless symbols.
Question 121
Which of the following is used for grouping of characters into tokens(in a computer)?
A
A parser
B
Code optimizer
C
Code generator
D
Scanner
       Compiler-Design       Phases-of-Compilers       UGC NET CS 2010 June-Paper-2
Question 121 Explanation: 
Lexical analysis(or Scanner) used for grouping of characters into tokens.
Question 122
A compiler that runs on one machine and produces code for a different machine is called:
A
Cross compilation
B
One pass compilation
C
Two pass compilation
D
None of the above
       Compiler-Design       Compilers       UGC NET CS 2009-June-Paper-2
Question 122 Explanation: 
Cross compiler: The compiler used to compile a source code for different kinds platform.
Note: We have an one and two pass assemblers but not compilers.
Question 123
In an absolute loading scheme which loader function is accomplished by assembler ?
A
re-allocation
B
allocation
C
linking
D
loading
       Compiler-Design       Compilers       UGC NET CS 2009 Dec-Paper-2
Question 123 Explanation: 
→ Loader loads the executable code into memory, program and data stack are created, register gets initialized.
→ Re-allocation is an absolute loading scheme which loader function is accomplished by assembler
Question 124
Which of the following grammar is LR (1) ?
A
A → a A b, A → b A b, A → a , A →b
B
A → a A a, A → a A b, A → c
C
A → A + A, A → a
D
Both (A) and (B)
       Compiler-Design       Parsers       UGC NET CS 2009 Dec-Paper-2
Question 124 Explanation: 
LR(1)is default name of CLR(1). Hence LR(1) and CLR(1) is same.
Option(A):
Since here we are having no Reduce-reduce OR shift-reduce conflict so it is CLR(1).




Question 125
A shift-reduce parser carries out the actions specified within braces immediately after reducing with the corresponding rule of the grammar.
S → x x W [ print “1”]
S → y [print “2”]
W → S2 [print “3”]
what is the translation of “x x x x y z z” ?
A
1 1 2 3 1
B
1 1 2 3 3
C
2 3 1 3 1
D
2 3 3 2 1
       Compiler-Design       Syntax-Directed-Translation       UGC NET CS 2009 Dec-Paper-2
Question 125 Explanation: 

⇒ 23131
SR is bottom up parser.
Note : Instead of Sz they given S2 and what operation will perform they are not mentioned
Question 126
Synthesized attribute can be easily simulated by a
A
LL grammar
B
Ambiguous grammar
C
LR grammar
D
None of the above
       Compiler-Design       Synthesized-Attribute       UGC NET CS 2009 Dec-Paper-2
Question 126 Explanation: 
→ Synthesized Attributes are such attributes that depend only on the attribute values of children nodes. It can be easily simulated by LR grammar
→ Inherited Attributes are such attributes that depend on parent and/or siblings attributes.
Question 127
Which of the following are Assembler Directives ?
(i) EQU
(ii) ORIGIN
(iii) START
(iv) END
A
(ii), (iii) and (iv)
B
(i), (iii) and (iv)
C
(iii) and (iv)
D
(i), (ii), (iii) and (iv)
       Compiler-Design       Assembler       UGC NET CS 2008 Dec-Paper-2
Question 127 Explanation: 
Basic Assembly directives:
1. EQU→ Equate
2. ORIGIN→ Origin
3. START→ Start
4. END→ End
Question 128
Assembler program is :
A
dependent on the operating system
B
dependent on the compiler
C
dependent on the hardware
D
independent of the hardware
       Compiler-Design       Assembler       UGC NET CS 2008-june-Paper-2
Question 128 Explanation: 
→ Assembler program is dependent on the hardware.
→ An assembler program creates object code by translating combinations of mnemonics and syntax for operations and addressing modes into their numerical equivalents.
Question 129
At the end of parsing,
A
tokens are identified.
B
set of instructions are identified.
C
the syntactic groups are identified.
D
machine instructions are identified
       Compiler-Design       Parsers       UGC NET CS 2008-june-Paper-2
Question 129 Explanation: 
At end of parsing whether it is syntactically correct or not is identified So at end of parsing
1. tokens are identified
2. whether the given code is syntactically correct or not is identified.
Question 130
Dead-code elimination in machine code optimization refers to :
A
removal of all labels.
B
removal of values that never get used.
C
removal of function which are not involved.
D
removal of a module after its use.
       Compiler-Design       Code-Optimization       UGC NET CS 2008-june-Paper-2
Question 130 Explanation: 
→ Dead code elimination in machine code optimization refers to removal of values that never get used.
→ Dead code includes code that can never be executed (unreachable code), and code that only affects dead variables (written to, but never read again), that is, irrelevant to the program.
Question 131
A parse tree is an annotated parse tree if :
A
it shows attribute values at each node.
B
there are no inherited attributes.
C
it has synthesized nodes as terminal nodes.
D
every non-terminal nodes is an inherited attribute.
       Compiler-Design       Parsers       UGC NET CS 2008-june-Paper-2
Question 131 Explanation: 
A parse tree is an annotated parse tree if it shows attribute values at each node.
Features:
1. High level specification
2. Hides implementation details
3. Explicit order of evaluation is not specified
Question 132
In a two pass compiler, during the first pass :
A
user defined address symbols are correlated with their binary equivalent
B
the syntax of the statement is checked and mistakes, if any, are listed
C
object program is generated
D
semantic of the source program is elucidated.
       Compiler-Design       Compilers       UGC NET CS 2007-Dec-Paper-2
Question 132 Explanation: 
→ In a two pass compiler, during the first pass, user defined address symbols are correlated with their binary equivalent.
→ During first pass in two pass compilers contain lexical,syntactic,semantic and intermediate code generator are in front end.
→ During second pass in two pass compilers contain code optimization and code generator are in back end.
Question 133
A single instruction in an assembly language program contains :
A
one micro operation
B
one macro operation
C
one instruction to be completed in a single pulse
D
one machine code instruction
       Compiler-Design       Compilers       UGC NET CS 2007-Dec-Paper-2
Question 133 Explanation: 
A single instruction in an assembly language program contains one macro operation.
Question 134
Absolute loader demands that the programmer needs to know the :
A
start address of the available main memory
B
total size of the program
C
actual address of the data location
D
absolute values of the operands used
       Compiler-Design       Linker-Loader       UGC NET CS 2007-Dec-Paper-2
Question 134 Explanation: 
Absolute loader demands that the programmer needs to know the start address of the available main memory.
Question 135
Top-down parsers are predictive parsers, because :
A
next tokens are predicted.
B
length of the parse tree is predicted beforehand
C
lowest node in the parse tree is predicted.
D
next lower level of the parse tree is predicted.
       Compiler-Design       Parsers       UGC NET CS 2007-Dec-Paper-2
Question 135 Explanation: 
→ Top-down parsers are predictive parsers, because next tokens are predicted.
→ Predictive parser is a recursive descent parser, which has the capability to predict which production is to be used to replace the input string.
→ The predictive parser does not suffer from backtracking.
→ Predictive parsing uses a stack and a parsing table to parse the input and generate a parse tree.
Question 136
In the context of compiler design, “reduction in strength” refers to :
A
code optimization obtained by the use of cheaper machine instructions
B
reduction in accuracy of the output
C
reduction in the range of values of input variables
D
reduction in efficiency of the program
       Compiler-Design       Code-Optimization       UGC NET CS 2007-Dec-Paper-2
Question 136 Explanation: 
In the context of compiler design, “reduction in strength” refers to code optimization obtained by the use of cheaper machine instructions.
Question 137
The parsing technique that avoids backtracking is :
A
Top - down parsing
B
Recursive - descent parsing
C
Predicative
D
Syntax tree
       Compiler-Design       Parsers       UGC NET CS 2007 June-Paper-2
Question 137 Explanation: 
→ Top-down parsers are predictive parsers, because next tokens are predicted.
→ Predictive parser is a recursive descent parser, which has the capability to predict which production is to be used to replace the input string.
→ The predictive parser does not suffer from backtracking.
→ Predictive parsing uses a stack and a parsing table to parse the input and generate a parse tree.
Question 138
A Top down Parser generates :
A
Rightmost derivation.
B
Rightmost derivation, in reverse.
C
Leftmost derivation.
D
Leftmost derivation in reverse.
       Compiler-Design       Parsers       UGC NET CS 2007 June-Paper-2
Question 138 Explanation: 
→ A Top down Parser generates leftmost derivation.
→ A bottom up parser generates rightmost derivation, in reverse.
Question 139
Symbol table can be used for :
A
Checking type compatibility
B
Suppressing duplication of error message
C
Storage allocation
D
All of these above
       Compiler-Design       Symbol-Table       UGC NET CS 2007 June-Paper-2
Question 139 Explanation: 
Symbol table can be used for
1. Checking type compatibility
2. Suppressing duplication of error message
3. Storage allocation
Question 140
Heap allocation is required for languages that
A
use dynamic scope rules
B
support dynamic data structures
C
support recursion
D
support recursion and dynamic data structures
       Compiler-Design       Run-Time-Environment       UGC NET CS 2017 Nov- paper-3
Question 140 Explanation: 
→ Heap allocation is required for languages that support dynamic data structures. The heap is managed via calls to new, delete, callac, realloc, malloc, free, etc.
→ Stack allocation is required for local variables. Space on the stack is reserved for local variables when they are declared.
There are 140 questions to complete.
PHP Code Snippets Powered By : XYZScripts.com