[1/12, 16:51] MacTebo Eugene: 15 MCQ questions and answers on Assembly Language Programming
[1/12, 16:51] Meta AI: Here are 15 MCQ questions and answers on Assembly Language Programming:
*Question 1*
What is the primary purpose of an assembler in Assembly Language Programming?
A) To translate assembly code into machine code
B) To translate machine code into assembly code
C) To execute assembly code directly
D) To debug assembly code
Answer: A) To translate assembly code into machine code
*Question 2*
Which of the following is a characteristic of Assembly Language Programming?
A) High-level syntax
B) Portability across different platforms
C) Low-level memory management
D) Object-oriented programming
Answer: C) Low-level memory management
*Question 3*
What is the purpose of the MOV instruction in Assembly Language Programming?
A) To perform arithmetic operations
B) To transfer data between registers or memory locations
C) To control the flow of the program
D) To handle input/output operations
Answer: B) To transfer data between registers or memory locations
*Question 4*
Which register is used to store the address of the next instruction to be executed in Assembly Language
Programming?
A) Accumulator (ACC)
B) Program Counter (PC)
C) Stack Pointer (SP)
D) Base Pointer (BP)
Answer: B) Program Counter (PC)
*Question 5*
What is the purpose of the JMP instruction in Assembly Language Programming?
A) To perform arithmetic operations
B) To transfer data between registers or memory locations
C) To control the flow of the program by jumping to a label
D) To handle input/output operations
Answer: C) To control the flow of the program by jumping to a label
*Question 6*
Which of the following is a type of addressing mode in Assembly Language Programming?
A) Immediate addressing
B) Register addressing
C) Direct addressing
D) All of the above
Answer: D) All of the above
*Question 7*
What is the purpose of the SUB instruction in Assembly Language Programming?
A) To perform addition
B) To perform subtraction
C) To perform multiplication
D) To perform division
Answer: B) To perform subtraction
*Question 8*
Which register is used to store the current stack address in Assembly Language Programming?
A) Accumulator (ACC)
B) Program Counter (PC)
C) Stack Pointer (SP)
D) Base Pointer (BP)
Answer: C) Stack Pointer (SP)
*Question 9*
What is the purpose of the CALL instruction in Assembly Language Programming?
A) To perform arithmetic operations
B) To transfer data between registers or memory locations
C) To control the flow of the program by calling a subroutine
D) To handle input/output operations
Answer: C) To control the flow of the program by calling a subroutine
*Question 10*
Which of the following is a characteristic of Assembly Language Programming?
A) High-level syntax
B) Platform independence
C) Low-level memory management
D) Object-oriented programming
Answer: C) Low-level memory management
*Question 11*
What is the purpose of the RET instruction in Assembly Language Programming?
A) To perform arithmetic operations
B) To transfer data between registers or memory locations
C) To control the flow of the program by returning from a subroutine
D) To handle input/output operations
Answer: C) To control the flow of the program by returning from a subroutine
*Question 12*
Which register is used to store the current base address in Assembly Language Programming?
A) Accumulator (ACC)
B) Program Counter (PC)
C) Stack Pointer (SP)
D) Base Pointer (BP)
Answer: D) Base Pointer (BP)
*Question 13*
What is the purpose of the INC instruction in Assembly Language Programming?
A) To perform addition
B) To perform subtraction
C) To increment a register or memory location
D) To decrement a register or memory location
Answer: C) To increment a register or memory location
*Question 14*
Which of the following is a type of jump instruction in Assembly Language Programming?
A) Unconditional jump
B) Conditional jump
C) Relative jump
D) All of the above
Answer: D) All of the above
*Question 15*
What is the purpose of the DEC instruction in Assembly Language Programming?
A) To perform addition
B) To perform subtraction
C) To increment a register or memory location
D) To decrement a register or memory location
Answer: D) To decrement a register or memory location
[1/12, 17:13] MacTebo Eugene: 12 4-Marks questions and solutions on Assembly Language
Programming
[1/12, 17:13] Meta AI: Here are 12 4-marks questions and solutions on Assembly Language
Programming:
Question 1: Assembly Language Syntax
Explain the basic syntax of Assembly Language Programming, including labels, instructions, and
operands. (4 marks)
Solution
The basic syntax of Assembly Language Programming includes:
- Labels: Used to identify memory locations.
- Instructions: Used to perform operations, such as MOV, ADD, and JMP.
- Operands: Used to specify data or memory locations.
Question 2: Data Types
Describe the different data types used in Assembly Language Programming, including bytes, words, and
doublewords. (4 marks)
Solution
The different data types used in Assembly Language Programming include:
- Bytes (8 bits): Used to store small integers or characters.
- Words (16 bits): Used to store larger integers or addresses.
- Doublewords (32 bits): Used to store large integers or floating-point numbers.
Question 3: Addressing Modes
Explain the different addressing modes used in Assembly Language Programming, including immediate,
register, and direct addressing. (4 marks)
Solution
The different addressing modes used in Assembly Language Programming include:
- Immediate Addressing: Uses a constant value as an operand.
- Register Addressing: Uses a register as an operand.
- Direct Addressing: Uses a memory address as an operand.
Question 4: Arithmetic Instructions
Describe the arithmetic instructions used in Assembly Language Programming, including ADD, SUB,
MUL, and DIV. (4 marks)
Solution
The arithmetic instructions used in Assembly Language Programming include:
- ADD: Adds two operands.
- SUB: Subtracts one operand from another.
- MUL: Multiplies two operands.
- DIV: Divides one operand by another.
Question 5: Control Flow Instructions
Explain the control flow instructions used in Assembly Language Programming, including JMP, JE, and
JNE. (4 marks)
Solution
The control flow instructions used in Assembly Language Programming include:
- JMP: Unconditionally jumps to a label.
- JE: Jumps to a label if the zero flag is set.
- JNE: Jumps to a label if the zero flag is not set.
Question 6: Functions and Procedures
Describe how to define and call functions and procedures in Assembly Language Programming. (4 marks)
Solution
To define a function or procedure in Assembly Language Programming:
- Use the PROC directive to define the procedure.
- Use the ENDP directive to end the procedure.
To call a function or procedure:
- Use the CALL instruction to call the procedure.
Question 7: Arrays and Strings
Explain how to declare and manipulate arrays and strings in Assembly Language Programming. (4 marks)
Solution
To declare an array in Assembly Language Programming:
- Use the DB or DW directive to declare the array.
To manipulate an array:
- Use the MOV instruction to access array elements.
To declare a string:
- Use the DB directive to declare the string.
Question 8: Input/Output Operations
Describe how to perform input/output operations in Assembly Language Programming, including
reading from and writing to the console. (4 marks)
Solution
To perform input/output operations in Assembly Language Programming:
- Use the INT instruction to invoke BIOS or operating system services.
- Use the MOV instruction to access input/output ports.
Question 9: Interrupts
Explain how to handle interrupts in Assembly Language Programming, including setting up interrupt
handlers and restoring the interrupt flag. (4 marks)
Solution
To handle interrupts in Assembly Language Programming:
- Use the INT instruction to invoke the interrupt handler.
- Use the IRET instruction to return from the interrupt handler.
- Use the STI and CLI instructions to restore the interrupt flag.
Question 10: Macros
Describe how to define and use macros in Assembly Language Programming. (4 marks)
Solution
To define a macro in Assembly Language Programming:
- Use the MACRO directive to define the macro.
- Use the ENDM directive to end the macro.
To use a macro:
- Invoke the macro by its name.
Question 11: Segmentation
Explain how to use segmentation in Assembly Language Programming, including defining segments and
using segment registers. (4 marks)
Solution
To use segmentation in Assembly Language Programming:
- Define segments using the SEGMENT directive.
- Use segment registers (CS, DS, ES, FS, GS) to access segments.
Question 12: Debugging
Describe how to debug Assembly Language programs, including using debuggers and examining
registers and memory. (4 marks)
Solution
To debug Assembly Language programs:
- Use a debugger to step through the program and examine registers and memory.
- Use the MOV instruction to examine memory locations.
- Use the INT instruction to invoke debugger services.