Assembly Language Basics: Instructions and Operations Quiz Quiz

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.

  1. Identifying Data Movement Instructions

    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?

    1. INC AX, BX
    2. ADD BX, AX
    3. PUSH AX, BX
    4. MOV BX, AX

    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.

  2. Understanding Addressing Modes

    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?

    1. Register indirect addressing
    2. Direct addressing
    3. Immediate addressing
    4. Indexed addressing

    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.

  3. Arithmetic Instructions Usage

    What is the result in AX after executing the sequence: MOV AX, 3; SUB AX, 1?

    1. 4
    2. 0
    3. 1
    4. 2

    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.

  4. Jump Instructions and Flow Control

    Which assembly instruction would unconditionally transfer program execution to a labeled location named START?

    1. RET START
    2. CALL START
    3. JMP START
    4. JNZ 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.

  5. Role of the CMP Instruction

    In assembly language, what does the instruction CMP AX, BX do to the processor?

    1. Adds AX and BX and stores the result in AX
    2. Compares AX and BX and updates flags for conditional jumps
    3. Copies the value from BX into AX
    4. Subtracts BX from AX and stores the result in AX

    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.