Compiler Design MCQs (Set-2)

LL(1) chooses each production using what amount of lookahead?

A Two parse stacks
B Machine opcode
C One lookahead token
D Whole program scan

The top-down method begins at the start symbol and expands productions; what is it called?

A Top-down parsing
B Bottom-up parsing
C Code scheduling
D Register allocation

During shift-reduce parsing, consuming the next token is which action?

A Emit machine code
B Allocate a register
C Consume next token
D Replace grammar rule

Replacing a handle by its left side is called which parser action?

A Shift
B Reduce
C Scan
D Backpatch

Simple predictive parsing requires rewriting grammars with what property?

A Terminals
B Operator precedence
C Right recursion
D Left recursion

Shared prefixes can be extracted by which technique to delay a choice?

A Code motion
B Constant folding
C Left factoring
D Spilling

Each nonterminal can map to a procedure in which parser style?

A LR parser
B Lexical scanner
C GLR parser
D Recursive descent

FIRST(X) contains what can begin strings derived from X?

A Target labels
B AST children
C FOLLOW(X) tokens
D FIRST(X) terminals

Tokens that may follow X belong to which set?

A Use set
B FOLLOW(X)
C FIRST(X)
D Token class

For S β†’ aA | b, what is FIRST(S)?

A {a, b}
B {b}
C {Ξ΅}
D {a}

In a grammar, Ξ΅ denotes which string?

A End marker
B Start symbol
C Empty string
D Wildcard token

Two rules enter one LL(1) table cell; what does this create?

A Code generation
B Type inference
C Successful reduction
D Parsing conflict

Using one next token to predict a rule describes which parser?

A Assembler
B Predictive parser
C Shift-only parser
D Interpreter

End-of-file is marked by which special token?

A End-of-file
B Epsilon
C Lookahead set
D Start symbol

After a syntax error, synchronization recovery seeks what?

A Known boundary token
B New register
C Operator precedence
D Source comment

Child-node values produce which kind of attributes?

A Child nodes
B Input files
C Machine registers
D Parent scope

Context often travels from parents or siblings through what attributes?

A Lexer states
B Parents or siblings
C Code buffer
D Target labels

With no coercion, integer plus string is rejected during which phase?

A Lexical analysis
B Linking
C Instruction scheduling
D Semantic analysis

Visibility region of a declaration is called what?

A Basic block
B Handle
C Token
D Scope

Shadowed names are looked up first in which scope?

A Global scope
B Target section
C Innermost scope
D Parser state

Three-address code can split t=a*b+c into which sequence?

A t1=a*c; t=t1+b
B t1=a*b; t=t1+c
C t1=a+b; t=t1*c
D t=a*(b+c)

The postfix encoding for a+b*c is what?

A a b c * +
B a b c + *
C a b + c *
D + a * b c

Safe reuse of a prior expression needs what conditions?

A Types are different
B Operands renamed; memory changed
C Operands unchanged; no side effects
D Control flow unknown

Inside Bison error rules, what reserved token may appear?

A EOF
B error
C shift
D epsilon

Compared with a concrete syntax tree, what detail may an AST omit?

A AST removes operators
B AST contains only tokens
C AST stores machine code
D AST omits grammar detail