Assess your understanding of fundamental assembly language operations, instruction types, and basic concepts. This quiz is designed to reinforce knowledge about addressing modes, common instructions, and operational behaviors in assembly programming.
Which of the following assembly instructions is primarily used to transfer data from one register to another, for example, copying the value from register AX to BX?
Explanation: The MOV instruction is used to copy data from one register to another, as shown in the example. ADD performs addition, not data transfer. INC increases the value of a register by one, but its syntax is incorrect here and does not involve two registers. PUSH is used to place a value on the stack, not for register-to-register data movement.
If an assembly instruction uses the value stored at a memory address specified in a register, such as MOV AX, [BX], which addressing mode is being used?
Explanation: Register indirect addressing accesses memory at the address held in a register, which is the case in MOV AX, [BX]. Immediate addressing uses constant values, not memory references. Direct addressing specifies an explicit memory address, not one from a register. Indexed addressing involves combining a base and index, often for arrays, which is not the case here.
What is the result in AX after executing the sequence: MOV AX, 3; SUB AX, 1?
Explanation: MOV AX, 3 loads 3 into AX, and SUB AX, 1 subtracts 1 from it, so the result is 2. Choosing 4 assumes addition instead of subtraction. Selecting 1 would only be correct if the second instruction was SUB AX, 2. Zero would only be correct if both values were initially equal.
Which assembly instruction would unconditionally transfer program execution to a labeled location named START?
Explanation: JMP START performs an unconditional jump to the label START, changing the program's flow immediately. JNZ is a conditional jump based on the zero flag, not unconditionally. CALL is used for subroutine calls and pushes the return address. RET does not transfer to a label but returns from a subroutine.
In assembly language, what does the instruction CMP AX, BX do to the processor?
Explanation: CMP AX, BX compares the contents of AX and BX by subtracting BX from AX, updating the processor's status flags, but does not alter the operands. It does not copy data between registers, as in MOV, nor does it store arithmetic results, unlike ADD or SUB. CMP is specifically used to set flags for following conditional jump instructions.