System Software - machine, assembly and high-level languages, compilers and interpreters, loading, linking and relocation, macros, debuggers - Question Bank

1. What is a 'macro processor' primarily concerned with?
A) Executing machine code instructions.
B) Translating assembly language to machine code.
C) Expanding macro definitions before the main translation phase.
D) Managing the operating system's kernel.
2. Which system software is responsible for combining object files and resolving external references to create an executable file?
A) Compiler
B) Interpreter
C) Loader
D) Linker
3. Which component of a compiler is responsible for recognizing keywords, identifiers, and operators?
A) Syntax Analyzer
B) Code Generator
C) Lexical Analyzer
D) Semantic Analyzer
4. What is the purpose of a 'debugger'?
A) To translate high-level code to machine code.
B) To optimize the execution speed of a program.
C) To assist in finding and fixing errors in a program.
D) To manage memory allocation for processes.
5. The process of adjusting memory addresses in a program so it can be loaded at a different location in memory is called:
A) Linking
B) Loading
C) Relocation
D) Compilation
6. What is the main advantage of using assembly language over machine language?
A) It is significantly easier to read, write, and understand due to symbolic representation.
B) It is machine-independent.
C) It requires no translation process.
D) It offers higher-level abstractions like loops and functions directly.
7. Which of the following is a typical output of the 'semantic analysis' phase of a compiler?
A) A stream of tokens
B) A parse tree or AST
C) Annotated parse tree or intermediate representation with semantic checks
D) Machine code
8. What is the primary role of an interpreter in executing a program?
A) To produce a standalone executable file.
B) To translate and execute source code statement by statement.
C) To optimize the code for maximum speed.
D) To link multiple object files into a single executable.
9. Which language is considered the 'lowest-level' programming language, consisting of binary or hexadecimal instructions?
A) Assembly Language
B) High-Level Language
C) Machine Language
D) C++
10. In debugging, what is the purpose of 'inspecting variables'?
A) To pause program execution at a specific point.
B) To view and potentially modify the current values of variables during execution.
C) To compile the program.
D) To link object files.
11. What is a 'macro expansion'?
A) The process of translating assembly code to machine code.
B) The process where the macro processor replaces a macro call with the macro's definition.
C) The process of linking multiple program modules.
D) The execution of a compiled program.
12. What is the advantage of 'dynamic linking' over 'static linking'?
A) Smaller executable file size and reduced memory usage.
B) Faster program startup time.
C) Simpler implementation of the linker.
D) Guaranteed to avoid runtime errors.
13. A 'loader' is a system software responsible for:
A) Translating high-level languages.
B) Managing CPU scheduling.
C) Bringing programs from disk into memory for execution.
D) Detecting syntax errors.
14. What does 'linking' in the context of system software refer to?
A) The process of translating source code to machine code.
B) The process of loading a program into memory.
C) The process of combining separately compiled modules and resolving references between them.
D) The process of optimizing the program's performance.
15. Which phase of compilation is responsible for type checking and ensuring that the program's logic is sound?
A) Lexical Analysis
B) Syntax Analysis
C) Semantic Analysis
D) Code Generation
16. What is the output of a compiler?
A) Source code
B) Machine code or object code
C) Intermediate representation
D) Tokens
17. What is the main challenge of programming in machine language?
A) It is too abstract.
B) It is difficult to read, write, and prone to errors due to its binary nature.
C) It requires a high-level compiler.
D) It is not compatible with most modern hardware.
18. Which of the following is a form of static linking?
A) Libraries are loaded and linked at runtime.
B) All necessary library code is copied into the executable file during the linking phase.
C) Libraries are shared among multiple running programs.
D) Linking occurs only when the program is first executed.
19. What is the 'call stack' used for in program execution and debugging?
A) To store global variables.
B) To manage function calls and their local variables, parameters, and return addresses.
C) To optimize the program's memory usage.
D) To perform lexical analysis.
20. In debugging, what does 'stepping through' a program mean?
A) Executing the entire program at once.
B) Executing the program one instruction or line at a time.
C) Skipping over a block of code.
D) Running the program until an error occurs.
21. What is the primary goal of code optimization in a compiler?
A) To increase the size of the generated code.
B) To make the code more readable for humans.
C) To improve the efficiency of the generated code in terms of speed and/or memory usage.
D) To ensure compatibility with older hardware.
22. Which system software translates a program written in assembly language into machine code?
A) Compiler
B) Interpreter
C) Assembler
D) Linker
23. What is the benefit of using an interpreter for program development?
A) Faster execution of the final program.
B) Easier debugging and rapid prototyping.
C) Smaller executable file size.
D) Better performance on resource-constrained systems.
24. Which phase of compilation is responsible for generating target machine code?
A) Semantic Analysis
B) Intermediate Code Generation
C) Code Generation
D) Error Handling
25. What is the output of the lexical analyzer?
A) Tokens
B) Machine code
C) Abstract Syntax Tree
D) Object code
26. Which of the following is NOT a typical phase of compilation?
A) Lexical Analysis
B) Syntax Analysis
C) Linking
D) Code Generation
27. A macro definition in assembly language typically includes:
A) A list of machine code instructions.
B) A name and a sequence of instructions or statements to be substituted.
C) The memory address where the macro should be placed.
D) Error handling routines.
28. What is the purpose of 'relocation bits' in object files?
A) To indicate which parts of the code need to be translated by the compiler.
B) To mark instructions or data that need to be modified by the loader to adjust memory addresses.
C) To specify the order of execution of program modules.
D) To define macro expansions.
29. In the context of loading, what is 'dynamic linking'?
A) Linking all libraries at compile time.
B) Linking libraries at runtime as they are needed, reducing memory usage and allowing for updates.
C) Linking only the main program module.
D) Linking all program modules into a single executable before loading.
30. What is the role of the loader in an operating system?
A) To translate source code into machine code.
B) To link different object modules together.
C) To load executable programs from secondary storage into main memory and prepare them for execution.
D) To manage the CPU scheduling.
31. Which of the following is a disadvantage of interpreters compared to compilers?
A) Slower execution speed
B) Less portability
C) More complex to write programs
D) Requires more memory
32. An interpreter typically executes a program by:
A) Generating an executable file first.
B) Translating and executing each statement or instruction one by one.
C) Compiling the entire program into machine code.
D) Linking multiple object files.
33. Which type of language uses mnemonics to represent machine instructions?
A) High-level language
B) Machine language
C) Assembly language
D) Natural language
34. What is the main advantage of using high-level languages over machine languages?
A) Higher execution speed
B) Direct hardware control
C) Increased programmer productivity and portability
D) Less memory consumption
35. Which of the following is an example of a common high-level programming language?
A) x86 Assembly
B) Python
C) ARM Assembly
D) Machine Code (binary)
36. What is the purpose of the symbol table in a compiler?
A) To store the machine code generated from the source code.
B) To record information about identifiers (variables, functions, etc.) and their attributes.
C) To manage the call stack during program execution.
D) To perform runtime error checking.
37. Which phase of compilation is responsible for checking if the program adheres to the grammar rules of the programming language?
A) Lexical Analysis
B) Syntax Analysis
C) Semantic Analysis
D) Code Optimization
38. In the context of compilers, what is an Abstract Syntax Tree (AST)?
A) A representation of the program's machine code.
B) A tree structure representing the grammatical structure of the source code.
C) A list of all variables used in the program.
D) A table storing memory addresses.
39. Which debugging technique allows a programmer to pause the execution of a program at a specific line of code?
A) Stepping over
B) Stepping into
C) Setting a breakpoint
D) Inspecting variables
40. What is the primary function of a debugger?
A) To translate source code into machine code.
B) To optimize the performance of a program.
C) To help programmers find and fix errors (bugs) in their code by allowing them to step through execution, inspect variables, and set breakpoints.
D) To automate the process of software testing.
41. A macro processor typically performs which of the following actions?
A) Executes machine code.
B) Translates assembly code to machine code.
C) Expands macro calls into their corresponding macro body code before assembly.
D) Manages memory allocation.
42. What is the purpose of a macro in assembly language?
A) To define a new data type.
B) To create a subroutine that can be called from multiple places.
C) To replace a sequence of assembly instructions with a single mnemonic, improving code readability and reducing redundancy.
D) To optimize the execution speed of the program.
43. Relocation is a process performed by the loader to adjust memory addresses in a program so that it can be loaded into a different memory location than originally specified.
A) True
B) False
C) Depends on the operating system
D) Depends on the programming language
44. Which of the following best describes the role of a linker?
A) To translate source code into machine code.
B) To combine multiple object files and resolve external references into a single executable program.
C) To load a program into memory for execution.
D) To manage the execution of multiple processes.
45. What does the lexical analyzer (scanner) do in a compiler?
A) Checks for grammatical errors in the code.
B) Breaks the source code into tokens.
C) Optimizes the generated machine code.
D) Manages symbol table entries.
46. Which compiler phase is responsible for converting the source code into an intermediate representation?
A) Lexical Analysis
B) Syntax Analysis
C) Semantic Analysis
D) Code Generation
47. What is the main difference between a compiler and an interpreter?
A) A compiler translates the entire program at once, while an interpreter translates it line by line.
B) A compiler executes the program directly, while an interpreter generates an intermediate code.
C) A compiler is slower than an interpreter.
D) An interpreter requires more memory than a compiler.
48. Which of the following is a characteristic of high-level languages compared to assembly languages?
A) Machine-dependent
B) More verbose and less abstract
C) Easier to read, write, and maintain
D) Requires direct memory manipulation
49. What is the primary function of an assembler?
A) To translate high-level code into machine code
B) To translate assembly language into machine code
C) To execute machine code instructions directly
D) To manage system memory
50. Which type of programming language is closest to the hardware and requires a deep understanding of the machine's architecture?
A) High-level language
B) Assembly language
C) Machine language
D) Scripting language