Subjectnest.com
  • Home
  • About
  • Contact
  • Privacy Policy
    • Terms of Use
    • Cookie Privacy Policy
    • California Consumer Privacy Act (CCPA)
    • DMCA
  • Free Tools
Menu
  • Home
  • About
  • Contact
  • Privacy Policy
    • Terms of Use
    • Cookie Privacy Policy
    • California Consumer Privacy Act (CCPA)
    • DMCA
  • Free Tools

Marketing MCQs

SEO MCQs

Social Media Marketing MCQs

Content Marketing MCQs

Digital Marketing MCQs

Pay-Per-Click (PPC) MCQs

Email Marketing MCQs

Mobile Marketing MCQs

Online Marketing MCQs

YouTube Marketing MCQs

Conversion Rate Optimization MCQs

Exam Preparation MCQs

MDCAT Support & Movement MCQs

MDCAT Alcohols and Phenols MCQs

MDCAT Dawn of Modern Physics MCQs

CSS English MCQs

CSS Business Administration MCQs

CSS Anthropology MCQs

Nts Multiple Choice

MDCAT Variation & Genetics MCQs

MDCAT Aldehydes and Ketones MCQs

MDCAT Spectra MCQs

CSS Pakistan Affairs MCQs

CSS Town Planning & Urban Management MCQs

CSS Pashto MCQs

NTS English Preparation Mcqs

MDCAT Fundamentals of Chemistry MCQs

MDCAT Acids MCQs

MDACT Nuclear Physics MCQs

CSS Current Affairs MCQs

CSS Computer Science MCQs

CSS Persian MCQs

NTS Physics Preparation Mcqs

MDCAT Gases MCQs

MDCAT Molecules MCQs

PPSC General Knowledge MCQs

CSS Islamic Studies MCQs

CSS International Relations MCQs

CSS Punjabi MCQs

MDCAT IMPORTANT MCQs

MDCAT Liquid MCQs

PPSC Solved MCQs Part 1

PPSC Current Affairs MCQs

CSS Comparative Study MCQs

CSS Political Science MCQs

CSS Constitutional Law MCQs

MDCAT Kingdom Animalia MCQs

MDCAT Solid MCQs

MDCAT Force and Motion MCQs

PPSC Pakistan Studies MCQs

CSS Geology MCQs

CSS Gender Studies MCQs

CSS International Law MCQs

Nervous & Chemical Coordination MCQs

MDCAT Chemical Equilibrium MCQs

MDCAT Work and Energy MCQs

PPSC Islamic Studies MCQs

CSS Statistics MCQs

CSS Environmental Science MCQs

CSS Muslim Law & Jurisprudence MCQs

MDCAT Cell Structure & Function MCQs

MDCAT Thermochemistry MCQs

MDCAT Rotational and Circular Motion MCQs

PPSC Geography MCQs

CSS History of Pakistan and India MCQs

CSS Agriculture and Forestry MCQs

CSS Mercantile Law MCQs

MDCAT Biological Molecules (Biomolecules) MCQs

MDCAT Electrochemistry MCQs

MDCAT Waves MCQs

PPSC English MCQs

CSS Accountancy & Auditing MCQs

CSS Botany MCQs

CSS Criminology MCQs

MDCAT Bioenergetics MCQs

MDCAT English MCQs

MDCAT Thermodynamics MCQs

PPSC Urdu MCQs

CSS Economics MCQs

CSS Zoology MCQs

CSS Philosophy MCQs

MDCAT Biodiversity (Variety of Life ) MCQs

MDCAT Chemical Bonding MCQs

MDCAT Electrostatics MCQs

PPSC Everyday Science MCQs

CSS Islamic History & Culture MCQs

CSS English Literature MCQs

CSS Arabic MCQs

MDCAT Enzymes MCQs

MDCAT S and P Block Elements MCQs

MDCAT Current Electricity MCQs

PPSC Computer MCQs

CSS British History MCQs

CSS Law MCQs

MDCAT Evolution MCQs

MDACT Transition Elements MCQs

MDCAT Electromagnetism MCQs

PPSC Mathematics MCQs

CSS European History MCQs

CSS Journalism & Mass Communication MCQs

MDCAT Nutrition & Gaseous Exchange MCQs

MDCAT Organic Chemistry MCQs

MDCAT Electromagnetic Induction MCQs

CSS Physics MCQs

CSS History of the USA MCQs

CSS Psychology MCQs

MDCAT Prokaryotes MCQs

MDCAT Hydrocarbons MCQs

MDCAT Electronics MCQs

CSS Chemistry MCQs

CSS Public Administration MCQs

CSS Geography MCQs

Compiler Construction MCQs

This comprehensive set of Compiler Construction MCQs is designed to cover all essential topics required for success in exams related to compiler design and implementation. Focused on key subjects such as lexical analysis, syntax analysis, semantic analysis, optimization, and code generation, these MCQs are crafted to help students build a strong foundation in compiler construction concepts and techniques.

Who should practice Compiler Construction MCQs?

  • Students preparing for courses in computer science, software engineering, or IT that cover compiler construction and language processing.
  • Individuals aiming to strengthen their understanding of the phases of a compiler, including tokenization, parsing, and code optimization.
  • Candidates preparing for competitive exams or certifications that assess knowledge of compiler design and programming language theory.
  • Learners interested in mastering concepts like regular expressions, context-free grammars, intermediate code generation, and runtime environments.
  • Professionals focused on improving their skills in building compilers, interpreters, and language processors.
  • Suitable for all aspirants seeking to enhance their knowledge and performance in compiler construction for academic or professional success.
 

 

1. What is the main purpose of a compiler?

A) To translate source code into machine code
B) To interpret code line by line
C) To store data in memory
D) To manage hardware devices

View Answer
A

 

2. What is “lexical analysis” in compiler design?

A) The process of converting a sequence of characters into tokens
B) The optimization of code
C) The linking of object files
D) The execution of source code

View Answer
A

 

3. What is the output of a lexical analyzer?

A) Tokens
B) Machine code
C) Syntax tree
D) Assembly code

View Answer
A

 

4. What does a “syntax tree” represent in a compiler?

A) The hierarchical structure of the source code based on grammar rules
B) The machine code generated by the compiler
C) The memory layout of variables
D) The execution order of instructions

View Answer
A

 

5. What is “semantic analysis” in a compiler?

A) Ensuring that the meaning of the program is correct
B) Checking memory allocation
C) Converting high-level code to machine code
D) Managing input and output devices

View Answer
A

 

6. What is “code generation” in compiler design?

A) The phase where machine code is generated from intermediate code
B) The translation of tokens to machine language
C) The optimization of source code
D) The error-checking phase

View Answer
A

 

7. What is the role of “optimization” in a compiler?

A) To improve the efficiency of the generated code
B) To find errors in the program
C) To translate code into assembly language
D) To perform lexical analysis

View Answer
A

 

8. What is an “intermediate code” in compiler construction?

A) A platform-independent code between source code and machine code
B) A machine-level instruction set
C) The final executable code
D) The high-level source code

View Answer
A

 

9. What is “back-end” in compiler design?

A) The phase responsible for code generation and optimization
B) The phase for lexical and syntax analysis
C) The error-handling component
D) The part of the compiler that interprets the source code

View Answer
A

 

10. What is a “context-free grammar” (CFG)?

A) A set of rules that describe the syntax of a language
B) A technique used to optimize code
C) A method to generate machine code
D) A data structure used to store tokens

View Answer
A

 

11. Which of the following is NOT a phase of the compiler?

A) Parsing
B) Linkage editing
C) Code optimization
D) Syntax analysis

View Answer
B

 

12. What is a “token”?

A) The smallest unit of a program recognized by the lexical analyzer
B) A memory address
C) A function in the source code
D) A syntax tree node

View Answer
A

 

13. What is the role of a “symbol table” in compiler construction?

A) To store information about variables and functions
B) To optimize machine code
C) To translate high-level code into intermediate code
D) To manage the execution of the program

View Answer
A

 

14. Which phase of the compiler checks for syntax errors?

A) Syntax analysis
B) Lexical analysis
C) Semantic analysis
D) Code generation

View Answer
A

 

15. What is the purpose of “error handling” in a compiler?

A) To detect and report errors during compilation
B) To optimize the code
C) To link external libraries
D) To perform code generation

View Answer
A

 

16. What is an “abstract syntax tree” (AST)?

A) A simplified, abstract version of a syntax tree
B) The final output of code generation
C) A part of the intermediate code
D) A technique used for code optimization

View Answer
A

 

17. What is “peephole optimization”?

A) A local optimization technique used to improve small sections of code
B) A method for lexical analysis
C) A technique for generating tokens
D) A phase that handles error detection

View Answer
A

 

18. What does “LR parser” stand for?

A) Left-to-right, Rightmost derivation
B) Left-to-right, Leftmost derivation
C) Right-to-left, Rightmost derivation
D) Right-to-left, Leftmost derivation

View Answer
A

 

19. What is “bootstrapping” in compiler design?

A) Writing a compiler in the same language it is meant to compile
B) The process of loading an operating system
C) Optimizing machine code
D) Interpreting the high-level source code

View Answer
A

 

20. What is a “top-down parser”?

A) A parser that starts from the highest level of the parse tree and works downwards
B) A parser that starts from the tokens and works upwards
C) A parser that checks the semantic rules of the program
D) A technique for error correction

View Answer
A

 

21. Which of the following is a “bottom-up parsing” technique?

A) LR parsing
B) Predictive parsing
C) Top-down parsing
D) Recursive descent parsing

View Answer
A

 

22. What is “interpreter” in terms of compilation?

A) A program that executes source code line by line
B) A phase of the compiler responsible for code generation
C) A data structure used for syntax analysis
D) A technique for optimizing the source code

View Answer
A

 

23. What is a “recursive descent parser”?

A) A top-down parser built from a set of mutually recursive procedures
B) A parser that uses machine code to interpret programs
C) A parser that generates tokens
D) A type of bottom-up parser

View Answer
A

 

24. What does “shift-reduce parsing” refer to?

A) A bottom-up parsing technique used by LR parsers
B) A top-down parsing technique used by predictive parsers
C) A method for error handling
D) A method of token generation

View Answer
A

 

25. What is the purpose of a “parser” in a compiler?

A) To check the syntax of the source code
B) To optimize the generated code
C) To generate machine code
D) To manage input/output devices

View Answer
A

 

26. What is the purpose of “symbol resolution” in a compiler?

A) To determine the correct location for variables and functions
B) To generate machine code
C) To optimize code
D) To perform lexical analysis

View Answer
A

 

27. Which parser uses “predictive parsing”?

A) LL parser
B) LR parser
C) Shift-reduce parser
D) Recursive descent parser

View Answer
A

 

28. What is the function of “semantic analysis” in a compiler?

A) To ensure that variables are declared and used correctly
B) To detect syntax errors
C) To generate machine code
D) To convert tokens into intermediate code

View Answer
A

 

29. What is “cross-compiling”?

A) Compiling code for a platform different from the one the compiler is running on
B) Linking external libraries during compilation
C) Translating source code into an interpreted language
D) Generating machine code from intermediate code

View Answer
A

 

30. What is “three-address code” in compiler construction?

A) An intermediate code where each instruction has at most three operands
B) A memory address in the machine code
C) A method for semantic analysis
D) A type of error handling technique

View Answer
A

 

31. Which of the following is NOT a part of intermediate code generation?

A) Syntax analysis
B) Three-address code
C) Quadruples
D) Triples

View Answer
A

 

32. What is “dangling else” in compiler design?

A) An ambiguity in nested if-else statements
B) An optimization technique
C) A method for syntax checking
D) A type of runtime error

View Answer
A

 

33. What is “inline expansion” in compiler optimization?

A) Replacing a function call with the actual code of the function
B) Removing unreachable code
C) Rearranging loops for better performance
D) Allocating memory for variables

View Answer
A

 

34. What is the purpose of “dead code elimination”?

A) To remove code that does not affect the program’s output
B) To remove syntax errors
C) To check semantic consistency
D) To generate machine code

View Answer
A

 

35. What is a “basic block” in compiler optimization?

A) A sequence of consecutive statements with no branches except at the end
B) A memory block used for variable allocation
C) A block of machine code
D) A syntax tree node

View Answer
A

 

36. Which of the following is NOT a phase of the front-end of the compiler?

A) Code optimization
B) Lexical analysis
C) Syntax analysis
D) Semantic analysis

View Answer
A

 

37. What is the role of a “code generator” in a compiler?

A) To convert intermediate code into machine code
B) To detect and report errors in the source code
C) To perform syntax analysis
D) To optimize the intermediate code

View Answer
A

 

38. What is “register allocation” in a compiler?

A) Assigning variables to processor registers to reduce memory access
B) Optimizing code by removing dead variables
C) Linking external libraries
D) Checking for syntax errors

View Answer
A

 

39. What is “constant folding” in compiler optimization?

A) Evaluating constant expressions at compile time
B) Removing redundant code
C) Generating machine code
D) Converting source code into tokens

View Answer
A

 

40. What is the purpose of a “linker”?

A) To combine multiple object files into a single executable
B) To optimize machine code
C) To perform lexical analysis
D) To manage memory allocation

View Answer
A

 

41. What is “backpatching” in compiler design?

A) A technique used to handle forward jumps in code generation
B) An optimization technique
C) A method for syntax analysis
D) A form of code generation

View Answer
A

 

42. What does “bootstrapping” a compiler mean?

A) Using a compiler to compile itself
B) Optimizing machine code
C) Performing lexical analysis
D) Linking object files

View Answer
A

 

43. What is “left factoring” in parsing?

A) A grammar transformation to remove common prefixes in productions
B) A technique to optimize machine code
C) A type of error checking
D) A method for semantic analysis

View Answer
A

 

44. What does “Yacc” stand for in compiler construction tools?

A) Yet Another Compiler-Compiler
B) Yet Another Code Converter
C) Your Actual Compiler Creator
D) Your Advanced Code Compiler

View Answer
A

 

45. What is “interprocedural optimization”?

A) Optimizing across function calls and procedures
B) Optimizing loops within a function
C) Removing unreachable code
D) Generating object code

View Answer
A

 

46. What is “loop unrolling” in compiler optimization?

A) A technique to reduce loop overhead by executing multiple iterations in a single loop
B) Replacing a loop with a recursive function
C) Removing unreachable code from a loop
D) Evaluating loop conditions at compile time

View Answer
A

 

47. What does “CFG” stand for in the context of compilers?

A) Control Flow Graph
B) Constant Function Generator
C) Code Format Generator
D) Compiler Function Graph

View Answer
A

 

48. What is “intermediate representation” (IR) in a compiler?

A) A platform-independent representation of code between high-level language and machine code
B) The source code after lexical analysis
C) A memory representation of variables
D) A data structure used for syntax analysis

View Answer
A

 

49. What is “copy propagation” in compiler optimization?

A) Replacing the occurrences of variables that hold constant values
B) Removing dead code
C) Loop optimization technique
D) Code generation technique

View Answer
A

 

50. What is the main goal of “machine-independent optimization”?

A) To optimize code without considering the target machine architecture
B) To generate machine code
C) To reduce memory consumption
D) To translate high-level code into assembly

View Answer
A

 

51. What is “constant propagation” in compiler optimization?

A) Replacing variables with constant values when possible
B) Removing loops that do not affect output
C) Evaluating expressions at runtime
D) Reordering instructions for better performance

View Answer
A

 

52. What is “loop fusion” in compiler optimization?

A) Merging two loops that have the same iteration space
B) Unrolling loops for optimization
C) Eliminating unreachable code in a loop
D) Converting recursive functions to loops

View Answer
A

 

53. What does “data flow analysis” focus on in compilers?

A) Analyzing the flow of data through the variables and expressions in the program
B) Tracking the flow of control statements
C) Linking different program modules
D) Managing memory allocation for variables

View Answer
A

 

54. What is “live variable analysis” in compilers?

A) Determining which variables hold values that will be used in the future
B) Analyzing dead code
C) Checking if variables are initialized
D) Detecting memory leaks in the program

View Answer
A

 

55. What is “operator strength reduction” in compiler optimization?

A) Replacing expensive operations with equivalent cheaper ones
B) Eliminating dead code
C) Removing unnecessary loops
D) Replacing functions with inline code

View Answer
A

 

56. Which of the following is NOT an optimization technique?

A) Dead code elimination
B) Constant folding
C) Syntax analysis
D) Loop unrolling

View Answer
C

 

57. What is a “phase” in the context of a compiler?

A) A specific stage of the compilation process, such as lexical analysis or code generation
B) A data structure for storing tokens
C) A method for semantic analysis
D) A section of machine code

View Answer
A

 

58. What is “tail recursion” in compilers?

A) A form of recursion where the recursive call is the last operation in the function
B) A method for generating tokens
C) An optimization that eliminates unreachable code
D) A type of error in lexical analysis

View Answer
A

 

59. What does the “front-end” of a compiler focus on?

A) Analyzing and processing the source code
B) Optimizing the generated machine code
C) Linking external libraries
D) Executing the compiled code

View Answer
A

 

60. What is “loop invariant code motion” in compiler optimization?

A) Moving code that does not change during a loop outside the loop
B) Removing unreachable code in loops
C) Unrolling loops for better performance
D) Replacing a loop with recursive function calls

View Answer
A

 

61. What is “register spilling” in compiler optimization?

A) Storing variables in memory when there are not enough registers
B) Allocating registers for variables
C) Removing redundant code from loops
D) Evaluating expressions at compile time

View Answer
A

 

62. What is “hoisting” in compiler optimization?

A) Moving statements outside of loops if they are loop invariant
B) Unrolling loops for better performance
C) Inlining functions to reduce call overhead
D) Generating machine code

View Answer
A

 

63. What is the purpose of “loop interchange” in compiler optimization?

A) To improve cache performance by changing the nesting order of loops
B) To remove loops that are not used
C) To replace recursive function calls with loops
D) To eliminate dead code

View Answer
A

 

64. What is “spill code” in compiler design?

A) Instructions that save or load values to/from memory when registers are full
B) Redundant code that is eliminated by the compiler
C) Machine-independent code that is generated by the front-end
D) Optimized machine code for a specific architecture

View Answer
A

 

65. What is the purpose of “function inlining” in compiler optimization?

A) To replace a function call with the actual code of the function
B) To generate tokens from source code
C) To reduce the depth of recursive calls
D) To check the semantic correctness of the code

View Answer
A

 

66. What is “syntax-directed translation” in compiler construction?

A) Generating intermediate code based on the syntax rules of the language
B) Checking for syntax errors
C) Linking external libraries
D) Performing semantic analysis

View Answer
A

 

67. What is the role of a “peephole optimizer” in a compiler?

A) To perform local optimization on small sections of code
B) To detect and report errors in the source code
C) To generate tokens from source code
D) To convert intermediate code into machine code

View Answer
A

 

68. What is “data dependency analysis” in compiler optimization?

A) Analyzing the dependencies between variables and expressions
B) Analyzing the control flow of a program
C) Allocating memory for variables
D) Linking object files

View Answer
A

 

69. Which of the following is a bottom-up parsing technique?

A) LR parsing
B) LL parsing
C) Recursive descent parsing
D) Predictive parsing

View Answer
A

 

70. What is “lexical scoping”?

A) The scope of variables is determined by their position in the source code
B) The dynamic scope of variables is determined during runtime
C) Managing memory during code generation
D) Checking for semantic errors

View Answer
A

 

71. What does the “back-end” of a compiler focus on?

A) Code generation and optimization
B) Syntax and semantic analysis
C) Token generation
D) Error detection

View Answer
A

 

72. What is the purpose of “control flow analysis”?

A) To determine the flow of control in the program through loops, branches, and function calls
B) To analyze memory allocation for variables
C) To check for syntax errors in the source code
D) To generate machine code

View Answer
A

 

73. What is “alias analysis” in compiler optimization?

A) Determining if different variables refer to the same memory location
B) Checking if variables are used before initialization
C) Determining the type of variables in the source code
D) Checking for syntax errors

View Answer
A

 

74. What is “folding” in compiler optimization?

A) The process of evaluating constant expressions at compile time
B) Eliminating unreachable code
C) Generating machine code
D) Optimizing loops for performance

View Answer
A

 

75. What is a “left-recursive grammar”?

A) A grammar where the left-most non-terminal in a production refers to itself
B) A grammar with ambiguous productions
C) A grammar that cannot be parsed by a recursive descent parser
D) A grammar that uses both top-down and bottom-up parsing techniques

View Answer
A

 

76. What is “left factoring” in a compiler?

A) A grammar transformation used to remove ambiguity
B) A method for optimizing code
C) A type of error in syntax analysis
D) A technique for lexical analysis

View Answer
A

 

77. What is “right recursion” in a context-free grammar?

A) When a non-terminal appears at the right end of the production
B) When a non-terminal appears at the left end of the production
C) An error in the syntax of the program
D) A method for semantic analysis

View Answer
A

 

78. What is the purpose of “static single assignment” (SSA) form in compiler optimization?

A) To ensure that each variable is assigned exactly once
B) To analyze the control flow of a program
C) To perform semantic analysis
D) To check for syntax errors

View Answer
A

 

79. What is “type inference” in compiler design?

A) Determining the data types of variables based on their usage
B) Checking if variables are used before initialization
C) Analyzing the flow of control statements
D) Generating intermediate code

View Answer
A

 

80. What is “abstract interpretation” in compiler construction?

A) A method for statically analyzing programs to predict their runtime behavior
B) A technique for performing lexical analysis
C) A method for generating tokens from source code
D) A phase of code generation

View Answer
A

 

81. What is “parser generator”?

A) A tool that generates a parser from a formal grammar
B) A tool that performs lexical analysis
C) A tool that generates machine code
D) A tool that generates tokens

View Answer
A

 

82. Which of the following parsing methods is top-down?

A) LL parsing
B) LR parsing
C) Shift-reduce parsing
D) SLR parsing

View Answer
A

 

83. What does “grammar ambiguity” mean?

A) When a grammar produces more than one parse tree for the same input string
B) When a grammar has no production rules
C) When a grammar cannot be parsed by an LL parser
D) When a grammar generates tokens with the same name

View Answer
A

 

84. What is the role of “semantic actions” in a parser?

A) To specify the meaning of tokens and grammar productions during parsing
B) To detect and report syntax errors
C) To generate machine code
D) To perform lexical analysis

View Answer
A

 

85. What is “recursive descent parsing”?

A) A top-down parsing technique that uses a set of recursive procedures to process input
B) A bottom-up parsing method
C) A parsing technique used for ambiguous grammars
D) A method for error detection in syntax analysis

View Answer
A

 

86. What is “backtracking” in a parser?

A) The process of revisiting earlier choices when parsing fails
B) A form of lexical analysis
C) A type of semantic analysis
D) A method for error reporting

View Answer
A

 

87. What is the purpose of “error recovery” in parsing?

A) To continue parsing even after detecting errors in the source code
B) To terminate the compilation process when an error is found
C) To optimize machine code generation
D) To perform semantic analysis

View Answer
A

 

88. What is the main characteristic of “shift-reduce” parsing?

A) It builds a parse tree by shifting tokens onto a stack and reducing them according to grammar rules
B) It recursively descends through the grammar rules
C) It uses a top-down approach to process input
D) It requires backtracking for error recovery

View Answer
A

 

89. What is “SLR” in parsing?

A) Simple LR parsing, a type of bottom-up parser
B) Simple lexical recursion, a type of top-down parser
C) Simple left recursion, a type of ambiguous grammar
D) Shift-left-right, a token generation method

View Answer
A

 

90. What is “cyclic dependency” in compiler construction?

A) A situation where two or more modules depend on each other, forming a cycle
B) A technique for code optimization
C) An error in lexical analysis
D) A phase of code generation

View Answer
A

 

91. What is “type checking” in compilers?

A) Ensuring that variables and expressions are used in ways consistent with their data types
B) Generating tokens based on data types
C) Allocating memory for variables
D) Optimizing the intermediate code

View Answer
A

 

92. What is a “finite automaton” used for in compilers?

A) Recognizing patterns in tokens during lexical analysis
B) Parsing the syntax of the source code
C) Optimizing the generated machine code
D) Performing semantic analysis

View Answer
A

 

93. What is “lexical error” in compiler construction?

A) An error in the process of token generation from the source code
B) An error in the semantic analysis phase
C) A runtime error caused by incorrect code generation
D) An optimization issue in the back-end of the compiler

View Answer
A

 

94. What is “dangling pointer” in programming languages?

A) A pointer that does not point to a valid memory location
B) A variable that has not been initialized
C) An expression that causes syntax errors
D) A function that causes a semantic error

View Answer
A

 

95. What is “symbol table” in compiler construction?

A) A data structure used to store information about variables, functions, and objects in a program
B) A table that stores tokens generated by the lexical analyzer
C) A table used to optimize the intermediate code
D) A table that stores error messages

View Answer
A

 

96. What is “peephole optimization” used for in a compiler?

A) Performing small, local optimizations on the generated machine code
B) Removing unreachable code
C) Analyzing the control flow of the program
D) Allocating memory for variables

View Answer
A

 

97. What is “ambiguity” in a context-free grammar?

A) When a grammar can generate more than one parse tree for the same string
B) When a grammar cannot produce any valid string
C) When a grammar is left-recursive
D) When a grammar produces a syntax error

View Answer
A

 

98. What does “LR(1)” mean in parser design?

A) Left-to-right scanning of the input with 1 lookahead token
B) Left-recursive grammar parsing with 1 lookahead token
C) Right-to-left parsing with 1 token of lookahead
D) Recursive descent parsing with 1 lookahead token

View Answer
A

 

99. What is “left recursion” in a grammar?

A) When a non-terminal appears as the left-most symbol in one of its own productions
B) When a non-terminal appears as the right-most symbol in its own production
C) When a grammar can be parsed only by an LR parser
D) When a grammar is used for semantic analysis

View Answer
A

 

100. What is “parsing” in compiler construction?

A) Analyzing the syntactic structure of the source code
B) Generating tokens from the source code
C) Linking object files
D) Performing optimization on the machine code

View Answer
A

 

101. What is the role of “intermediate code generation”?

A) To generate a platform-independent representation of the source code
B) To optimize the source code
C) To detect syntax errors
D) To link different object files

View Answer
A

 

102. What is the purpose of a “code generator” in the compilation process?

A) To convert intermediate code into machine code
B) To perform lexical analysis
C) To perform syntax analysis
D) To optimize the generated machine code

View Answer
A

 

103. What is “loop peeling” in compiler optimization?

A) Removing the first or last iteration from a loop to optimize performance
B) Unrolling loops for better performance
C) Replacing loops with recursive functions
D) Eliminating loops that have no effect on the program

View Answer
A

 

104. What is “attribute grammar” in compiler construction?

A) A type of grammar where each production rule has associated attributes that provide semantic information
B) A grammar used for lexical analysis
C) A grammar used to generate machine code
D) A method for optimizing intermediate code

View Answer
A

 

105. What is the role of a “semantic analyzer” in a compiler?

A) To ensure that the source code adheres to the rules of the programming language
B) To generate tokens from the source code
C) To generate machine code
D) To link external libraries

View Answer
A

 

106. What is “register allocation” in compiler construction?

A) The process of assigning variables to processor registers
B) The process of allocating memory for variables
C) The process of analyzing the control flow of a program
D) The process of performing lexical analysis

View Answer
A

 

107. What is “token” in lexical analysis?

A) A sequence of characters that form a meaningful unit
B) A symbol in the symbol table
C) A variable name in the source code
D) A machine instruction in the generated code

View Answer
A

 

108. What is “context-free grammar” used for in a compiler?

A) To describe the syntax of a programming language
B) To perform semantic analysis
C) To generate machine code
D) To allocate memory for variables

View Answer
A

 

109. What is the “role of a scanner” in a compiler?

A) To read the source code and generate tokens
B) To perform syntax analysis
C) To optimize the code
D) To link external libraries

View Answer
A

 

110. What is the “difference between syntax-directed definition and syntax-directed translation”?

A) Syntax-directed definition specifies attribute evaluation rules, while syntax-directed translation defines how these attributes are used to generate intermediate code
B) Syntax-directed translation is used only for optimization
C) Syntax-directed definition is used for lexical analysis
D) Syntax-directed translation performs memory management

View Answer
A

 

111. What is “lexeme” in lexical analysis?

A) A sequence of characters in the source program that matches the pattern for a token
B) A variable name in the symbol table
C) A keyword in a programming language
D) A function call in the source code

View Answer
A

 

112. What is “bottom-up parsing”?

A) A parsing technique that starts from the input symbols and builds the parse tree by combining smaller subtrees
B) A parsing method that uses recursive descent
C) A technique used to generate machine code
D) A method for resolving ambiguities in a grammar

View Answer
A

 

113. What is “epsilon production” in context-free grammars?

A) A production rule where the right-hand side is empty (i.e., it produces the empty string)
B) A rule used to generate tokens
C) A type of error in lexical analysis
D) A method for error recovery in parsing

View Answer
A

 

114. What is “LL parser”?

A) A top-down parser that scans the input from left to right and produces a leftmost derivation
B) A bottom-up parser that scans the input from right to left
C) A parser that uses predictive parsing
D) A parser that performs semantic analysis

View Answer
A

 

115. What is “error production” in a grammar?

A) A production rule added to a grammar to allow the parser to handle errors
B) A type of optimization in the code generation phase
C) A method for resolving ambiguities in context-free grammar
D) A rule that generates tokens for error messages

View Answer
A

 

116. What is the role of a “postfix notation” in compiler design?

A) It is used for representing expressions where operators follow their operands, making it easier to evaluate without parentheses
B) It is a method for lexical analysis
C) It is a syntax used for defining grammar rules
D) It is a technique for optimizing intermediate code

View Answer
A

 

117. What is “token stream” in compiler design?

A) A sequence of tokens generated by the lexical analyzer
B) A sequence of machine instructions
C) A list of variables in the source code
D) A set of semantic rules

View Answer
A

 

118. What is “recursive descent parser”?

A) A parser that consists of a set of recursive procedures for each non-terminal in the grammar
B) A parser that generates tokens
C) A parser that performs code optimization
D) A parser that performs bottom-up parsing

View Answer
A

 

119. What is “intermediate representation” in a compiler?

A) A code form between the source code and the machine code, used for optimization and code generation
B) A phase of syntax analysis
C) A type of parsing method
D) A representation used for memory allocation

View Answer
A

 

120. What is “three-address code” in compiler design?

A) A form of intermediate code where each instruction contains at most three operands
B) A type of machine code
C) A data structure for semantic analysis
D) A method for register allocation

View Answer
A

 

121. What is “loop unrolling” in compiler optimization?

A) Expanding the iterations of a loop to reduce the overhead of the loop control
B) Eliminating loops that are never executed
C) Merging two loops into one
D) Replacing recursive calls with iterative loops

View Answer
A

 

122. What is “abstract syntax tree” (AST) in a compiler?

A) A tree representation of the abstract syntactic structure of the source code
B) A list of tokens generated by the lexical analyzer
C) A method for error recovery
D) A machine code representation

View Answer
A

 

123. What is the purpose of “machine-independent optimization”?

A) To optimize the intermediate code so that it can be efficiently translated into machine code for any platform
B) To optimize the code for a specific machine
C) To generate machine code directly
D) To allocate memory during runtime

View Answer
A

 

124. What is the “grammar” of a language?

A) A formal set of rules that defines the structure and syntax of a language
B) A list of all tokens in the language
C) A set of machine instructions
D) A type of intermediate code

View Answer
A

 

125. What is “lexical analyzer generator”?

A) A tool that automatically generates a lexical analyzer based on regular expressions
B) A tool that generates machine code
C) A tool that performs syntax analysis
D) A tool for code optimization

View Answer
A

 

126. What is the purpose of “syntax tree” in a compiler?

A) To represent the hierarchical structure of the source code based on the grammar rules
B) To store variable names and types
C) To generate tokens from the source code
D) To optimize machine code

View Answer
A

 

127. What is “control flow graph” in compiler construction?

A) A representation of all the paths that might be traversed through a program during its execution
B) A list of all the variables in the source code
C) A type of abstract syntax tree
D) A method for semantic analysis

View Answer
A

 

128. What is “peephole optimization”?

A) A technique for making small improvements to a small section of generated code
B) A method for eliminating dead code
C) A method for performing lexical analysis
D) A technique for analyzing control flow

View Answer
A

 

129. What is “loop fusion” in compiler optimization?

A) Merging two loops that have the same iteration range into one
B) Eliminating loops that are not executed
C) Unrolling loops to increase performance
D) Replacing recursive function calls with loops

View Answer
A

 

130. What is “data dependency” in compiler construction?

A) The relationship between two statements that access the same data
B) A type of error in lexical analysis
C) A method for optimizing machine code
D) A method for semantic analysis

View Answer
A

 

 

More to Learn: –

  1. Artificial Intelligence MCQs
  2. Operating System MCQs
  3. UNIX Operating System MCQs
  4. Computer Architecture MCQs
  5. Data Science MCQs
  6. Data Structures MCQs
  7. Database System MCQs
  8. Digital Logic Design MCQs
  9. Microsoft Azure MCQs
  10. E-COMMERCE MCQs
  11. Machine Design MCQs
  12. Web Ontilogy MCQs
  13. Cascading Style Sheets MCQs
  14. HTML MCQs
  15. C++ MCQs
  16. PHP MCQs
Facebook
WhatsApp
LinkedIn

All Subject MCQs

Current Affairs MCQs

Fine Arts MCQs

Physiotherapy MCQs

Microsoft Azure MCQs

General Knowledge MCQs

Islamic Studies MCQs

Jammu and Kashmir Studies MCQs

English Basic MCQ

Machine Design MCQs

Physical Education MCQs

Nursing MCQs

Report writing MCQs

WEB ONTOLOGY MCQs

Geography MCQs

UDC and LDC Clerk MCQs

Physics Basic MCQs

E-COMMERCE MCQs

Management Sciences MCQs

Land Records MCQs

Chemistry MCQs

HTML MCQS

Pedagogy MCQs

Terrorism in Pakistan MCQs

Leadership MCQs

Cascading Style Sheets (CSS) MCQS

Psychology MCQs

Engineering MCQs

PHP MCQS

Botany MCQs

Biology MCQs

Artificial Intelligence (AI) MCQs

Zoology MCQs

Math MCQs

Data Science MCQs

Agriculture MCQs

Statistics MCQs

C++ Multiple-Choice

Current Affairs MCQs

Economics MCQs

Data Structures MCQs

Everyday Science MCQs

Philosophy MCQs

Operating System MCQs

Pakistan Studies MCQs

Political Science MCQs

UNIX Operating System MCQs

Environmental MCQs

Ethics MCQs

DISCRETE MATHEMATICS MCQS

Library science MCQs

Social Studies MCQs

Computer Basic MCQs

Dental MCQs

Computer Science MCQs

Automata Theory MCQs

Digital Image Processing MCQs

Artificial Intelligence (AI) MCQs

Mobile Android Applications Mcqs

Mobile android applications MCQs

Data Science MCQs

Multimedia System MCQs

Graph Algorithms MCQs

C++ Multiple-Choice

Real-Time Systems MCQs

CAD MCQs

Data Structures MCQs

C Programming Mcqs

Embedded System MCQs

Operating System MCQs

Computer Basic MCQs

Web Security and forensics MCQs

UNIX Operating System MCQs

OOP MCQs

Python MCQs

Digital Logic Design MCQs

LINUX Operating System MCQs

Microsoft Office MCQs

Database System MCQs

Data Mining MCQs

Internet and Email MCQs

Compiler Construction MCQs

Software Architecture MCQs

Computer general knowledge MCQs

Computer Architecture MCQs

Software Formal Methods MCQs

Social Networks MCQs

Software Requirement Engineering MCQs

Software Project Management MCQs

Graphic designing MCQs

Software Testing MCQs

Object-Oriented Analysis And Design MCQs

Photoshop MCQs

Software quality Assurance MCQs

UML MCQs

Corel Draw MCQs

Software Fault Tolerance MCQS

Computer Graphics MCQs

Parallel and Distributed Computing MCQs

Software Risk Management MCQS

Network MCQs

  • Home
  • About
  • Contact
  • Privacy Policy
    • Terms of Use
    • Cookie Privacy Policy
    • California Consumer Privacy Act (CCPA)
    • DMCA
  • Free Tools
Menu
  • Home
  • About
  • Contact
  • Privacy Policy
    • Terms of Use
    • Cookie Privacy Policy
    • California Consumer Privacy Act (CCPA)
    • DMCA
  • Free Tools

© 2024 All rights Reserved. Design by Arslan

Powered by Subject Nest