Target Code Representation MCQs December 19, 2025December 14, 2024 by u930973931_answers 30 min Score: 0 Attempted: 0/30 Subscribe 1. What is the primary purpose of target code in compiler design? (A) To represent the program in a form executable by the machine (B) To generate source code (C) To optimize high-level code (D) To parse tokens 2. Which of the following is considered a target code? (A) High-level language code (B) Syntax trees (C) Lexical tokens (D) Assembly language 3. What is the difference between intermediate code and target code? (A) Intermediate code is machine-dependent; target code is machine-independent (B) Both are machine-independent (C) Intermediate code is machine-independent; target code is machine-dependent (D) Both are machine-dependent 4. Which form of target code is closest to the hardware? (A) Assembly code (B) High-level language (C) Intermediate code (D) Syntax tree 5. Which of the following is NOT a common representation of target code? (A) Assembly code (B) Machine code (C) Bytecode (D) Three-address code 6. What is the role of code generation in target code representation? (A) Parsing high-level language (B) Transforming intermediate code into machine-executable code (C) Performing lexical analysis (D) Optimizing syntax trees 7. Which of the following is a characteristic of good target code? (A) Easy for humans to read (B) Contains many comments (C) Efficient in execution and memory usage (D) Written in high-level language 8. What is a common challenge in target code generation? (A) Parsing comments (B) Mapping high-level constructs to machine instructions (C) Tokenizing source code (D) Checking spelling of identifiers 9. What is register allocation in target code generation? (A) Assigning temporary variables to CPU registers for faster access (B) Assigning values to variables in memory only (C) Allocating disk space (D) Parsing tokens 10. Which type of machine instructions are used in target code? (A) Source code tokens (B) Pseudocode (C) Natural language statements (D) Assembly mnemonics 11. What is an example of a target code optimization? (A) Lexical analysis (B) Tokenizing the source code (C) Removing redundant instructions (D) Syntax tree construction 12. In target code generation, what is an instruction selection problem? (A) Assigning memory to arrays (B) Selecting variable names (C) Parsing source code (D) Choosing the most appropriate machine instructions for intermediate code 13. What is peephole optimization? (A) Optimizing source code syntax (B) Optimizing comments (C) Replacing small sequences of target instructions with more efficient sequences (D) Generating intermediate code 14. What is a three-address code in compiler design? (A) A type of target code (B) A form of machine code (C) Assembly code (D) An intermediate representation with instructions of the form x = y op z 15. What is the difference between absolute and relocatable target code? (A) Absolute code can run anywhere in memory; relocatable cannot (B) Absolute code is human-readable; relocatable is machine-readable (C) Both are identical (D) Absolute code must run at a specific memory location; relocatable can be loaded anywhere 16. Which type of target code is platform-independent? (A) Machine code (B) Assembly code (C) Bytecode (D) Native executable 17. Which of the following is a disadvantage of direct machine code generation? (A) Slower execution (B) Harder to optimize and maintain (C) Easy debugging (D) Platform independence 18. What is the purpose of instruction scheduling in target code generation? (A) Checking semantic rules (B) Tokenizing input (C) Parsing syntax trees (D) Arranging instructions to minimize pipeline stalls and improve performance 19. What is the role of a code generator in a compiler? (A) Generate lexical tokens (B) Analyze runtime behavior (C) Optimize parsing (D) Convert intermediate representation into target machine instructions 20. Which type of target code is executed by a virtual machine? (A) Bytecode (B) Assembly code (C) Machine code (D) Syntax tree 21. What is the main advantage of using an intermediate code before generating target code? (A) Simplifies parsing (B) Machine independence and easier optimization (C) Faster lexical analysis (D) Generates fewer errors 22. In target code, what is the significance of addressing modes? (A) Determines how operands are accessed in memory or registers (B) Specifies token types (C) Decides parser precedence (D) Determines source code indentation 23. What is object code in compiler terminology? (A) Human-readable code (B) Machine-executable code generated by the compiler (C) Intermediate code (D) Lexical tokens 24. Which component of the compiler is responsible for translating high-level constructs like loops into target instructions? (A) Code generator (B) Lexical analyzer (C) Syntax analyzer (D) Semantic analyzer 25. What is the main goal of target code optimization? (A) Improve execution speed and reduce memory usage (B) Reduce compilation time (C) Simplify source code (D) Remove comments 26. Which type of target code is used by the Java Virtual Machine (JVM)? (A) Assembly code (B) Object code (C) Machine code (D) Bytecode 27. What is the difference between static and dynamic target code? (A) Static is fixed at compile time; dynamic can be linked or loaded at runtime (B) Both are generated at runtime (C) Static is optimized; dynamic is not (D) Static is machine-independent; dynamic is platform-specific 28. Which optimization technique in target code reduces the number of instructions executed? (A) Syntax analysis (B) Tokenization (C) Dead code elimination (D) Lexical scanning 29. What is the function of a linker in relation to target code? (A) Checks syntax (B) Converts source code to intermediate code (C) Generates tokens (D) Combines object code modules into a single executable 30. Why is target code often platform-specific? (A) It depends on the syntax of the high-level language (B) Because it must match the architecture and instruction set of the machine (C) It is written in human-readable format (D) It is generated before parsing