Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q391: Fill in the blank: In CFG, the 'N' set refers to ______.
- A: Non-terminals
- B: Terminals
- C: Productions
- D: Start symbols
View Answer
A
Q392: In the sentence "SheepNoise -> SheepNoise baa | baa", what does 'baa' represent?
- A: Terminal symbol
- B: Non-terminal symbol
- C: Production rule
- D: Start symbol
View Answer
A
Q393: What error type is caused by missing declaration of variable 'sum'?
- A: Semantic error
- B: Syntax error
- C: Runtime error
- D: Linker error
View Answer
A
Q394: What will happen if the return value type does not match the function's declared return type?
- A: Compilation error
- B: Runtime error
- C: No effect
- D: Logical error
View Answer
A
Q395: Fill in the blank: A grammar G generates a language denoted by ______.
- A: L(G)
- B: G(L)
- C: Lang(G)
- D: Gram(L)
View Answer
A
Q396: Which derivation type replaces the leftmost non-terminal first?
- A: Leftmost derivation
- B: Rightmost derivation
- C: Top-down derivation
- D: Bottom-up derivation
View Answer
A
Q397: Which programming language grammar first used rules similar to those described here?
- A: Algol-60
- B: Java
- C: Python
- D: C++
View Answer
A
Q398: What is the purpose of productions (P) in CFG?
- A: Rewrite rules
- B: Terminals
- C: Non-terminals
- D: Start symbol
View Answer
A
Q399: Fill in the blank: Parsing can be described as discovering a ______ for a sentence.
- A: Derivation
- B: Program
- C: Output
- D: Code
View Answer
A
Q400: Which of these is NOT part of the four tuple in CFG?
- A: Start symbol
- B: Terminals
- C: Parser
- D: Productions
View Answer
C