NEW
Font size
WorksheetsUNIT 2 PROGRAMMING IN 8086-S1
Total questions: 20
Worksheet time: 10mins
What is the purpose of addressing modes in 8086 assembly?
To provide flexibility in accessing operands and optimize instruction execution.
To enhance the security of the code.
To simplify the instruction set architecture.
To limit the number of available registers.
List three types of data transfer instructions in 8086.
ADD
SUB
MOV, PUSH, POP
MUL
Explain the difference between arithmetic and logical instructions.
Arithmetic instructions perform string manipulations, whereas logical instructions are for numerical comparisons.
Arithmetic instructions are used for data storage, while logical instructions are for memory management.
Arithmetic instructions are only applicable in programming languages, while logical instructions are used in hardware design.
Arithmetic instructions handle numerical calculations, while logical instructions manage boolean operations.
What is the function of branch instructions in assembly language?
The function of branch instructions is to change the flow of execution in a program.
To initialize variables.
To store data in memory.
To perform arithmetic operations.
Describe how loop instructions work in 8086 assembly.
Loop instructions in 8086 assembly increment the CX register and repeat execution until CX is one.
Loop instructions in 8086 assembly do not affect the CX register and run only once.
Loop instructions in 8086 assembly are used to jump to a random memory address without checking CX.
Loop instructions in 8086 assembly decrement the CX register and repeat execution until CX is zero.
What is a 'While' loop and how is it implemented in 8086?
A 'While' loop is a type of interrupt in 8086 programming.
In 8086, a 'While' loop is implemented using conditional jumps (like JZ, JNZ) and labels to control the flow based on a condition.
In 8086, 'While' loops are created with nested procedures only.
A 'While' loop is implemented using a single GOTO statement.
Define a 'Do' loop and provide an example in assembly language.
A 'Do' loop is a type of loop that only runs once.
Example in assembly language: section .data count db 0 section .text global _start _start: ; Do loop starts here mov al, [count] inc al mov [count], al cmp al, 5 jl _start ; Jump back to start if count < 5 ; Exit program mov eax, 60 ; syscall: exit xor edi, edi ; status: 0 syscall This example increments a counter until it reaches 5.
Example in assembly language: mov eax, 10; sub eax, 1; jnz _start;
A 'Do' loop is used to create a static array in assembly language.
What are strings in the context of 8086 assembly programming?
Strings in 8086 assembly are sequences of characters stored in memory, terminated by a null character.
Strings are only used for numeric data in 8086 assembly.
Strings in 8086 assembly are sequences of bytes without any termination.
Strings are fixed-length arrays of integers in 8086 assembly.
How do you declare a procedure in 8086 assembly?
Use 'PROC' to start and 'ENDP' to end the procedure.
Declare with 'FUNCTION' and close with 'END' in 8086 assembly.
Use 'BEGIN' to start and 'FINISH' to end the procedure.
Start with 'SUBROUTINE' and end with 'RETURN' for procedures.
What is the significance of macros in assembly language?
Macros enable code reuse and simplification in assembly language.
Macros are only applicable in high-level programming languages.
Macros are a type of data structure in assembly language.
Macros are used to increase the execution speed of assembly programs.
Give an example of a data transfer instruction in 8086.
SUB AX, BX
ADD AX, BX
XOR AX, BX
MOV AX, BX
What is the role of the accumulator in arithmetic operations?
The accumulator displays the results of arithmetic operations.
The accumulator is used to input data into the system.
The accumulator performs final calculations in arithmetic operations.
The accumulator stores intermediate results in arithmetic operations.
How can you implement conditional branching in 8086?
Use conditional jump instructions like JE, JNE, JL, etc., based on flag status.
Use arithmetic instructions like ADD and SUB for branching.
Implement loops using the LOOP instruction without conditions.
Utilize the INT instruction to create branches based on interrupts.
What are the advantages of using procedures in assembly programming?
Using procedures makes debugging more difficult.
Advantages of using procedures in assembly programming include code reusability, easier debugging, better organization, improved readability, and reduced code duplication.
Procedures increase code size significantly.
Procedures eliminate the need for comments in code.
Explain how to manipulate strings using assembly instructions.
String manipulation is only possible in compiled languages.
Strings can only be manipulated using high-level languages.
String manipulation in assembly involves loading, iterating, modifying, and storing strings using specific instructions.
Assembly instructions do not support string operations.
What is the purpose of using labels in 8086 assembly language?
Labels are only used for comments in assembly language.
Labels are used to define data types in assembly language.
Labels are used to initialize variables in assembly language.
Labels serve as markers for memory addresses, allowing for easier navigation and control flow in the program.
How do you implement a 'For' loop in 8086 assembly language?
A 'For' loop is implemented using a combination of a counter and conditional jumps to control the loop execution.
A 'For' loop can be implemented using only arithmetic instructions.
'For' loops are not supported in 8086 assembly language.
Use a single GOTO statement to create a 'For' loop in assembly.
What is the function of the stack in 8086 assembly programming?
The stack is not utilized in 8086 assembly programming.
The stack is primarily used for storing global variables.
The stack is used to perform arithmetic operations directly.
The stack is used for temporary data storage and to manage function calls and returns.
What is the purpose of using the 'CALL' instruction in assembly language?
To initialize variables in memory.
To perform arithmetic operations.
To transfer control to a procedure and save the return address on the stack.
To create loops in the program.
What is the function of the 'PUSH' instruction in 8086 assembly?
To compare two values.
To place data onto the stack for temporary storage.
To add two numbers together.
To remove data from the stack.
