You are on page 1of 8

1. What are maskable and non maskable interrupts? Give examples.

In computer architecture, an interrupt is a signal to the processor indicating an event that


needs immediate attention. Interrupts can be classified into two types: maskable and
non-maskable.

Maskable Interrupts: These are interrupts that can be enabled or disabled by software. They
can be prioritised and the processor can choose which interrupt to handle first. Examples of
maskable interrupts include keyboard interrupts, timer interrupts.

Non-maskable Interrupts (NMI): These are interrupts that cannot be disabled or ignored by
software. They are typically used for critical events such as hardware failures or power loss.
Examples: non-maskable interrupts generated by power loss or by the system reset button.

2.What is the role of symbol tables in compilation?

A symbol table is a data structure used by compilers to store information about the identifiers
in a program. This information can include the type of an identifier, its scope, and its location
in memory. The symbol table is used by the compiler to resolve references to identifiers,
ensure that identifiers are used correctly, and generate efficient machine code. It can also be
used to store information about functions and variables which can be used by the linker to
link object files together.

3.Differentiate between compiler and interpreter.

A compiler and an interpreter are both tools used to translate a program written in a
high-level language into machine code that can be executed by a computer. However, they
differ in how they go about this task and the kind of output they produce.

Compiler: A compiler is a program that translates the entire source code of a program into
machine code all at once. The output of a compiler is a standalone executable file that can be
run on a computer without the need for the compiler to be present. For example, C++, C#,
and Java compilers.

Interpreter: An interpreter, on the other hand, reads the source code of a program one line at a
time and executes it immediately. It does not produce an executable file, instead, the
interpreter must be present on the computer in order to run the program. Examples of
interpreted languages are Python, Ruby, JavaScript etc.
4.What are the basic functions of a loader?

A loader is a program that is responsible for loading an executable program into memory and
preparing it for execution. The basic functions of a loader include:

● Reading the executable file from disk and loading it into memory: This involves
reading the binary code of the program from disk and placing it into memory at the
appropriate location.

● Linking and relocation: The loader resolves any external references in the code and
links them with the appropriate libraries. It also adjusts any memory addresses in the
code to match the actual location in memory where the program will be loaded.

● Setting up the program's initial state: The loader sets up the initial values of registers,
sets the program counter to the starting address of the program, and sets up any other
required data structures.

● Memory management: The loader is responsible for allocating memory for the
program and managing the memory space. It ensures that the program does not
overwrite any other parts of memory.

● Dynamic linking: Some loaders also support dynamic linking, which allows the
program to call library functions that are not included in the executable file but are
loaded at runtime.

● Error handling: The loader checks for any errors that may occur during the loading
process and handles them accordingly.

5.What is macro processor? Write the advantages and disadvantages of macro


Processor.

A macro processor is a program that allows the use of macros in source code. Macros are a
way to define a string of text or code that can be reused multiple times in a program. The
macro processor replaces the macro with its corresponding text or code at compile-time or
pre-processing time.

Advantages of Macro Processor:

Increased productivity: Macros can be used to reduce the amount of repetitive coding, which
can save a lot of time and effort.
Improved readability: Macros can be used to make code more readable by replacing complex
or repetitive code with a simpler macro.

Easier maintenance: Macros can be used to make code more modular and easier to maintain
by breaking it down into smaller, reusable pieces.

Cross-platform compatibility: Macros can be used to write platform-independent code by


abstracting away platform-specific details.

Disadvantages of Macro Processor:

Increased complexity: The use of macros can make code more complex and harder to
understand, especially if macros are used excessively or inappropriately.

Increased compilation time: The macro expansion process can increase the compilation time.

Lack of type checking: Macros do not have the ability to perform type checking, leading to
possible errors that are hard to detect.

Limited scope: Macros have a limited scope and cannot be used to create functions or
variables.

6.Discuss different types of system software.


System software refers to a type of software that controls and manages the basic operations of
a computer. It acts as an interface between the hardware and the user, and enables the
computer to perform tasks such as managing memory, scheduling processes, and controlling
input and output devices. There are several types of system software, including:

Operating System (OS): An operating system is a set of software that manages the resources
of a computer and controls the execution of programs. Examples of popular operating
systems include Windows, macOS, Linux, and iOS.

Device Drivers: These are software programs that control specific hardware devices, such as
printers, keyboards, and graphics cards. They allow the operating system to communicate
with the device and use its functions.

Firmware: Firmware is a type of low-level software that controls the basic functions of a
device, such as its power management, input/output interfaces, and memory management. It
is embedded in the device and cannot be modified by the user.

BIOS and UEFI: BIOS (Basic Input/Output System) and UEFI (Unified Extensible Firmware
Interface) are firmware programs that control the basic functions of a computer's hardware,
such as the system clock, keyboard, and disk drives. They are responsible for performing a
power-on self-test (POST) and loading the operating system.
Utility software: Utility software is a type of system software that is designed to perform
specific tasks, such as disk defragmentation, data backup, and system monitoring.

Embedded systems: These are specialized systems that are designed to perform specific tasks
and are embedded in other devices such as cars, home appliances, medical equipments and
other industrial machines.

7. Write a short note on relocating loader.

A relocating loader is a program that is responsible for loading an executable program into
memory and adjusting the memory addresses in the code to match the actual location in
memory where the program will be loaded. This process is known as relocation. The
relocating loader scans through the code, modifies memory addresses and links the program
with any required libraries and resolves any external references. Additionally, it also checks if
the program is trying to access any memory that is not allocated to it and if it finds such cases
it will terminate the program. Relocating loader is useful for shared libraries and dynamic
linking, it enables the program to use shared libraries that are already present in the system
and they are loaded at runtime. This helps in reducing the size of the executable and also
helps in memory management.

8.What is addressing mode? Write down different addressing modes


of 8086 microprocessor.
In computer architecture, addressing mode refers to the method used to specify the location
of an operand in memory. The addressing mode determines how the processor interprets the
address field of an instruction and where it will find the operand for that instruction.

The 8086 microprocessor supports several addressing modes, including:

Immediate addressing: In this mode, the operand is included in the instruction as a constant
value. The instruction itself specifies the operand, rather than an address.

Register addressing: In this mode, the operand is stored in a register. The instruction uses the
register as the operand.

Direct addressing: In this mode, the instruction includes the memory address of the operand.
The processor retrieves the operand from that memory location.

Register indirect addressing: In this mode, the instruction includes the address of a register
that contains the memory address of the operand. The processor retrieves the operand from
the memory location specified by the register.
Register relative addressing: In this mode, the instruction includes the value of a register and
an offset. The processor calculates the memory address of the operand by adding the register
value and the offset.

Based indexed addressing: In this mode, the instruction includes the value of a base register,
an index register, and an offset. The processor calculates the memory address of the operand
by adding the base register, the index register and the offset.

Stack based addressing: In this mode, the instruction includes the value of the stack pointer
and an offset. The processor calculates the memory address of the operand by adding the
stack pointer and the offset.

9.Explain the purpose of different segment registers present in 8086


microprocessor.
The 8086 microprocessor has four segment registers: CS (Code Segment), DS (Data
Segment), SS (Stack Segment), and ES (Extra Segment). These registers play an important
role in memory management and program execution.

CS (Code Segment): The Code Segment register contains the starting address of the current
code segment. The code segment is a memory area that contains the instructions of the
program that are being executed. The processor uses the CS register to locate the instructions
in memory.

DS (Data Segment): The Data Segment register contains the starting address of the current
data segment. The data segment is a memory area that contains the variables and data
structures of the program. The processor uses the DS register to locate the data in memory.

SS (Stack Segment): The Stack Segment register contains the starting address of the current
stack segment. The stack is a memory area that is used to store temporary data, such as
function call information and local variables. The processor uses the SS register to locate the
stack in memory.

ES (Extra Segment): The Extra Segment register contains the starting address of an additional
data segment that can be used by the program. The Extra Segment register is typically used to
access memory-mapped I/O devices, such as video memory or disk drives.

10.Explain the role of lexical analyser.

A lexical analyzer, also known as a lexer or tokenizer, is a program that takes an input stream
of characters and breaks it down into smaller chunks called tokens. These tokens represent
the basic building blocks of the program's source code, such as keywords, operators, and
identifiers. The lexical analyzer plays an important role in the front-end of a compiler, and it
is responsible for the following tasks:
Scanning: The lexical analyzer scans the input stream of characters and identifies patterns
that correspond to tokens. It uses a set of rules, called regular expressions or lexical rules, to
match the input stream to the tokens.

Tokenization: The lexical analyzer converts the input stream into a sequence of tokens, each
of which represents a single element of the source code. Tokens are used by the next phase of
the compiler, the syntax analyzer, to build the parse tree of the program.

Error handling: The lexical analyzer also checks for any errors in the input stream, such as
illegal characters or unterminated strings. If an error is found, the lexical analyzer generates
an error message and may stop the compilation process.

Filtering: The lexical analyzer filters out the whitespaces, comments and other characters that
are not meaningful for the compilation process.

11.What is S-attribute and L- attribute in syntax directed translation

In syntax-directed translation, attributes are values associated with grammar symbols


(nonterminals and terminals) that are used to store information during the parsing process.
There are two types of attributes: S-attributes and L-attributes.

S-attributes (Synthesized attributes): S-attributes are attributes that are calculated from the
attributes of the children of a nonterminal in the parse tree. They are synthesized, or built up,
during the bottom-up parsing process. For example, the value of an expression can be
calculated by combining the values of its operands.

L-attributes (Inherited attributes): L-attributes are attributes that are passed down from a
nonterminal to its children during the top-down parsing process. They are inherited from the
parent to the children of a nonterminal. For example, a variable's type can be passed down
from the variable's declaration to its use in an expression.

12.What is language processor? What are different language processor


development tools?

A language processor is a type of software that performs operations on a source code written
in a high-level programming language to convert it into machine code that can be executed
by a computer. Language processors include compilers, interpreters, and assemblers.

Compilers: A compiler is a program that translates the entire source code of a program into
machine code all at once. The output of a compiler is a standalone executable file that can be
run on a computer without the need for the compiler to be present.
Interpreters: An interpreter, on the other hand, reads the source code of a program one line at
a time and executes it immediately. It does not produce an executable file, instead, the
interpreter must be present on the computer in order to run the program.

Assemblers: An assembler is a program that converts assembly language code into machine
code. Assembly languages are low-level languages that are specific to a particular computer
architecture. They are simpler than higher-level languages but more difficult to read and
write.

There are several tools available for language processor development, such as:

Compiler Construction Tools: These tools are used to create compilers and include lexical
analyzers, parsers, and code generators. Examples include Flex, Bison, and Antlr.

13.How the translators can interact with debugger?

Translators, such as compilers and interpreters, can interact with debuggers to allow for more
efficient debugging of the source code. The main way in which translators interact with
debuggers is by generating debugging information, which can be used by the debugger to
provide more detailed information about the state of the program. This information can
include information about the location of variables, the values of registers, and the call stack.

Symbol Table: Compilers can generate a symbol table, which contains information about the
variables, functions and other entities in the program. The debugger can use this information
to display the values of variables and the location of breakpoints.

Source Code Mapping: Compilers can generate a mapping between the source code and the
machine code, this way debugger can match the machine code to the corresponding source
code, making it easier to understand the execution flow of the program and to debug it.

Line Number Information: Compilers can also include line number information in the
machine code, which allows the debugger to match machine code instructions to the
corresponding lines of source code.

Exception Handlers: Some languages have exception handling mechanism built-in, so the
debugger can use this information to provide better debugging support for exception handling
and to display the call stack when an exception is thrown.

14.Discuss absolute loader.


An absolute loader is a type of program loader that loads a program into memory and sets the
memory addresses in the code to fixed, predefined values. The absolute loader reads the
executable file from disk, loads it into memory and does not modify the memory addresses in
the code unlike relocating loader. It also links the program with any required libraries and
resolves any external references and checks if the program is trying to access any memory
that is not allocated to it, if it finds such cases it will terminate the program.

15.Draw the flow chart of pass-1 assembler

You might also like