System software: compilers, interpreters, loaders, linkers, macros and debuggers. - Question Bank

1. What is the main difference between a compiler and an assembler?
A) A compiler translates high-level code, while an assembler translates assembly code.
B) An assembler translates high-level code, while a compiler translates assembly code.
C) A compiler produces intermediate code, while an assembler produces machine code.
D) An assembler requires a linker, while a compiler does not.
2. In the context of compilers, what does 'parsing' refer to?
A) Translating source code to machine code.
B) Analyzing the source code to determine its grammatical structure.
C) Optimizing the generated code.
D) Expanding macro definitions.
3. What is the primary purpose of a 'runtime environment' for interpreted languages?
A) To compile the source code into machine code.
B) To provide services for program execution, such as memory management and I/O.
C) To link different program modules.
D) To detect syntax errors.
4. Which system software is responsible for managing the loading and linking of programs and libraries?
A) Compiler
B) Debugger
C) Loader and Linker
D) Macro Processor
5. What is the role of the 'code generator' in a compiler?
A) To translate source code into tokens.
B) To parse the token stream and build an AST.
C) To translate intermediate code into target machine code.
D) To optimize the generated code.
6. What is the main advantage of using an interpreter for scripting languages?
A) High execution speed.
B) Ease of debugging and rapid prototyping.
C) Generation of standalone executables.
D) Reduced memory consumption.
7. Which of the following is a common type of macro processor?
A) Two-pass macro assembler
B) One-pass assembler
C) Compiler
D) Interpreter
8. What is 'relocation' in the context of a relocatable loader?
A) The process of linking different object files.
B) The process of adjusting program addresses to load it at a different memory location.
C) The process of translating source code into machine code.
D) The process of executing the program.
9. Which compiler phase is responsible for checking the logical correctness and type compatibility of statements?
A) Lexical Analysis
B) Syntax Analysis
C) Semantic Analysis
D) Code Generation
10. What is a 'symbol table' used for in a compiler?
A) To store the generated machine code.
B) To keep track of identifiers, their types, and scope.
C) To manage the program's call stack.
D) To store runtime error messages.
11. Which system software is responsible for managing the translation of assembly language to machine code?
A) Compiler
B) Interpreter
C) Linker
D) Assembler
12. What is the primary role of a debugger in the software development process?
A) To translate source code into machine code.
B) To optimize the performance of the program.
C) To assist in finding and fixing errors in the code.
D) To manage memory allocation.
13. Which type of loader allows a program to be loaded at any memory location?
A) Absolute Loader
B) Relocatable Loader
C) Direct Linking Loader
D) Bootstrap Loader
14. What is 'intermediate code' in the context of compilation?
A) The final machine code produced by the compiler.
B) A low-level representation of the source code, independent of the target machine.
C) The original source code written by the programmer.
D) The output of the linker.
15. Which phase of compilation is also known as 'scanning'?
A) Syntax Analysis
B) Lexical Analysis
C) Semantic Analysis
D) Code Optimization
16. What is the primary goal of a linker in creating an executable program?
A) To optimize the code for speed.
B) To combine separately compiled modules and resolve symbol references.
C) To provide an interactive debugging environment.
D) To translate source code into machine code.
17. Which of the following is a common technique used by debuggers to inspect program state?
A) Code refactoring
B) Variable watch and memory inspection
C) Syntax highlighting
D) Automatic code completion
18. What does a macro expansion process involve?
A) Replacing a macro name with its defined sequence of instructions.
B) Translating a high-level language into assembly language.
C) Linking different program modules together.
D) Executing the program code.
19. Which system software translates symbolic machine language code into machine code?
A) Compiler
B) Interpreter
C) Assembler
D) Linker
20. What is the function of a loader's relocation mechanism?
A) To translate source code into machine code.
B) To combine multiple object files into a single executable.
C) To adjust memory addresses in the program code and data to fit the allocated memory space.
D) To detect and report syntax errors.
21. What is the key difference between a compiler and an interpreter regarding output?
A) A compiler produces an executable file, while an interpreter does not.
B) An interpreter produces an executable file, while a compiler does not.
C) Both produce executable files, but at different stages.
D) Neither produces executable files.
22. Which of the following is NOT a typical phase of compilation?
A) Lexical Analysis
B) Syntax Analysis
C) Runtime Debugging
D) Code Generation
23. A 'breakpoint' in debugging refers to:
A) A syntax error in the code.
B) A point where the program execution is intentionally halted.
C) A memory leak.
D) A compiler warning.
24. What is the output of the syntax analysis phase of a compiler?
A) Tokens
B) Abstract Syntax Tree (AST)
C) Object code
D) Machine code
25. Which system software is responsible for managing the execution of multiple programs concurrently?
A) Compiler
B) Interpreter
C) Operating System
D) Debugger
26. What is the purpose of code optimization in a compiler?
A) To increase the size of the generated code.
B) To make the code run faster or use less memory.
C) To add more features to the programming language.
D) To translate the code into a human-readable format.
27. Which of the following describes the 'just-in-time' (JIT) compilation approach?
A) Compiling the entire program before any execution begins.
B) Translating source code to machine code on the fly during execution.
C) Translating code segments into machine code only when they are about to be executed.
D) Interpreting the source code line by line.
28. What is the role of a compiler in the software development lifecycle?
A) To execute the program directly on the target machine.
B) To translate source code into machine code or an intermediate representation.
C) To manage system resources and process scheduling.
D) To provide a user interface for the application.
29. Which part of the compiler is responsible for generating machine-independent intermediate code?
A) Lexical Analyzer
B) Syntax Analyzer
C) Semantic Analyzer
D) Intermediate Code Generator
30. An absolute loader is also known as a:
A) Relocatable Loader
B) Direct Linking Loader
C) Simple Loader
D) Dynamic Loader
31. What is the primary function of a macro processor?
A) To translate assembly language into machine code.
B) To expand macro calls into their corresponding sequences of instructions.
C) To link object files together.
D) To load programs into memory.
32. Which of the following is a disadvantage of using an interpreter?
A) Slower execution speed compared to compiled programs.
B) Requires a separate compilation step.
C) Cannot be used for interactive development.
D) Produces a standalone executable file.
33. A linker resolves which of the following types of references?
A) Syntax errors
B) Semantic errors
C) External references between program modules and libraries
D) Runtime errors
34. What is the purpose of the symbol table in a compiler?
A) To store the intermediate code generated from the source code.
B) To store information about identifiers (variables, functions, etc.) encountered in the source code.
C) To manage the memory allocation for the program.
D) To record the sequence of tokens for analysis.
35. Which phase of compilation deals with the meaning of the statements, ensuring they are logically valid?
A) Lexical Analysis
B) Syntax Analysis
C) Semantic Analysis
D) Code Generation
36. What does a debugger allow a programmer to do?
A) Write code more efficiently.
B) Optimize memory usage.
C) Step through code execution, inspect variables, and set breakpoints.
D) Automatically generate documentation.
37. In the context of compilers, what is an Abstract Syntax Tree (AST)?
A) A linear sequence of tokens representing the source code.
B) A tree representation of the syntactic structure of the source code.
C) A representation of the machine code instructions.
D) A data structure used for symbol table management.
38. Which of the following is an example of a macro processor directive?
A) #include
B) #define
C) printf
D) main
39. What is the main advantage of using a compiler over an interpreter?
A) Easier debugging of runtime errors.
B) Faster execution speed of the generated code.
C) Interactive code development and testing.
D) No need for a separate linking phase.
40. A compiler typically performs all of the following steps except:
A) Lexical Analysis
B) Syntax Analysis
C) Runtime Execution
D) Code Optimization
41. Which type of loader performs address modifications based on the memory addresses assigned to program segments?
A) Absolute Loader
B) Relocatable Loader
C) Direct Linking Loader
D) Dynamic Loader
42. The process of converting a high-level programming language into machine-readable code is called:
A) Execution
B) Interpretation
C) Compilation
D) Linking
43. What is the output of the lexical analysis phase of a compiler?
A) Abstract Syntax Tree (AST)
B) Tokens
C) Intermediate code
D) Machine code
44. Which phase of compilation involves checking the source code for grammatical correctness according to the rules of the programming language?
A) Lexical Analysis
B) Syntax Analysis
C) Semantic Analysis
D) Code Generation
45. Which system software helps in identifying and correcting errors in a program?
A) Compiler
B) Interpreter
C) Debugger
D) Linker
46. What is a macro in the context of system software?
A) A small, self-contained program that performs a specific task.
B) A shorthand notation for a sequence of instructions that can be expanded.
C) A tool used for debugging and tracing program execution.
D) A type of operating system scheduler.
47. A loader is responsible for which of the following tasks?
A) Resolving external references between different program modules.
B) Translating assembly language into machine code.
C) Bringing an executable program from secondary storage into main memory.
D) Detecting and correcting errors in source code.
48. What is the role of a linker in the software development process?
A) To translate high-level code into machine code.
B) To combine object files and libraries into a single executable program.
C) To load the executable program into memory for execution.
D) To manage memory allocation for running processes.
49. Which of the following is a characteristic of an interpreter?
A) It produces a standalone executable file.
B) It translates and executes the source code one statement at a time.
C) It requires a separate linking phase.
D) It generally offers faster execution speed than a compiled program.
50. What is the primary function of a compiler?
A) To translate source code into machine code line by line during execution.
B) To translate the entire source code of a program into an executable file before execution.
C) To provide an interactive environment for executing code.
D) To link different modules of a program together.