MCQ Bank
In attribute grammars, values used to compute inherited attributes flow ____________ in the parse tree.
- A) Top-down
- B) Bottom-up
- C) Top-up
- D) Bottom-down
What is the first step performed by the compiler application when using the dynamic method in attribute grammar evaluation?
- A) Constructing the parse tree
- B) Performing a topological sort
- C) Building the dependence graph
- D) Evaluating attributes in topological order
YACC is commonly used in the development of:
- A) Operating systems
- B) Compilers
- C) Web browsers
- D) Databases
How is a symbol table implemented?
- A) As a stack
- B) As a queue
- C) As an array
- D) As a hash table
In attribute grammars, attributes are distinguished based on the direction of value flow.
- A) False
- B) True
- C)
- D)
In syntax-directed translation, every time the parser encounters an identifier, it stores it in the _______________.
- A) Linear Array
- B) Parsing Stack
- C) Symbol table
- D) Priority Queue
In attribute grammars, a CFG is augmented with a set of ____________.
- A) Terminals
- B) Symbols
- C) Rules
- D) Non-terminals
Selecting an appropriate IR for a compiler project requires an understanding of both the source language and the target machine.
- A) False
- B) True
- C)
- D)
What does LALR(1) stand for?
- A) Look Ahead LL(1)
- B) Look Ahead RL(1)
- C) Look Ahead RR(1)
- D) Look Ahead LR(1)
What is the foundation of the ad-hoc scheme for semantic analysis?
- A) Formal language theory
- B) Abstract syntax trees
- C) Attribute grammars
- D) Compiler optimization techniques
In the oblivious methodology of attribute grammar evaluation, what is ignored during the compilation process?
- A) Attribute design considerations
- B) Attribute values
- C) Attribute dependencies
- D) Attribute rules and parse tree
Which of the following is NOT a typical use of attributed trees in compiler design?
- A) Error handling
- B) Type checking
- C) Optimization
- D) Syntax analysis
Stack-machine code and three-address code are mutually exclusive and cannot be used together in modern compilers.
- A) True
- B) False
- C)
- D)
In YACC, what does the notation $1 refer to?
- A) The second symbol on the left-hand side of a production.
- B) The first symbol on the right-hand side of a production.
- C) The first symbol on the left-hand side of a production.
- D) The second symbol on the right-hand side of a production.
Which tool uses the '$' notation to refer to values of symbols on the right-hand side of grammar productions?
- A) YACC
- B) Bison
- C) Flex
- D) Lex
If "A → B C D" is a production, then B is a child node of ____________ node.
- A) C
- B) B
- C) D
- D) A
Which type of intermediate representation is typically used in compilers for advanced optimization techniques?
- A) Three-address code
- B) Byte code
- C) Stack-machine code
- D) Assembly code
Abstract Syntax Tree is less concise than a parse tree.
- A) False
- B) True
- C)
- D)
In three-address code, how many bytes are typically used to represent operations?
- A) 3 to 4 bytes
- B) 7 to 8 bytes
- C) 5 to 6 bytes
- D) 1 to 2 bytes
Which section in a YACC specification file contains the "tokens definitions"?
- A) Fourth Section
- B) First Section
- C) Third Section
- D) Second Section