Compiler Design

Compiler Design Most Expected mcq for ugc net 2021

Q1➡ |
A system program that combines separately compiled modules of a program into a form suitable for execution is called _
i ➥ Linking loader
ii ➥ Cross compiler
iii ➥ Assembler
iv ➥ None

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q2➡ |
A compiler for a high-level language that runs on one machine and produces code for a different machine is called _
i ➥ Multipass compiler
ii ➥ Cross compiler
iii➥ One pass compiler
iv ➥ Cross compiler

Show Answer With Best Explanation

Answer: ii
Explanation: Upload Soon


Q3➡ |
Cross-compiler is a compiler_______
i ➥ That generates object code for the machine it’s running on.
ii ➥ Which is written in a different language from the source language?
iii ➥ Which is written in the same language as the source language?
iv ➥ That runs on one machine but produces object code for another machine

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q4➡ |
What is the output of lexical analyzer?
i ➥ Set of Tokens
ii ➥ String Character
iii ➥ A set of RE
iv ➥ Syntax Tree

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q5➡ |
Which symbol table implementation is based on the property of locality of reference?
i ➥ Hash Table
ii ➥ Self Organisation
iii ➥ Search tree
iv ➥ Linear list

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q6➡ |
Which of the following is true for operator precedence parsing?
i ➥ To delimit the handle
ii ➥ For all pair of non-terminals
iii ➥ For all pair of non-terminal
iv ➥ None

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q7➡ |
What is an Object program?
i ➥ Translation of high-level language into machine language
ii ➥ Program to be translated into machine language
iii ➥ Program written in machine language
iv ➥ None

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q8➡ |
Which concept of FSA (Finite State Automata) is used in the compiler?
i ➥ Parser
ii ➥ Lexical analysis
iii ➥ Code optimization
iv ➥ Code generation

Show Answer With Best Explanation

Answer: ii
Explanation: Upload Soon


Q9➡ |
Which of the following are Lexemes?
i ➥ Keywords
ii ➥ Identifiers
iii ➥ Constants
iv ➥ All

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q10➡ |
Which concept of grammar is used in the compiler?
i ➥ Parser
ii ➥ Code optimization
iii ➥ Lexical analysis
iv ➥ Code generation

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q11➡ |
What constitutes the stages of the compilation process?
i ➥ Lexical analysis, syntax, Analysis and code generation
ii ➥ Implementation and documentation
iii ➥ Feasibility study, system, design, and testing
iv ➥ None

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q12➡ |
The lexical analyzer takes _ as input and produces a stream of _ as output.
i ➥ Token, source program
ii ➥ Source program, tokens
iii ➥ Either of the two
iv ➥ None

Show Answer With Best Explanation

Answer: ii
Explanation: Upload Soon


Q13➡ |
Parsing is also known as __
i ➥ Syntax Analysis
ii ➥ Semantic Analysis
iii ➥ Code Generation
iv ➥ Lexical Analysis

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q14➡ |
A compiler program written in a high level language is called __
i ➥ Object Program
ii ➥ Machine Language Program
iii ➥ Source Program
iv ➥ None

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q15➡ |
System program such a compiler are designed so that they are __
i ➥ Serially usable
ii ➥ Re-enterable
iii ➥ Non-Usable
iv ➥ None

Show Answer With Best Explanation

Answer: ii
Explanation: Upload Soon


Q16➡ |
Which of the following is not a feature of compiler?
i ➥ Execution time is more
ii ➥ Slow for debugging
iii ➥ To remove syntax errors
iv ➥ Scan the entire program first and translate into machine code

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q17➡ |
A system program that brings together separately compiled modules of a program into a form language that is suitable for execution.
i ➥ Cross compiler
ii ➥ Assembler
iii ➥ Linking loader
iv ➥ None

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q18➡ |
A programmer by mistakes writes a program to multiply two numbers instead of dividing them, how can this error be detected?
i ➥ Compiler or interpreter
ii ➥ Interpreter
iii ➥ Compiler
iv ➥ None

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q19➡ |
Which phase of the compiler is Syntax Analysis?
i ➥ Third
ii ➥ Second
iii ➥ First
iv ➥ none

Show Answer With Best Explanation

Answer: ii
Explanation: Upload Soon


Q20➡ |
All _ are automatically treated as regular expressions.
i ➥ Window
ii ➥ Collection
iii ➥ Programmatic description
iv ➥ Win Object

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q21➡ |
Syntax Analyser is also known as _
i ➥ Hierarchical Analysis
ii ➥ Hierarchical Parsing
iii ➥ Hierarchical Analysis & Parsing
iv ➥ None

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q22➡ |
Syntax Analyser takes Groups Tokens of source Program into Grammatical Production.
i ➥ True
ii ➥ False

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon

Q23➡ |
From where it takes its input from?
i ➥ Syntactic Analyser
ii ➥ Semantic Analyser
iii ➥ Lexical analyser
iv ➥ None

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q24➡ |
Parsers are expected to parse the whole code.
i ➥ True
ii ➥ False

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q25➡ |
A grammar for a programming language is a formal description of ___
i ➥ Syntax
ii ➥ Structure
iii ➥ Semantics
iv ➥ Library

Show Answer With Best Explanation

Answer: ii
Explanation: Upload Soon


Q26➡ |
Which of these is not true about the Symbol Table?
i ➥ Perform the processing of the assembler directives
ii ➥ Created during pass 1
iii ➥ All the labels of the instructions are symbols
iv ➥ Table has entry for symbol name address value

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q27➡ |
In an aboslute loading scheme, which loader function is accomplished by programmer?
i ➥ Reallocation
ii ➥ Linking
iii ➥ Allocation
iv ➥ Both ii,iii

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q28➡ |
Which of these features of assembler are Machine-Dependent?
i ➥ Addressing modes
ii ➥ Program relocation
iii ➥ Instruction formats
iv ➥ All

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q29➡ | IMP
A compiler can check?
i ➥ Syntax Error
ii ➥ Logical Error
iii ➥ Not Logical and Syntax Error
iv ➥ Both Logical and Syntax Error

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q30➡ |
Select a Machine Independent phase of the compiler.
i ➥ Intermediate Code generation
ii ➥ Lexical Analysis
iii ➥ Syntax Analysis
iv ➥ All

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q31➡ |
A system program that combines the separately compiled modules of a program into a form suitable for execution?
i ➥ Linking Loader
ii ➥ Interpreter
iii ➥ Assembler
iv ➥ Compiler

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q32➡ |
Which of the following system software resides in the main memory?
i ➥ Linker
ii ➥ Loader
iii ➥ Text Editor
iv ➥ Assembler

Show Answer With Best Explanation

Answer: ii
Explanation: Upload Soon


Q33➡ |
Type checking is normally done during __
i ➥ Syntax Directed Translation
ii ➥ Code generation
iii ➥ Lexical Analysis
iv ➥ Syntax Analysis

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q34➡ |
By whom is the symbol table created?
i ➥ Interpreter
ii ➥ Assembler
iii ➥ Compiler
iv ➥ None

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q35➡ |
What does a Syntactic Analyser do?
i ➥ Collect type of information
ii ➥ Create parse tree
iii ➥ Maintain Symbol Table
iv ➥ None

Show Answer With Best Explanation

Answer: ii
Explanation: Upload Soon


Q36➡ |
Semantic Analyser is used for?
i ➥ Generating Object code & Maintaining symbol table
ii ➥ Generating Object code
iii ➥ Maintaining symbol table
iv ➥ none

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q37➡ |
Which of the following derivations does a top-down parser use while parsing an input string?
i ➥ Leftmost derivation in reverse
ii ➥ Leftmost derivation
iii ➥ Rightmost derivation in reverse
iv ➥ Rightmost derivation

Show Answer With Best Explanation

Answer: ii
Explanation: Upload Soon


Q38➡ |
The process of assigning load addresses to the various parts of the program and adjusting the code and data in the program to reflect the assigned addresses is called?
i ➥ Relocation
ii ➥ Symbol resolute
iii ➥ Assembly
iv ➥ Parsing

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q39➡ |
Which of the following statements is false?
i ➥ Ambiguous grammar can’t be LR (k)
ii ➥ LALR is more powerful than SLR
iii ➥ Left as well as right most derivations can be in Unambiguous grammar
iv ➥ An LL (1) parser is a top-down parser

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q40➡ |
Which of the following grammar rules violate the requirements of an operator grammar?
(a) P -> QR
(b) P -> QsR
(c) P -> ε
(d) P -> QtRr
i ➥ (a) and (c) only
ii ➥ (c) and (d) only
iii ➥ (a) only
iv ➥ (b) and (c) only

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q41➡ |
Assume that the SLR parser for a grammar G has n1 states and the LALR parser for G has n2 states.
i ➥ n1 is necessarily equal to n2
ii ➥ n1 is necessarily greater than n2
iii ➥ n1 is necessarily less than n2
iv ➥ None

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q42➡ |
Match the following.
P. Regular expression 1. Syntax analysis
Q. Pushdown automata 2. Code generation
R. Dataflow analysis 3. Lexical analysis
S. Register allocation 4. Code optimization
i ➥ P-3, Q-4, R-1, S-2
ii ➥ P-4. Q-1, R-2, S-3
iii ➥ P-3, Q-1, R-4, S-2
iv ➥ P-2, Q-1, R-4, S-3

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q43➡ |
I. There exist parsing algorithms for some programming languages which has O(3) complexity.
II. A programming language which allows recursion can be implemented with static storage allocation.
III. No L-attributed definition can be evaluated in The framework of bottom-up parsing.
IV. Code improving transformations can be performed at both intermediate code level and source Language.
i ➥ III and IV
ii ➥ I, III and IV
iii ➥ I and II
iv ➥ I and IV

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q44➡ |
-Which of the following describes a handle (as applicable to LR-parsing) appropriately?
i ➥ Used in the next step for reduction along with a position in the sentential form where the right hand side of the production may be found
ii ➥ Used for reduction in a coming-up step along with a position in the sentential form where the next shift or reduce operation will occur
iii ➥ The next step has use of Non-terminal for reduction
iv ➥ Position where next reduce or shift operation will occur

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q45➡ |
Which one of the following is a top-down parser?
i ➥ Operator precedence parser
ii ➥ An LR(k) parser
iii ➥ An LALR(k) parser
iv ➥ Recursive descent parser

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q46➡ |
The grammar A → AA | (A) | e is not suitable for predictive-parsing because the grammar is?
i ➥ Left recursive
ii ➥ Ambiguous
iii ➥ An operator grammar
iv ➥ Right recursive

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q47➡ |
What is the grammar for the below equations?
S → C C
C → c C | d
i ➥ LALR(1) but not SLR(1)
ii ➥ LR(1) but not LALR(1)
iii ➥ LL(1)
iv ➥ SLR(1) but not LL(1)

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q48➡ |
Which of the following statements is false?
i ➥ LALR is more powerful than SLR
ii ➥ Ambiguous grammar can’t be LR(k)
iii ➥ Unambiguous grammar has both kind of derivations
iv ➥ An LL(1) parser is a top-down parser

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q49➡ |
Match the following.
i ➥ A – 2, B – 4, C – 1, D – 3
ii ➥ A – 2, B – 3, C – 4, D – 1
iii ➥ A – 2, B – 3, C – 1, D – 4
iv ➥ A – 2, B – 1, C – 4, D – 3

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q50➡ |
Which of the following pairs is the most powerful?
i ➥ SLR canonical LR
ii ➥ LALR canonical LR
iii ➥ SLR, LALR
iv ➥ Canonical LR ,LALR

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q51➡ |
Inherited attribute is a natural choice in _
i ➥ L values and R values
ii ➥ Variable declarations record is maintained
iii ➥ All
iv ➥ none

Show Answer With Best Explanation

Answer: ii
Explanation: Upload Soon


Q52➡ |
YACC builds up __
i ➥ LALR parsing table
ii ➥ Canonical LR parsing table
iii ➥ SLR parsing table
iv ➥ none

Show Answer With Best Explanation

Answer: 1
Explanation: Upload Soon


Q53➡ |
In an absolute loading scheme which loader function is accomplished by assembler?
i ➥ Loading
ii ➥ Re-allocation
iii ➥ Allocation
iv ➥ Linking

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q54➡ |
A parser with the valid prefix property is advantageous because it __
i ➥ Errors are passed to the text phase
ii ➥ Detects errors
iii ➥ All
iv ➥ None

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q55➡ |
The action of parsing the source program into proper syntactic classes is called __
i ➥ Interpretation analysis
ii ➥ General Syntax Analysis
iii ➥ Lexical Analysis
iv ➥ Syntax Analysis

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q56➡ |
Relocating bits used by relocating loader are specified by __
i ➥ Assembler
ii ➥ Macro Processor
iii ➥ Linker
iv ➥ Relocating loader itself

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q57➡ |
Running time of a program depends on __
i ➥ Order of computations
ii ➥ The usage of machine idioms
iii ➥ Addressing mode
iv ➥ All

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q58➡ |
A bottom up parser generates __
i ➥ Leftmost derivation in reverse
ii ➥ Leftmost derivation
iii ➥ Rightmost derivation in reverse
iv ➥ Right most derivation

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q59➡ |
A grammar that produces more than one parse tree for some sentence is called __
i ➥ Regular
ii ➥ Unambiguous
iii ➥ Ambiguous
iv ➥ All

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q60➡ |
The linker __
i ➥ Is required to create a load module
ii ➥ Is similar to interpreter
iii ➥ Uses source code as its input
iv ➥ All

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q61➡ |
The optimization which avoids test at every iteration is?
i ➥ Constant folding
ii ➥ Peephole
iii ➥ Loop unrolling
iv ➥ Loop jamming

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q62➡ |
Shift reduce parsers are __
i ➥ Top down Parser recursive
ii ➥ Top down Parser
iii ➥ Bottom Up parser
iv ➥ May be top down or bottom up

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q63➡ |
Which of the following statement is true?
i ➥ Canonical LR powerful than LALR parser
ii ➥ The parsers SLR= Canonical LR=LALR
iii ➥ SLR powerful than LALR
iv ➥ LALR powerful than Canonical LR parser

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q64➡ |
The identification of common sub-expression and replacement of run-time computations by compile-time computations is _
i ➥ Constant folding
ii ➥ Data flow analysis
iii ➥ Local optimization
iv ➥ Loop optimization

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q67➡ |
The graph that shows basic blocks and their successor relationship is called __
i ➥ Control Graph
ii ➥ Hamilton Graph
iii ➥ Flow Graph
iv ➥ Dag

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q68➡ |
Relocation bits used by relocating loader are specified by __
i ➥ Linker
ii ➥ Assembler
iii ➥ Macro processor
iv ➥ Relocating loader itself

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q69➡ |
The grammar A ->AA |( A)| ε is not suitable for predictive-parsing because the grammar is _
i ➥ Right-recursive
ii ➥ operator-grammar
iii ➥ Ambiguous
iv ➥ Left-recursive

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q70➡ |
Which one of the following statements is FALSE?
i ➥ High-level language programs can be translated to different Intermediate Representations.
ii ➥ Arguments to a function can be passed using the program stack
iii ➥ Context-free grammar can be used to specify both lexical and syntax rules.
iv ➥ Type checking is done before parsing.

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q71➡ |
Consider the following parse tree for the expression a#b$c$d#e#f, involving two binary operators $ and #
.
Which one of the following is correct for the given parse tree?
i ➥ $ has higher precedence and is left associative; # is left associative
ii ➥ # has higher precedence and is right associative; $ is left associative
iii ➥ $ has higher precedence and is left associative; # is right associative
iv ➥ # has higher precedence and is left associative; $ is right associative

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q72➡ |
Consider the following grammar:

What is FOLLOW(Q)?
i ➥ {w, y}
ii ➥ {w, $}
iii ➥ {R}
iv ➥ {w}

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q73➡ |
Consider the following Syntax Directed Translation Scheme (SDTS), with non-terminals {S, A} and terminals {a,b}.
S → aA { print 1 }
S → a { print 2 }
A → Sb { print 3 }
Using the above SDTS, the output printed by a bottom-up parser, for the input aab is:
i ➥ 2 3 1
ii ➥ syntax error
iii ➥ 2 2 3
iv ➥ 1 3 2

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q74➡ |
Match the following:
i ➥ P -> ii, Q -> iii, R -> i, S-> iv
ii ➥ P -> iv, Q -> i, R -> ii, S -> iii
iii ➥ P ->iii, Q ->i, R -> ii, S -> iv
iv ➥ P -> i, Q -> ii, R -> iv, S -> iii

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q75➡ |
Which one of the following is True at any valid state in shift-reduce parsing?
i ➥ The stack contains only a set of viable prefixes
ii ➥ The stack never contains viable prefixes
iii ➥ Viable prefixes appear only at the bottom of the stack and not inside
iv ➥ Viable prefixes appear only at the top of the stack and not inside

Show Answer With Best Explanation

Answer:i
Explanation: Upload Soon


Q76➡ |
The least number of temporary variables required to create a three-address code in static single assignment form for the expression q + r/3 + s – t * 5 + u * v/w is _.
i ➥ 11
ii ➥ 10
iii ➥ 9
iv ➥ 8

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q77➡ |
Among simple LR (SLR), canonical LR, and look-ahead LR (LALR), which of the following pairs identify the method that is very easy to implement and the method that is the most powerful, in that order?
i ➥ SLR, canonical LR
ii ➥ LALR, canonical LR
iii ➥ SLR, LALR
iv ➥ Canonical LR, LALR

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q78➡ |
In a compiler, keywords of a language are recognized during
i ➥ the lexical analysis of the program
ii ➥ dataflow analysis
iii ➥ parsing of the program
iv ➥ the code generation

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q79➡ |
Which data structure in a compiler is used for managing information about variables and their attributes?
i ➥ Semantic stack
ii ➥ Parse Table
iii ➥ Symbol table
iv ➥ Abstract syntax tree

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q80➡ |
The grammar S → aSa|bS|c is
i ➥ Both LL(1) and LR(1)
ii ➥ Neither LL(1) nor LR(1
iii ➥ LL(1) but not LR(1)
iv ➥ LR(1) but not LR(1)

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q81➡ |
Match all items in Group 1 with correct options from those given in Group 2
Group 1 Group 2
i ➥ P-3, Q-4, R-1, S-2
ii ➥ P-2, Q-1, R-4, S-3
iii ➥ P-4, Q-1, R-2, S-3
iv ➥ P-3, Q-1, R-4, S-2

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q82➡ |
An LALR(1) parser for a grammar G can have shift-reduce (S-R) conflicts if and only if
i ➥ the LR(1) parser for G has S-R conflicts
ii ➥ the LR(0) parser for G has S-R conflicts
iii ➥ the LALR(1) parser for G has reduce-reduce conflicts
iv ➥ the SLR(1) parser for G has S-R conflicts

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q83➡ |
Consider the following translation scheme.
S → ER
R → E{print(““);}R|ε
E → F + E {print(“+”);}|F
F → (S)|id {print(id.value);}
Here id is a token that represents an integer and id.value represents the corresponding integer value. For an input ‘2 * 3 + 4’, this translation scheme prints
i ➥ 2 3 4+*
ii ➥ 2 3 * 4 +
iii ➥ 2 * +3 4
iv ➥ 2 * 3 + 4

Show Answer With Best Explanation

Answer:i
Explanation: Upload Soon


Q84➡ |
Consider the following C code segment.
for (i = 0, i < n; i++)
{
for (j = 0; j < n; j++)
{
if (i%2)
{
x += (4j + 5i);
y += (7 + 4*j);
}
}
}
Which one of the following is false?
i ➥ There is scope of common sub-expression elimination in this code
ii ➥ There is scope of dead code elimination in this code
iii ➥ There is scope of strength reduction in this code
iv ➥ The code contains loop invariant computation

Show Answer With Best Explanation

Answer: ii
Explanation: Upload Soon


Q85➡ |
The number of tokens in the Fortran statement DO 10 I = 1.25 is
i ➥ 5
ii ➥ 4
iii ➥ 3
iv ➥ None

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q86➡ |
Peephole optimization is a form of
i ➥ Local optimization
ii ➥ Constant folding
iii ➥ Loop optimization
iv ➥ Data flow analysis

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q87➡ |
Identify the total number of tokens in the given statements printf(“A%B=”, &i);
i ➥ 9
ii ➥ 8
iii ➥ 4
iv ➥ 17

Show Answer With Best Explanation

Answer: ii
Explanation: Upload Soon


Q88➡ |
The grammar S ⟶ (S) | SS | ∈ is not suitable for predictive parsing because the grammar is
i ➥ Ambiguous
ii ➥ Left Recursive
iii ➥ Right Recursive
iv ➥ 1An Operator Grammar

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q89➡ |
The optimization phase in a compiler gererally:
i ➥ Optimization the code to reduce execution time
ii ➥ Reduces the space of the code
iii ➥ Both (A) and (B)
iv ➥ Neither (A) nor (B)

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q90➡ |
Type of error occur when misspellings of identifiers, keywords or operators
i ➥ Syntactical
ii ➥ Semantical :
iii ➥ Logical
iv ➥ Lexical

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q91➡ |
Type of error occur when missing semicolon or unbalanced parenthesis
i ➥ Syntactical
ii ➥ Semantical :
iii ➥ Logical
iv ➥ Lexical

Show Answer With Best Explanation

Answer: 1
Explanation: Upload Soon


Q92➡ |
Type of error occur when code not reachable, infinite loop
i ➥ Syntactical
ii ➥ Semantical :
iii ➥ Logical
iv ➥ Lexical

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q93➡ |
Type of error occur when incompatible value assignment or type mismatches between operator and operand
i ➥ Syntactical
ii ➥ Semantical :
iii ➥ Logical
iv ➥ Lexical

Show Answer With Best Explanation

Answer: ii
Explanation: Upload Soon


Q94➡ |
One of the purposes of using intermediate code in compilers is to
i ➥ increase the chances of reusing the machine-independent code optimizer in other compilers.
ii ➥ improve the register allocation
iii ➥ improve error recovery and error reporting.
iv ➥ make parsing and semantic analysis simpler.

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q95➡ |
Some code optimizations are carried out on the intermediate code because
i ➥ the information from dataflow analysis cannot otherwise be used for optimization
ii ➥ the information from the front end cannot otherwise be used for optimization
iii ➥ they enhance the portability of the compiler to other target processors
iv ➥ program analysis is more accurate on intermediate code than on machine code

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q96➡ |
Consider the translation scheme shown below.
S → T R
R → + T {print (‘+’);} R|ε
T → num {print(num.val);}
Here num is a token that represents an integer and num.val represents the corresponding integer value. For an input string ‘9 + 5 + 2’, this translation scheme will print
i ➥ ++ 9 5 2
ii ➥ 9 5 2 + +
iii ➥ 9 5 + 2 +
iv ➥ 9 + 5 + 2

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q97➡ |
Synthesized attribute can easily be simulated by an
i ➥ LR grammar
ii ➥ ambiguous grammar
iii ➥ LL grammar
iv ➥ none

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q98➡ |
Which of the following is a type of out-of-order execution, with the reordering done by a compiler
i ➥ Strength reduction
ii ➥ Software pipelining
iii ➥ Loop unrolling
iv ➥ Dead code elimination

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q99➡ |
Replacing the expression 4*2.14 by 8.56 is known as
i ➥ Strength reduction
ii ➥ Code reduction
iii ➥ Constant folding
iv ➥ Induction variable

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q100➡ |
In the context of compiler design, “reduction in strength” refers to :
i ➥ reduction in accuracy of the output
ii ➥ reduction in the range of values of input variables
iii ➥ code optimization obtained by the use of cheaper machine instructions
iv ➥ reduction in efficiency of the program

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q101➡ |
Dead-code elimination in machine code optimization refers to :
i ➥ removal of function which are not involved.
ii ➥ removal of a module after its use
iii ➥ removal of all labels.
iv ➥ removal of values that never get used.

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q102➡ |
Peer-hole optimization is a form of :
i ➥ constant folding
ii ➥ data flow analysis
iii ➥ loop optimization
iv ➥ local optimization

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q103➡ |
Which of the following statements about peephole optimization is False?
i ➥ It can be applied to the portion of the code that is not contiguous
ii ➥ To get the best out of this, it has to be applied repeatedly
iii ➥ it can be used to optimize intermediate code
iv ➥ It is applied to a small part of the code

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q104➡ |
Code optimization is responsibility of :
i ➥ Operating system
ii ➥ Application programmer
iii ➥ System programmer
iv ➥ All

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q105➡ |
Loop unrolling is a code optimization technique:
i ➥ that reorders operations to allow multiple computations to happen in parallel
ii ➥ that exchanges inner loops with outer loops
iii ➥ that improves performance by decreasing the number of instructions in a basic block.
iv ➥ that avoids tests at every iteration of the loop.

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon


Q106➡ |
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.
i ➥ Loop jamming
ii ➥ Loop concatenation
iii ➥ Strength reduction
iv ➥ Loop unrolling

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q107➡ |
In compiler terminology reduction in strength means
i ➥ replacing a costly operation by a relatively cheaper one
ii ➥ Removing common subexpressions
iii ➥ Removing loop invariant computation
iv ➥ Replacing run time computation by compile time computation

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q108➡ |
Substitution of values for names (whose values are constants) is done in
i ➥ Constant folding
ii ➥ Strength reduction
iii ➥ Local optimization
iv ➥ Loop optimization

Show Answer With Best Explanation

Answer: i
Explanation: Upload Soon


Q109➡ |
Which of the following class of statement usually produces no executable code when compiled?
i ➥ input and output statements
ii ➥ structural statements
iii ➥ declaration
iv ➥ assignment statements

Show Answer With Best Explanation

Answer: iii
Explanation: Upload Soon


Q110➡ |
Shift reduce parsing belongs to a class of
i ➥ predictive parsing
ii ➥ recursive parsing
iii ➥ top down parsing
iv ➥ bottom up parsing

Show Answer With Best Explanation

Answer: iv
Explanation: Upload Soon



error: Content is protected !!
Open chat
1
Hi,how Can We Help You ?