AllInfoHub Logo

AllInfoHub – MCQ Practice

Compiler Design – Multiple Choice Questions (MCQs)

  1. 37. What is instruction scheduling?

    • A. Reordering the sequence of machine instructions to improve performance
    • B. Selecting the appropriate machine instructions
    • C. Generating assembly code from intermediate code
    • D. Optimizing the use of registers
  2. 38. What is peephole optimization?

    • A. A local optimization technique that examines a small window of instructions and replaces it with a more efficient sequence
    • B. A global optimization technique
    • C. An optimization performed during lexical analysis
    • D. An optimization performed during parsing
  3. 39. What is garbage collection?

    • A. An automatic memory management process that reclaims memory occupied by objects that are no longer in use
    • B. A process of deleting temporary files
    • C. A compiler optimization technique
    • D. A way to handle runtime errors
  4. 40. What is a cross-compiler?

    • A. A compiler that runs on one type of machine and produces code for a different type of machine
    • B. A compiler that compiles code for the same machine it runs on
    • C. A compiler that translates between different high-level languages
    • D. A compiler that optimizes code for parallel execution
  5. 41. What is an interpreter?

    • A. A program that executes source code line by line
    • B. A program that translates source code into object code
    • C. A program that links object files
    • D. A program that optimizes code
  6. 42. What is a linker?

    • A. A program that combines object code files into an executable program
    • B. A program that translates source code
    • C. A program that debugs code
    • D. A program that optimizes code
  7. 43. What is a loader?

    • A. A program that loads an executable program into main memory for execution
    • B. A program that saves compiled code to disk
    • C. A program that manages memory allocation
    • D. A part of the operating system that manages files
  8. 44. What is a grammar in the context of compiler design?

    • A. A set of rules that define the syntax of a programming language
    • B. A set of keywords in the language
    • C. A description of the semantics of the language
    • D. A specification of the target machine architecture
  9. 45. What is a context-free grammar (CFG)?

    • A. A grammar that can be recognized by a finite automaton
    • B. A grammar where the production rules have a single non-terminal on the left-hand side
    • C. A grammar that describes regular languages
    • D. A grammar that can generate any string
  10. 46. What is an ambiguous grammar?

    • A. A grammar for which a string can have more than one parse tree
    • B. A grammar that generates no strings
    • C. A grammar with only one production rule
    • D. A grammar that is difficult to parse
  11. 47. Why is ambiguity in a grammar a problem for compilers?

    • A. It can lead to multiple possible interpretations of the same program
    • B. It makes parsing more efficient
    • C. It simplifies the semantic analysis phase
    • D. It has no impact on the compilation process
  12. 48. What is left recursion in a grammar?

    • A. A production rule where the leftmost symbol on the right-hand side is the same as the non-terminal on the left-hand side
    • B. A production rule that produces an empty string
    • C. A production rule where the right-hand side is longer than the left-hand side
    • D. A production rule that is applied from right to left