0% found this document useful (0 votes)
38 views9 pages

Microprocessor ORAL Question Bank Answers

The document is a comprehensive question bank on microprocessor concepts, covering topics such as assembly language, instructions, system calls, and processor architecture. It includes definitions, differences between terms, examples of instructions, and explanations of various concepts like segmentation and multitasking. Key topics addressed include the use of different assemblers, the role of registers, and the functioning of interrupts and procedures.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views9 pages

Microprocessor ORAL Question Bank Answers

The document is a comprehensive question bank on microprocessor concepts, covering topics such as assembly language, instructions, system calls, and processor architecture. It includes definitions, differences between terms, examples of instructions, and explanations of various concepts like segmentation and multitasking. Key topics addressed include the use of different assemblers, the role of registers, and the functioning of interrupts and procedures.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Microprocessor Question Bank Answers.

1. Which assemblers can be used for execution of assembly language programs?


What is the long form of NASM?
NASM (Netwide Assembler) is a popular assembler used for executing assembly language
programs. Other assemblers include MASM (Microsoft Assembler) and GAS (GNU
Assembler).
2. Differentiate between compiler and assembler.

Compiler Assembler
Translates high-level language code into Converts assembly language code into
machine code. machine code.
Produces an executable file directly. Produces an object file or machine code.
3. Which are three sections present in assembly language? What do we write in
all sections?
The three sections are:
• Data Section: Used to define constants and variables.
• Text Section: Contains the code or instructions.
• BSS Section: Holds uninitialized variables.
4. Write a system call for read, write, and exit system call.
• Read: mov eax, 0 (sys_read)
• Write: mov eax, 4 (sys_write)
• Exit: mov eax, 1 (sys_exit)
5. How to execute a program using NASM or Write an execution steps to
execute assembly language program.
1. Write the assembly code in a .asm file.
2. Assemble the code with nasm -f elf64 filename.asm.
3. Link the object file with ld -s -o output filename.o.
4. Execute with ./output.
6. What is the ASCII value for newline?
The ASCII value for newline (LF) is 10.
7. What is ASCII value for 0 to 9?
The ASCII values for '0' to '9' are 48 to 57.
8. Explain BTC, BTR, BTS instruction with example.
• BTC (Bit Test and Complement): Complements the bit in a specified register.
Example: BTC AX, 3
• BTR (Bit Test and Reset): Resets the bit in a specified register.
Example: BTR AX, 3
• BTS (Bit Test and Set): Sets the bit in a specified register.
Example: BTS AX, 3
9. Which instruction is used to check whether that number is positive or
negative? How it works?
The TEST instruction is used to check the sign. It works by performing a bitwise AND
between two operands and updating the flags accordingly.
10. Explain directives in assembly.
Directives are commands that provide instructions to the assembler. They do not
generate machine code but assist in code structure, like .data, .text, and .global.
11. What is the meaning of global _start and _start?
• global _start: Marks the entry point for linking.
• _start: The program entry point in assembly, where execution begins.
12. Write the equivalent instruction of ROL BX,1.
ROL BX, 1 rotates the bits of BX left by one position. Equivalent instruction:
SHL BX, 1
RCL BX, 1
13. Difference between SUB and CMP.

SUB CMP
Subtracts the second operand Compares two operands by subtracting them but does
from the first. not store the result.
Affects the destination operand. Only affects flags.
14. Differentiate between conditional & unconditional jump instruction.

Conditional Jump Unconditional Jump


Instruction Instruction
Jumps based on the state of Always jumps, regardless of flag
flags. state.
Examples: JE, JNE, JG. Examples: JMP, CALL.
15. Write instructions to convert from hex to ascii.
To convert a hexadecimal value to ASCII, you can use:
MOV AL, hex_value
ADD AL, '0' (if between 0-9) or
ADD AL, 'A' - 10 (if between A-F)
16. Explain shift and rotate instructions with example.
• Shift instructions (SHL/SHR): Move bits left or right, filling with zero.
Example: SHL AX, 1 (Shift left by 1).
• Rotate instructions (ROL/ROR): Rotate bits left or right, wrapping around.
Example: ROL AX, 1 (Rotate left by 1).
17. If both the numbers are 32-bit then how many bits result you are getting for
multiplication operation?
For 32-bit multiplication, the result is 64 bits (since 32 * 32 = 64 bits).
18. What is the ASCII value for Space and Enter?
• Space: ASCII value is 32.
• Enter (Carriage Return): ASCII value is 13.
19. Differentiate between macro and procedure.

Macro Procedure
A sequence of code that gets expanded A block of code that is called by a specific
inline. instruction.
No function call overhead. Has function call overhead.
20. Explain push and pop instructions.
• PUSH: Decreases the stack pointer and stores the value at the memory location.
• POP: Increases the stack pointer and retrieves the value from the stack.
21. What is the logic of non-overlapped block transfer with string instructions?
non-overlapped block transfer uses MOVSB and related instructions to transfer data
between two memory areas without overlapping, ensuring safe data movement.
22. Explain instructions:
• MOVSB: Moves a byte from the source to the destination.
• REP: Repeats a string operation for a specified number of times.
• CLD: Clears the direction flag (enabling auto-incrementing for string operations).
23. What is the use of direction flag?
The direction flag controls the direction of string operations (increment or decrement the
pointer).
24. Write instructions to convert from ASCII to hex.
Use the following steps to convert from ASCII to hex:
MOV AL, [ASCII_value]
SUB AL, '0' (for numbers)
or SUB AL, 'A' - 10 (for letters).
25. Explain flag control instructions.
Flag control instructions like CLC (clear carry flag), STC (set carry flag), and CLD (clear
direction flag) manipulate processor flags.
26. Explain the logic of overlapped block transfer without string instructions.
Overlapped block transfer directly manipulates memory addresses to transfer data
between source and destination, potentially overwriting the original data.
27. Differentiate between near & far procedure.

Near Procedure Far Procedure


Calls within the same segment. Calls across different segments.
No need to store segment Requires storing the segment and
information. offset.
28. Differentiate between jmp and call.

JMP CALL
A jump instruction to a A jump to a label with saving the return address on
label. the stack.
No return address is
Saves the return address on the stack.
saved.
29. Execution steps for far procedure program?
1. The processor saves the current instruction pointer and segment register.
2. It then loads the new segment and instruction pointer from the far procedure
address.
3. Upon returning, the saved instruction pointer and segment register are restored.
30. Which contents are stored in the rax register after opening a file?
After opening a file, the rax register typically stores the file descriptor, a positive integer.
31. Which contents are stored in the rax register after reading a file?
After reading a file, rax contains the number of bytes read.
32. What is assembly language?
Assembly language is a low-level programming language that uses symbolic
representations of machine code instructions.
33. What is the meaning of command line argument?
Command line arguments are values passed to a program at execution time, used for
configuration or input data.
34. What is the first and second argument in a stack?
The first argument is pushed last (the highest address), and the second argument is
pushed before it.
35. How many times must the pop instruction be used to get the actual
argument?
The pop instruction needs to be used once for each argument to retrieve them from the
stack.
36. List the names of different assemblers.
• NASM (Netwide Assembler)
• MASM (Microsoft Assembler)
• GAS (GNU Assembler)
37. What is the difference between assembler and compiler?
An assembler translates assembly language into machine code, while a compiler
translates high-level programming languages into machine code.
38. Advantages of defining a macro.
Defining a macro provides code reusability, reduces redundancy, and simplifies complex
code.
39. In multiplication, operation in which register is the result stored?
In x86 architecture, the result of a multiplication operation is stored in the AX register
(for 16-bit), EAX (for 32-bit), or RAX (for 64-bit).
40. In division, operation in which register is the quotient & remainder stored?
For division, the quotient is stored in AX/EAX/RAX (depending on the operand size), and
the remainder in DX/EDX/RDX.
41. Enlist single operand instructions with their syntax.
• INC operand: Increments the operand by 1.
• DEC operand: Decrements the operand by 1.
42. Write any 5 double operand instructions with syntax.
• ADD destination, source: Adds source to destination.
• SUB destination, source: Subtracts source from destination.
• MUL operand: Multiplies operand by accumulator.
• DIV operand: Divides accumulator by operand.
• AND destination, source: Performs bitwise AND between destination and
source.
43. List the 32-bit registers and 64-bit registers.
• 32-bit registers: EAX, EBX, ECX, EDX, ESI, EDI, ESP, EBP.
• 64-bit registers: RAX, RBX, RCX, RDX, RSI, RDI, RSP, RBP.
44. What is the difference between SUB and CMP instruction?
The SUB instruction subtracts values and stores the result, while CMP subtracts values
but does not store the result, only affecting the flags.
45. What is the size of GDTR, LDTR, and IDTR? Draw its format.
The size of GDTR, LDTR, and IDTR is 6 bytes. They store the base address and limit of
the respective descriptor tables. Format:
• Base (4 bytes)
• Limit (2 bytes)
46. Explain rotate instruction with example.
Rotate instructions (ROL, ROR) rotate bits in a register or memory without losing any
bits.
Example: ROL AX, 1 rotates the bits in AX left by 1 position.
47. Write a syscall for file operations: read, write, open, close.
• Read: mov eax, 0
• Write: mov eax, 4
• Open: mov eax, 5
• Close: mov eax, 6
48. What is machine status word?
The Machine Status Word (MSW) holds control bits for managing the state of the
processor, including the interrupt flag and other control registers.
49. Explain control register.
Control registers are special-purpose registers used to manage processor modes and
configurations, such as segmentation, paging, and protection.
50. What is the use of IP?
The Instruction Pointer (IP) holds the address of the next instruction to be executed.
51. In case of far procedure, how does the processor know which instruction is
to be executed?
In a far procedure, the processor knows the instruction to be executed by loading the
segment and offset values from the procedure's address.
52. What is real and protected mode? Difference between them?
• Real Mode: A simple mode where the processor addresses memory directly, with
no memory protection.
• Protected Mode: Provides access to virtual memory, segmentation, and
protection mechanisms.
53. How does the user know that the processor is working with real mode?
The processor operates with real mode if it is not in a protected environment, typically
indicated by the lack of memory protection and the 16-bit addressing mode.
54. How does the processor switch from real to protected mode?
The processor switches from real to protected mode through a software interrupt (like
INT 0x10) and setting control registers for segmentation and protection.
55. What is segmentation and paging?
• Segmentation divides memory into segments for logical separation of code and
data.
• Paging breaks memory into fixed-size pages for efficient memory management.
56. Difference between segmentation and paging.
• Segmentation divides memory into variable-length segments, while paging
divides memory into fixed-size pages.
57. Similarities between macro and procedure.
Both macros and procedures allow for reusable code, but macros are expanded inline,
while procedures are called with specific function call mechanisms.
58. What is the name of the coprocessor for 80386?
The coprocessor for the 80386 is the 80387.
59. Prepare all Flag registers.
The flag registers include:
• Carry Flag (CF)
• Zero Flag (ZF)
• Sign Flag (SF)
• Overflow Flag (OF)
• Interrupt Flag (IF)
• Direction Flag (DF)
• Auxiliary Carry Flag (AF)
• Parity Flag (PF)
60. What is the use of Vmode? What is an interrupt?
Vmode refers to virtual mode, and an interrupt is a mechanism that allows the processor
to respond to asynchronous events.
61. Differentiate between IMUL and MUL instruction.

IMUL MUL
Signed multiplication. Unsigned multiplication.
Uses operands as signed Uses operands as unsigned
IMUL MUL
integers. integers.
62. Differentiate between Carry flag and Auxiliary carry flag.

Carry Flag (CF) Auxiliary Carry Flag (AF)


Indicates overflow in binary addition Indicates carry/borrow between the lower nibble
or subtraction. and upper nibble.
63. What is the function of TR (Task Register)?
The Task Register (TR) holds the segment selector for the task state segment, used for
multitasking.
64. What is the ASCII value for Enter?
The ASCII value for Enter (Carriage Return) is 13.
65. Which flag is useful for string operations?
The Direction Flag (DF) is used for string operations, controlling whether string
operations process data from low to high or high to low memory addresses.
66. What is the syntax for macro?
The syntax for a macro is:
%macro macro_name parameters
instructions
%endmacro
67. What is opcode and operand?
• Opcode is the instruction that specifies the operation to perform.
• Operand is the data or address on which the operation is performed.
68. What is the size of double word and quad word?
• Double word: 32 bits (4 bytes)
• Quad word: 64 bits (8 bytes)
69. What is ISR (Interrupt Service Routine)?
An ISR is a special function that handles specific interrupt requests and performs the
required action.
70. Which are the features of 80386?
The 80386 processor supports 32-bit processing, virtual memory, and paging, providing
improved multitasking and protection mechanisms.
71. What is protection, and which are the privilege levels?
Protection ensures memory and task isolation, and the processor has 4 privilege levels
(rings 0 to 3), with Ring 0 being the most privileged.
72. What is multitasking?
Multitasking refers to the ability of a system to run multiple processes simultaneously by
managing CPU time efficiently.
73. What is selector and descriptor? Which are the descriptors and their use?
• Selector is a pointer to a segment in memory.
• Descriptor defines the properties of a segment, such as its base, size, and access
rights. Types of descriptors include code descriptor, data descriptor, and
system descriptor.

You might also like