0% found this document useful (0 votes)
1K views13 pages

CS606 Midterm MCQS Solved With References by Moaaz

The document contains 20 multiple choice questions from a midterm exam on compiler design. The questions cover topics like lexical analysis, parsing, grammars, compiler structure and design. The questions test knowledge of terminology and concepts in compiler design.

Uploaded by

Farogh e Haq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views13 pages

CS606 Midterm MCQS Solved With References by Moaaz

The document contains 20 multiple choice questions from a midterm exam on compiler design. The questions cover topics like lexical analysis, parsing, grammars, compiler structure and design. The questions test knowledge of terminology and concepts in compiler design.

Uploaded by

Farogh e Haq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

CS606- compiler instruction

Solved MCQS Dec 19,2013


From Midterm Papers

MC100401285 [email protected] [email protected] PSMD01

MIDTERM EXAMINATION
Fall 2012
CS606- compiler instruction

Question # 1 (Total Marks: 1) Select correct option:


LR parsers can handle ________________ grammars.
Left-recursive (Page 63)
file-recursive
End-recursive
Start-recursive

Question # 2 (Total Marks: 1) Select correct option:


_____ convert the relocatable machine code into absolute machine code by linking library and relocatable
object files.
Assembler
Loader/link-editor
Compiler
Preprocessor

Question # 3 (Total Marks: 1) Select correct option:


Follow of C is _____________ .
g, h, i, $
g, h, $
h, i, $
h, g, $

1
Question # 4 (Total Marks: 1) Select correct option:
Consider the grammar A --> B C D
B --> h B | epsilon
C --> C g | g | C h | i
D --> A B | epsilon
Follow of B is _____________ .

h
g, h, i, $
g, i
g

Question # 5 (Total Marks: 1) Select correct option:


An important component of semantic analysis is __________________ .

code checking
type checking (Page 33)
flush checking
None of the given

Question # 6 (Total Marks: 1) Select correct option:


In PASCAL ___________ represent the inequality test.

:=
=
<>
None of the given

Question # 7 (Total Marks: 1) Select correct option:


Lexical Analyzer generator ________________ is written in Java.

Flex
Jlex (Page 26)
Complex
None of given

2
Question # 8 (Total Marks: 1) Select correct option:
____________avoid hardware stalls and interlocks.

Register allocation
Instruction scheduling (Page 121)
Instruction selection
None of given

Question # 9 (Total Marks: 1) Select correct option:


Consider the following grammar,
A --> B C D
B --> h B | epsilon
C --> C g | g | C h | i
D --> A B | epsilon
First of A is _______________ .
h, g, i
g
h
None of the given

Question # 10 (Total Marks: 1) Select correct option:


Recursive ____________ parsing is done for LL(1) grammar.
Descent (Page 47)
Ascent
Forward
Backward

Question # 1 (Total Marks: 1) Select correct option:


One of the core tasks of compiler is to generate fast and compact executable code.
True
False

Question # 11 (Total Marks: 1) Select correct option:


Left factoring of a grammar is done to save the parser from back tracking.
True
False

3
Question # 12 (Total Marks: 1) Select correct option:
Responsibility of ______________ is to produce fast and compact code.
Instruction selection (Page 9)
Register allocation
Instruction scheduling
None of given

Question # 13 (Total Marks: 1) Select correct option:


________________ algorithm is used in DFA minimization.
James’s
Robert’s
Hopcroft’s (Page 25)
None of given

Question # 14 (Total Marks: 1) Select correct option:


Compilers are sometimes classified as.
Single pass
Multi pass
Load and go
All of the given click here for detail

Question # 15 (Total Marks: 1) Select correct option:


In multi pass compiler during the first pass it gathers information
about ___________________ .
Declaration click here for detail
Bindings
Static information
None of the given

Question # 16 (Total Marks: 1) Select correct option:


Flex is an automated tool that is used to get the minimized DFA (scanner).
True
False (Page 26)

Question # 17 (Total Marks: 1) Select correct option:


In compilation process Hierarchical analysis is also called
Parsing
Syntax analysis
Both Parsing and Syntax analysis click here 4 detail
None of given

4
Question # 18 (Total Marks: 1) Select correct option:
For each language to make LL(1) grammar, we take two steps, 1st is removing left recurrence and 2nd is
applying left factoring in sequence.

True
False

Question # 19 (Total Marks: 1) Select correct option:


_____________is evaluated to yield a value.
Command
Expression
Declaration
Declaration and Command

Question # 20 (Total Marks: 1) Select correct option:


Optimal registers allocation is an NP-hard problem.
True
False

MIDTERM EXAMINATION
Fall 2012
CS606- compiler instruction

Question # 1 (Total Marks: 1) Select correct option:


Parser takes tokens from scanner and tries to generate _______________ .
Binary Search tree
Parse tree
Syntax trace
None of the given

5
Question # 2 (Total Marks: 1) Select correct option:
Front end of two pass compiler takes_________________ as input.
Source code (Page 5)
Intermediate Representation (IR)
Machine Code
None of the Given

Question # 3 (Total Marks: 1) Select correct option:


In in we construct one _______________ for each group of states from the initial DFA.

State (Page 25)


NFA
PDA
None of given

Question # 4 (Total Marks: 1) Select correct option:


In Three-pass compiler _____________ is used for code improvement or optimization.

Front End
Middle End (Page 10)
Back End
Both Front end and Back end

Question # 5 (Total Marks: 1) Select correct option:


________________ of a two-pass compiler is consists of Instruction selection, Register allocation and
Instruction scheduling.

Back end (Page 10)


Front end
Start
None of given

Question # 6 (Total Marks: 1) Select correct option:


NFA is easy to implement as compared to DFA.
True
False (Page 19)

Question # 7 (Total Marks: 1) Select correct option:


We can get an LL(1) grammar by ________________ .
Removing left recurrence
Applying left factoring
Removing left recurrence and Applying left factoring
None of the given

6
Question # 8 (Total Marks: 1) Select correct option:
Parser always gives a tree like structure as output
True
False

Question # 9 (Total Marks: 1) Select correct option:


In Back End module of compiler, optimal register allocation uses_______________ .

O(log n)
O(n log n)
N P-Complete (Page 10)
None of the given

7
CS606 – Midterm Solved Quizzes (Quiz No.1 & 2)

Question # 1 of 10 (Total Marks: 1) Select correct option:


Lexer and scanner are two different phases of compiler
Select correct option:
True
False

Question # 2 of 10 (Total Marks: 1) Select correct option:


In Flex specification file different sections are separated by ___________________ .

%% (Page 26)
&&
##
\\

Question # 3 of 10 (Total Marks: 1) Select correct option:


____________________ phase which supports macro substitution and conditional compilation.
Semantic
Syntax
Preprocessing Click here for detail
None of given

Question # 4 of 10 (Total Marks: 1) Select correct option:


____________tree in which each node represents an operator and children of the node represent the operands.
Abstract syntax (Page 100)
Concrete syntax
Parse
None of the given

Question # 5 of 10 (Total Marks: 1) Select correct option:


In _____certain checks are performed to ensure that components of a program fit together meaningfully.
Linear analysis
Hierarchical analysis
Semantic analysis (Page 33)
None of given

8
Question # 6 of 10 (Total Marks: 1) Select correct option:
In compiler linear analysis is also called.
Select correct option:
Lexical analysis
Scanning
Both lexical analysis and scanning click here for details
None of the given

Question # 7 of 10 (Total Marks: 1) Select correct option:


Which of the following statement is true about Two pass compiler.
Front End depends upon Back End
Back End depends upon Frond End (Page 5)
Both are independent of each other
None of the given

Question # 8 of 10 (Total Marks: 1) Select correct option:


Ambiguity can easily be handled by Top-down Parser
True click here for detail
False

Question # 10 of 10 (Total Marks: 1) Select correct option:


Alternative of the backtrack in parser is Look ahead symbol in _________ .
Input (Page 46)
Output
Input and Output
None of the given

Question # 1 of 10 (Total Marks: 1) Select correct option:


Typical compilation means programs written in high-level languages to low-level ___________.
Object code
Byted code
Unicode
Both Object Code and byte code (Page 2)

Question # 2 of 10 (Total Marks: 1) Select correct option:


LR parsing ______________ a string to the start symbol by inverting productions.
Reduces (Page 63)
Shifts
Adds
None of the given

9
Question # 3 of 10 (Total Marks: 1) Select correct option:
In parser the two LL stand(s) for ____________ .
Left-to-right scan of input
left-most derivation
All of the given click here for detail
None of the given

Question # 4 of 10 (Total Marks: 1) Select correct option:


Bottom-up parsers handle a _______________ class of grammars.
Large (Page 63)
Small
Medium
None of the given

Question # 5 of 10 (Total Marks: 1) Select correct option:


Compilers are some times classified as.

Single pass
Multi pass
Load and go
All of the given

Question # 6 of 10 (Total Marks: 1) Select correct option:


The Back End of a compiler consist of ______________ .

Instruction selection (Page 10)


Register allocation
Instruction scheduling
All of the given

Question # 7 of 10 (Total Marks: 1) Select correct option:


Can a DFA simulate NFA?
Yes click here for detail
No
Sometimes
Depend upon nfa

Question # 8 of 10 (Total Marks: 1) Select correct option:


Which of the statement is true about Regular Languages?
Regular Languages are the most popular for specifying tokens.
Regular Languages are based on simple and useful theory.
Regular Languages are easy to understand.
All of the given (Page 15)

10
Question # 9 of 10 (Total Marks: 1) Select correct option:
In a transition table cells of the table contain the ________ state.
Reject state
Next state (Page 18)
Previous state
None of the given

Question # 10 of 10 (Total Marks: 1) Select correct option:


The transition graph for an NFA that recognizes the language ( a | b)*abb will have following set of states.
{0}
{0,1}
{0,1,2}
{0,1,2,3} (page 23) Not sure

Question # 1 of 10 (Total Marks: 1) Select correct option:


Functions of Lexical analyzer are?
Removing white space
Removing constants, identifiers and keywords
Removing comments
All of the given click here for detail

Question # 2 of 10 (Total Marks: 1) Select correct option:


________ method is known as Subset Construction Method.
NFA TO DFA (Page 19)
DFA
DFA maximization
None of given

Question # 3 of 10 (Total Marks: 1) Select correct option:


Which one is NOT the Role of Run-Time System
garbage collection
memory management
run time error checking
none of given (Page 11)

Question # 4 of 10 (Total Marks: 1) Select correct option:


Compiler_________ information from one representation to another
modified
translate (Page 2)
execute
extract

11
Question # 5 of 10 (Total Marks: 1) Select correct option:
Front-end of a two pass compiler is consists of Scanner.
True
False (Page 12)

Question # 6 of 10 (Total Marks: 1) Select correct option:


Bottom-up parsing uses only _______________ kinds of actions.
Two (Page 64)
Three
Four
Five

Question #7 of 10 (Total Marks: 1) Select correct option:


Bottom-up parsing is also called _______________ .
LR parsing (Page 63)
LT parsing
LS parsing
SS parsing

Question # 8 of 10 (Total Marks: 1) Select correct option:


Backtracking is a costly operation which is caused due to Left Recursion.

True
False

Question # 9 of 10 (Total Marks: 1) Select correct option:


A non-recursive predictive parser is also called ________________.

table-driven parser (Page 54)


Abstract parser
Conceptual parser
None of the given

Question # 10 of 10 (Total Marks: 1) Select correct option:


AST summarizes the grammatical structure with the details of derivations.
True
False (Page 8)

Question # 1 of 10 (Total Marks: 1) Select correct option:


Backtrack is term associated with Top-down parsing.

True (Page 42)


False

12
Question # 2 of 10 (Total Marks: 1) Select correct option:
Which of the following statement/s is/are true about Deterministic Finite Automata?

Question # 3 of 10 (Total Marks: 1) Select correct option:


The lexical analyzer partition input string into substrings, called _words________

Question # 4 of 10 (Total Marks: 1) Select correct option:


“” “ab” “abab”... is a string of the language denoted by following Regular Expression:

13

You might also like