System Software - machine, assembly and high-level languages, compilers and interpreters, loading, linking and relocation, macros, debuggers - One Line Questions
1.
What is the main difference between a compiler and an interpreter? —
A compiler translates the entire program at once, while an interpreter translates it line by line.
2.
A macro definition in assembly language typically includes: —
A name and a sequence of instructions or statements to be substituted.
3.
In the context of compilers, what is an Abstract Syntax Tree (AST)? —
A tree structure representing the grammatical structure of the source code.
4.
Which of the following is a typical output of the 'semantic analysis' phase of a compiler? —
Annotated parse tree or intermediate representation with semantic checks
5.
Which language is considered the 'lowest-level' programming language, consisting of binary or hexadecimal instructions? —
Machine Language
6.
What does the lexical analyzer (scanner) do in a compiler? —
Breaks the source code into tokens.
7.
Which system software translates a program written in assembly language into machine code? —
Assembler
8.
Which system software is responsible for combining object files and resolving external references to create an executable file? —
Linker
9.
A macro processor typically performs which of the following actions? —
Expands macro calls into their corresponding macro body code before assembly.
10.
What is a 'macro processor' primarily concerned with? —
Expanding macro definitions before the main translation phase.
11.
In debugging, what does 'stepping through' a program mean? —
Executing the program one instruction or line at a time.
12.
What is the benefit of using an interpreter for program development? —
Easier debugging and rapid prototyping.
13.
An interpreter typically executes a program by: —
Translating and executing each statement or instruction one by one.
14.
Which type of language uses mnemonics to represent machine instructions? —
Assembly language
15.
Which type of programming language is closest to the hardware and requires a deep understanding of the machine's architecture? —
Machine language
16.
What is the main advantage of using high-level languages over machine languages? —
Increased programmer productivity and portability
17.
What is the main advantage of using assembly language over machine language? —
It is significantly easier to read, write, and understand due to symbolic representation.
18.
What is the main challenge of programming in machine language? —
It is difficult to read, write, and prone to errors due to its binary nature.
19.
Which compiler phase is responsible for converting the source code into an intermediate representation? —
Syntax Analysis
20.
Which phase of compilation is responsible for checking if the program adheres to the grammar rules of the programming language? —
Syntax Analysis
21.
Which of the following is NOT a typical phase of compilation? —
Linking
22.
Which phase of compilation is responsible for type checking and ensuring that the program's logic is sound? —
Semantic Analysis
23.
Which of the following is a form of static linking? —
All necessary library code is copied into the executable file during the linking phase.
24.
The process of adjusting memory addresses in a program so it can be loaded at a different location in memory is called: —
Relocation
25.
In the context of loading, what is 'dynamic linking'? —
Linking libraries at runtime as they are needed, reducing memory usage and allowing for updates.
26.
Which of the following is a characteristic of high-level languages compared to assembly languages? —
Easier to read, write, and maintain
27.
Which phase of compilation is responsible for generating target machine code? —
Code Generation
28.
Which of the following is a disadvantage of interpreters compared to compilers? —
Slower execution speed
29.
What is the advantage of 'dynamic linking' over 'static linking'? —
Smaller executable file size and reduced memory usage.
30.
What is the output of a compiler? —
Machine code or object code
31.
Which debugging technique allows a programmer to pause the execution of a program at a specific line of code? —
Setting a breakpoint
32.
Which component of a compiler is responsible for recognizing keywords, identifiers, and operators? —
Lexical Analyzer
33.
What is a 'macro expansion'? —
The process where the macro processor replaces a macro call with the macro's definition.
34.
What does 'linking' in the context of system software refer to? —
The process of combining separately compiled modules and resolving references between them.
35.
What is the purpose of a macro in assembly language? —
To replace a sequence of assembly instructions with a single mnemonic, improving code readability and reducing redundancy.
36.
What is the primary goal of code optimization in a compiler? —
To improve the efficiency of the generated code in terms of speed and/or memory usage.
37.
What is the purpose of 'relocation bits' in object files? —
To mark instructions or data that need to be modified by the loader to adjust memory addresses.
38.
In debugging, what is the purpose of 'inspecting variables'? —
To view and potentially modify the current values of variables during execution.
39.
What is the primary role of an interpreter in executing a program? —
To translate and execute source code statement by statement.
40.
What is the 'call stack' used for in program execution and debugging? —
To manage function calls and their local variables, parameters, and return addresses.
41.
What is the purpose of the symbol table in a compiler? —
To record information about identifiers (variables, functions, etc.) and their attributes.
42.
What is the primary function of an assembler? —
To translate assembly language into machine code
43.
What is the purpose of a 'debugger'? —
To assist in finding and fixing errors in a program.
44.
Which of the following best describes the role of a linker? —
To combine multiple object files and resolve external references into a single executable program.
45.
What is the primary function of a debugger? —
To help programmers find and fix errors (bugs) in their code by allowing them to step through execution, inspect variables, and set breakpoints.
46.
What is the role of the loader in an operating system? —
To load executable programs from secondary storage into main memory and prepare them for execution.
47.
What is the output of the lexical analyzer? —
Tokens
48.
A 'loader' is a system software responsible for: —
Bringing programs from disk into memory for execution.
49.
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. —
True
50.
Which of the following is an example of a common high-level programming language? —
Python