BEU Compiler Design PYQ Solutions (2022–2024): Complete Solved Objective Questions


Preparing for the B.Tech 6th Semester Compiler Design exam under Bihar Engineering University (BEU)?
Here is a complete, neatly organised, blog-ready set of objective questions from 2022, 2023, and 2024, including all four options and correct answers.

This guide helps you revise faster and score higher in the objective section.


📘 2024: B.Tech 6th Semester Examination

Subject Code: 105601

Q.1 (a) Buffer pair consist of ______ pointers.

(i) phases and phase
(ii) lexeme begin and forward
(iii) assemblers and loaders
(iv) None
Correct Answer: (ii) lexeme begin and forward

Q.1 (b) Compiler running on one machine and produces code for another machine is called:

(i) Bootstrapping
(ii) Complex compiler
(iii) interpreter
(iv) cross compiler
Correct Answer: (iv) cross compiler

Q.1 (c) Which regular expression denotes zero or more instances of a or b?

(i) a/b
(ii) a*/b
(iii) (ab)*
(iv) (a/b)*
Correct Answer: (iv) (a/b)*
(Equivalent to (a+b))*

Q.1 (d) A grammar that produces more than one parse tree is:

(i) Context free
(ii) Recursive
(iii) Context sensitive
(iv) Ambiguous
Correct Answer: (iv) Ambiguous

Q.1 (e) Inherited attribute at a node is computed from attributes of its:

(i) child
(ii) leaf
(iii) Parent and/or sibling
(iv) parent
Correct Answer: (iii) Parent and/or sibling

Q.1 (f) In an S-attributed SDD, all attributes are:

(i) Inherited
(ii) synthesized
(iii) both
(iv) Runtime
Correct Answer: (ii) synthesized

Q.1 (g) If S is the start symbol, which symbol is placed in FOLLOW(S)?

(i) S
(ii) !
(iii) &
(iv) # (or $)
Correct Answer: (iv) #

Q.1 (h) Best bottom-up parsing technique in terms of performance:

(i) SLR
(ii) CLR
(iii) LL(1)
(iv) LALR
Correct Answer: (iv) LALR

Q.1 (i) The ______ maps intermediate representation to target program.

(i) Intermediate Code
(ii) Syntax Analysis
(iii) code generator
(iv) Lexical Analysis
Correct Answer: (iii) code generator

Q.1 (j) Three-address codes can be implemented by:

(i) indirect triple
(ii) Quadruples
(iii) direct triple
(iv) All the above
Correct Answer: (iv) All the above


📘 2023: End Semester Examination

Subject Code: 105601

Q.1 (a) Most powerful parser:

(i) SLR
(ii) LALR
(iii) Canonical LR
(iv) Operator precedence
Correct Answer: (iii) Canonical LR

Q.1 (b) A top-down parser generates:

(i) Rightmost derivation
(ii) Rightmost derivation in reverse
(iii) Left most Derivation
(iv) Left most derivation in reverse
Correct Answer: (iii) Left most Derivation

Q.1 (c) Translation of xxxxyzz for given actions:

(i) 23131
(ii) 11233
(iii) 11231
(iv) 33211
Correct Answer: (i) 23131

Q.1 (d) Three-address code involves:

(i) Exactly 3 addresses
(ii) At most 3 addresses
(iii) No unary operator
(iv) None
Correct Answer: (ii) At most 3 addresses

Q.1 (e) Handle pruning forms basis of:

(i) Bottom up parsing
(ii) Top down parsing
(iii) Predictive parsing
(iv) Recursive descent parsing
Correct Answer: (i) Bottom up parsing

Q.1 (f) Left factoring guarantees:

(i) Not occurring of backtracking
(ii) Cycle free parse tree
(iii) Error free target code
(iv) Correct LL(1) parsing table
Correct Answer: (i) Not occurring of backtracking

Q.1 (g) Left-factored version of A → aS1 | aS2:

(i) A → S1 | S2
(ii) A → aS1 | aS2
(iii) A → aA’
(iv) None of these
Correct Answer: (iii) A → aA’

Q.1 (h) Synthesized attributes are calculated:

(i) From attributes of children
(ii) From parent
(iii) From siblings
(iv) None
Correct Answer: (i) From the values of attributes of the children

Q.1 (i) Method merging bodies of two loops:

(i) Loop rolling
(ii) Loop Jamming
(iii) Constant folding
(iv) None
Correct Answer: (ii) Loop Jamming

Q.1 (j) LALR(1) parser has S-R conflicts iff:

(i) LAR(1) has S-R conflicts
(ii) LR(0) parser has S-R conflicts
(iii) SLR(1) parser has S-R conflicts
(iv) SLR(0) parser has S-R conflicts
Correct Answer: (ii) LR(0) parser has S-R conflicts


📘 2022 / Special Exam 2023

Subject Code: 105601

Q.1 (a) Top-down parser uses:

(i) Leftmost derivation
(ii) Leftmost derivation in reverse
(iii) Rightmost derivation
(iv) Rightmost derivation in reverse
Correct Answer: (i) Leftmost derivation

Q.1 (b) Maximum reduce moves for n tokens (bottom-up parser):

(i) n/2
(ii) n-1
(iii) 2n-1
(iv) 2^n
Correct Answer: (ii) n-1

Q.1 (c) Inherited attributes can be evaluated (bottom-up):

(i) always
(ii) only if L-attributed
(iii) only if synthesized
(iv) never
Correct Answer: (ii) only if L-attributed

Q.1 (d) Grammar S → CC, C → cC | d is:

(i) LL(1)
(ii) SLR(1) but not LL(1)
(iii) LALR(1) but not SLR(1)
(iv) LR(1) but not LALR(1)
Correct Answer: (i) LL(1)

Q.1 (e) Lexical analyzer input/output:

(i) source program → tokens
(ii) token → source program
(iii) Either
(iv) None
Correct Answer: (i) source program, tokens

Q.1 (f) Keywords recognized during:

(i) lexical analysis
(ii) parsing
(iii) code generation
(iv) data flow analysis
Correct Answer: (i) lexical analysis

Q.1 (g) Tokens in: printf("j=%d", &j)

(i) 4
(ii) 5
(iii) 9
(iv) 10
Correct Answer: (iii) 9

Q.1 (h) Parsing precedence relation is defined:

(i) To delimit the handle
(ii) For certain terminal pairs only
(iii) None
(iv) All of the above
Correct Answer: (i) To delimit the handle

Q.1 (i) Grammar E → E*F | F+E | F:

(i) * has higher precedence than +
(ii) – has higher precedence than *
(iii) + and – same
(iv) + higher precedence than *
Correct Answer: (i) * has higher precedence than +

Q.1 (j) Shift-reduce parsers are:

(i) top-down
(ii) bottom-up
(iii) both
(iv) none
Correct Answer: (ii) bottom-up


Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top