MIPS assembly language is specific to which computer architecture?
a) x86
b) ARM
c) MIPS
d) PowerPC
What is the main purpose of an assembler in the context of compiler construction?
a) To generate optimized machine code
b) To convert high-level programming languages into assembly language
c) To convert assembly language into machine code
d) To perform syntax analysis of the source code
Regular languages can be recognized by which type of automaton?
a) Finite automaton
b) Pushdown automaton
c) Turing machine
d) Both a finite automaton and a pushdown automaton
Which automaton model is used for lexical analysis and scanning?
a) Finite automaton
b) Pushdown automaton
c) Turing machine
d) Both a finite automaton and a pushdown automaton
Regular expressions are used for:
a) Defining context-free grammars
b) Describing patterns and matching strings
c) Parsing ambiguous languages
d) Generating code for procedures
Which component of a compiler is responsible for identifying tokens in the source
code?
a) Regular expressions
b) Context-free grammar
c) Scanner
d) Code generator
Context-free grammars are used to define the:
a) Semantics of a programming language
b) Syntax of a programming language
c) Regular expressions of a programming language
d) Code optimization techniques of a programming language
Top-down parsing is also known as:
a) Recursive descent parsing
b) Shift-reduce parsing
c) LR parsing
d) LALR parsing
Bottom-up parsing is also known as:
a) Recursive descent parsing
b) Shift-reduce parsing
c) LR parsing
d) LALR parsing
Context-sensitive analysis in compiler construction involves:
a) Checking for lexical errors in the source code
b) Performing type checking and scope analysis
c) Generating intermediate code
d) Converting regular expressions into finite automata
Code generation in compiler construction refers to:
a) Translating source code into assembly language or machine code
b) Checking for syntax errors in the source code
c) Optimizing the execution speed of the compiled code
d) Parsing the source code to build a parse tree
Linkers are responsible for:
a) Converting high-level programming languages into assembly language
b) Combining object files to create an executable program
c) Performing runtime memory management
d) Analyzing the semantics of the source code
Heap management in compiler construction involves:
a) Handling memory allocation and deallocation for dynamic objects
b) Optimizing code execution on the heap
c) Parsing the heap section of the source code
d) Converting heap-based data structures into assembly code
Which stage of the compilation process is responsible for optimizing the code?
a) Scanning
b) Parsing
c) Code generation
d) Optimization
Which of the following is not a common optimization technique used in compiler
construction?
a) Loop unrolling
b) Dead code elimination
c) Register allocation
d) Syntax analysis
Which component is responsible for loading object code into memory and resolving
external references?
a) Assembler
b) Linker
c) Loader
d) Scanner
The purpose of a symbol table in compiler construction is to:
a) Store intermediate code
b) Handle lexical analysis of the source code
c) Manage memory allocation
d) Store information about identifiers in the program
Which data structure is commonly used for implementing a symbol table?
a) Stack
b) Queue
c) Hash table
d) Binary tree
What is the primary goal of code optimization in compiler construction?
a) To reduce the size of the source code
b) To improve the readability of the code
c) To generate machine code from the source code
d) To improve the performance of the compiled code
In compiler construction, what is the purpose of code generation for procedures?
a) To handle memory management for procedures
b) To generate assembly code for procedure calls and returns
c) To optimize the execution of procedures
d) To perform syntax analysis of procedure definitions
Answers:
c) MIPS
c) To convert assembly language into machine code
a) Finite automaton
a) Finite automaton
b) Describing patterns and matching strings
c) Scanner
b) Syntax of a programming language
a) Recursive descent parsing
b) Shift-reduce parsing
b) Performing type checking and scope analysis
a) Translating source code into assembly language or machine code
b) Combining object files to create an executable program
a) Handling memory allocation and deallocation for dynamic objects
d) Optimization
d) Syntax analysis
c) Loader
d) Store information about identifiers in the program
c) Hash table
d) To improve the performance of the compiled code
b) To generate assembly code for procedure calls and returns