Professional Documents
Culture Documents
a. Low-level Language
b. High-Level Language
c. Decimal-Format
d. Middle-Level Language
Hide Answer Workspace
2) Which computer program accepts the high-level language and converts it into assembly
language?
a. Interpreter
b. Linker
c. Assembler
d. Compiler
Hide Answer Workspace
Answer: d. Compiler
3) Does the compiler program translate the whole source code in one step?
a. No
b. Depends on the Compiler
c. Don't Know
d. Yes
Hide Answer Workspace
Answer: d. Yes
Explanation: The compiler is that program which translates the whole high-level code
into the machine code at once.
a. Program file
b. Object file
c. Data File
d. Task File
Hide Answer Workspace
a. Parser
b. Code optimizer
c. Code generator
d. Scanner
Hide Answer Workspace
Answer: d. Scanner
Explanation: Scanner is a subroutine which is called by the compiler program. The
scanner combines the characters and implements them to produce tokens.
Hide Answer Workspace
a. three types
b. four types
c. two types
d. five types
Hide Answer Workspace
Explanation: In the compiler design, the parser is mainly categorized into top-down
parsing and bottom-up parsing.
8) In which parsing, the parser constructs the parse tree from the start symbol and
transforms it into the input symbol.
a. Bottom-up parsing
b. Top-down parsing
c. None of the above
d. Both a and b
Hide Answer Workspace
Explanation: Top-down parsing is a technique which constructs the parse tree from the
start symbol and transforms it to the input symbol. This type of parsing is also referred
to as predictive or recursive parsing.
Hide Answer Workspace
a. Operator Precedence
b. SLR
c. Canonical LR
d. LALR
Hide Answer Workspace
Answer: c. Canonical LR
Explanation: Canonical LR (CLR) is the most powerful parser than LALR and SLR.
a. string character
b. a syntax tree
c. a set of RE
d. a set of tokens
Hide Answer Workspace
Explanation: Lexical analyzer gives the set of tokens as output. The set of tokens
contains keywords, separators, literals, identifiers, and operators.
13) From the following grammars, which describes the lexical syntax?
a. Lexical Grammar
b. Context-free Grammar
c. Syntactic Grammar
d. Regular Grammar
Hide Answer Workspace
14) Which grammar gives multiple parse trees for the same string?
a. Unambiguous
b. Regular
c. Ambiguous
d. All of the above
Hide Answer Workspace
Answer: c. Ambiguous
a. removing comments
b. removing whitespace
c. breaking the syntaxes in the set of tokens
d. All of the mentioned
Hide Answer Workspace
Explanation: Lexical analyzer is used in the compiler for removing the Whitespace and
comments. It is also used in breaking the syntaxes into the set of tokens.
a. Mexeme
b. Lexeme
c. Texeme
d. Pattern
Hide Answer Workspace
Answer: b. Lexeme
17) Which part of the compiler highly used the grammar concept?
AD
a. Code optimization
b. Code generation
c. Parser
d. Lexical Analysis
Hide Answer Workspace
Answer: c. Parser
Explanation: The concept of grammar is much used in the parser phase of the compiler.
The parser phase is next to the lexical analysis phase in the compiler. Parser generated
the parse tree using the predefined grammar. The parser has two different techniques
for creating a different parse tree.
18) Which phase of the compiler checks the grammar of the programming?
a. Code Optimization
b. Semantic Analysis
c. Code Generation
d. Syntax Analysis
Hide Answer Workspace
Explanation: Syntax Analysis is the 2nd phase of the compiler, which checks the given
input string is the correct syntax of the programming language.
a. Yacc
b. Lex
c. Symbol Table
d. Type Checking
Hide Answer Workspace
Hide Answer Workspace
Explanation: The first part of the compiler (lexical analysis) is also known as a scanner. It
scans the characters from the source program and implements them to produce tokens.
a. Code Optimization
b. Semantic Analysis
c. Syntax Analysis
d. Lexical Analysis
Hide Answer Workspace
Explanation: The phase of the compiler next to the lexical analysis phase is also known
as Parser.
Syntax analysis or parser accepts the tokens produced by the lexical analysis and gives
the parse tree in the output.
AD
a. An LALR parser
b. A LR parser
c. Operator precedence parser
d. Recursive descent parser
Hide Answer Workspace
Hide Answer Workspace
Explanation: Keywords are firstly recognized during the lexical analysis of the program
in the compiler.
a. sub-terminals
b. half-terminals
c. non-terminals
d. terminals
Hide Answer Workspace
Answer: d. terminals.
Explanation: All the leaf nodes in the parse tree indicate the terminals. And all the
interior nodes indicate non-terminals.
25) Which graph describes the basic block and successor relationship?
a. Control graph
b. DAG
c. Flow graph
d. Hamilton graph
Hide Answer Workspace
Explanation: A flow graph is a graph of the compiler which describes the basic blocks
and how the program control is passed between the blocks.
a. Type 0 language
b. Type 1 language
c. Type 2 language
d. Type 3 language
Hide Answer Workspace
a. Context-sensitive grammar
b. Context-free grammar
c. Regular grammar
d. All of these
Hide Answer Workspace
Hide Answer Workspace
a. two types
b. three types
c. four types
d. five types
Hide Answer Workspace
Answer: a. two types
30) The value of which variable is updated inside the loop by a loop-invariant value?
a. loop
b. strength
c. induction
d. invariable
Hide Answer Workspace
Answer: c. induction
Explanation: The value of the induction variable is updated inside the loop by a loop-
invariant value.
31) Which compiler runs on one machine and generates code for multiple machines?
a. Multipass compiler
b. Cross compiler
c. Optimizing compiler
d. Onepass compiler
Hide Answer Workspace
Hide Answer Workspace
Explanation: The compiler does not take more time to execute. So, more execution
time is not a characteristic of the compiler.
33) Which phenomenon happens when the non-terminal on the left side is repeated as the
first symbol on the right side?
a. Left-most derivation
b. Left recursion
c. Left factoring
d. Left parsing
Hide Answer Workspace
Explanation: Left recursion is the process in which non-terminal on the left side of the
production is the same on the right side as the leftmost symbol.
34) In which derivation the right-most non-terminal symbol is replaced at each step?
Answer: c. Rightmost
35) In which derivation the leftmost non-terminal symbol is replaced at each step?
a. Left recursion
b. Left non-terminal
c. Left pushdown
d. Leftmost
Hide Answer Workspace
Answer: d. Leftmost
Hide Answer Workspace
a. End symbol
b. Start symbol
c. Non-terminal symbol
d. Terminal symbol
Hide Answer Workspace
38) Which method merges the multiple loops into the single one?
a. Constant Folding
b. Loop rolling
c. Loop fusion or jamming
d. None of the above
Hide Answer Workspace
a. Bottom-up parser
b. Top-down parser
c. Both Top-down and bottom-up
d. None of the Above
Hide Answer Workspace
40) Which of the following tree is the pictorial identification of the derivation?
Hide Answer Workspace
Explanation: The tree which represents the syntactic structure of the string is known as
the parse tree. It also indicates the terminal, start symbol, and non-terminal symbols.
Hide Answer Workspace
Explanation: The full form of YACC is Yet Another Compiler Compiler, which produces
the LALR (1) grammar parser.
42) What type of conflicts can occur in the shift-reduce parsing?
a. reduce/reduce
b. shift/reduce
c. Both shift/reduce and reduce/reduce
d. None of the above
Hide Answer Workspace
Answer: b. Shift/reduce
Explanation: None
a. Generic Grammar
b. Left Linear Grammar
c. Right Liner Grammar
d. All of the above
Hide Answer Workspace
Explanation: A right linear grammar is that grammar which contains all the non-
terminals on the right-hand side at the right ends. This grammar can be simply
converted into the DFA.
Hide Answer Workspace
a. Turing language
b. Context-sensitive language
c. Context-free language
d. Regular language
Hide Answer Workspace
Hide Answer Workspace
Explanation: None
47) Which optimization technique is used to reduce the multiple jumps?
Hide Answer Workspace
48) Which of the following term is used to keep track of the location where the current
values of the name are stored?
a. Register descriptor
b. Address descriptor
c. Allocation descriptor
d. Flag register
Hide Answer Workspace
a. Root
b. Interior nodes
c. Leaves
d. Nodes
Hide Answer Workspace
Explanation: In the compiler, interior nodes are specified by the operator symbol.
Hide Answer Workspace
51) Which of the following is used in various stages or phases of the compiler?
a. Records
b. Program
c. Symbol Table
d. Table
Hide Answer Workspace
a. Parse tree
b. Triples
c. Indirect Triples
d. Quadruples
Hide Answer Workspace
Answer: d. Quadruples
53) In which of the following tree, the leaf indicates the operand, and the interior node
represents the operator.
a. Syntax tree
b. Parser tree
c. Structured tree
d. Sematic tree
Hide Answer Workspace
Explanation: Syntax tree is a tree in the compiler which represents operands by leaf and
operator by interior nodes.
Hide Answer Workspace
Answer: a. 3-address
Explanation: None
a. Parse table
b. Input
c. Output
d. Input-Output
Hide Answer Workspace
Answer: d. Input-Output
56) Which of the following function is called the canonical collection of LR(0) item.
a. FIRST
b. GOTO
c. COMPUTE
d. FOLLOW
Hide Answer Workspace
Answer: b. GOTO
Explanation: GOTO is a function that is called for defining the DFA. And, it is called the
canonical collection of LR(0) item.
57) Which of the following option is not a function of the shift-reduce parser?
a. Reduce
b. Accept
c. Go
d. Shift
Hide Answer Workspace
Answer: c. Go
Explanation: The shift-reduce parser contains only shift, reduce, error and accept
action. That's why Go is not a function of the shift-reduce parser.
a. Irregular grammar
b. Regular grammar
c. Operator
d. Precedence grammar
Hide Answer Workspace
Answer: c. Operator
Explanation: Operator grammar is the grammar that does not contain two adjacent
non-terminals on the right side of the production. It is that grammar that defines the
mathematical operators.
59) DFA is an abbreviation of.
Hide Answer Workspace
Hide Answer Workspace