Assembly Programming Question Bank for C-CAT
Topic-wise Assembly Programming MCQs for CDAC C-CAT preparation with answers and explanations.
Show Answer & Explanation
Correct Answer: A - Copies source to destination
MOV copies data from source to destination (source unchanged).
Show Answer & Explanation
Correct Answer: B - Adds source to destination
ADD: destination = destination + source.
Show Answer & Explanation
Correct Answer: B - Subtracts source from destination
SUB: destination = destination - source.
Show Answer & Explanation
Correct Answer: D - Compares by subtracting, sets flags
CMP subtracts without storing result, only sets flags.
Show Answer & Explanation
Correct Answer: B - Unconditional jump
JMP: unconditional jump to specified address.
Show Answer & Explanation
Correct Answer: B - Zero flag is set
JZ (Jump if Zero): jumps when ZF=1.
Show Answer & Explanation
Correct Answer: B - Pushes return address, jumps to subroutine
CALL saves return address on stack and jumps to subroutine.
Show Answer & Explanation
Correct Answer: B - Returns from subroutine
RET pops return address from stack and returns.
Show Answer & Explanation
Correct Answer: A - Decrements CX, loops if CX!= 0
LOOP decrements CX; if CX!= 0, jumps to label.
Show Answer & Explanation
Correct Answer: C - Loads effective address
LEA (Load Effective Address) loads address, not data.
Show Answer & Explanation
Correct Answer: C - Copies data from source to destination
MOV copies data from source operand to destination operand. Source remains unchanged.
Show Answer & Explanation
Correct Answer: D - MOV copies data, XCHG exchanges data between operands
MOV copies from source to destination. XCHG exchanges contents between two operands.
Show Answer & Explanation
Correct Answer: B - Writes data to stack and decrements SP
PUSH decrements the stack pointer and then copies the operand to the top of stack.
Show Answer & Explanation
Correct Answer: C - Reads data from stack and increments SP
POP copies data from top of stack to operand and then increments the stack pointer.
Show Answer & Explanation
Correct Answer: B - Pushes return address and jumps to subroutine
CALL pushes the return address (next instruction) onto stack and then jumps to the subroutine.
Show Answer & Explanation
Correct Answer: D - Pops return address from stack and jumps to it
RET pops the return address from the stack into IP/PC, returning control to the caller.
Show Answer & Explanation
Correct Answer: A - CALL saves return address, JMP does not
JMP simply transfers control without saving return address. CALL saves return address on stack for later RET.
Show Answer & Explanation
Correct Answer: B - Instruction for the assembler, not converted to machine code
Assembler directives (like ORG, EQU, DB) instruct the assembler but are not converted to machine instructions.
Show Answer & Explanation
Correct Answer: D - Sets the starting address for code/data
ORG (Origin) directive sets the memory address where the following code or data will be placed.
Show Answer & Explanation
Correct Answer: A - Subtracts operands and sets flags without storing result
CMP subtracts second operand from first, setting flags accordingly, but does not store the result.
Show Answer & Explanation
Correct Answer: C - Jump if Zero flag is set
JZ (Jump if Zero) transfers control if the Zero flag is set (previous operation result was zero).
Show Answer & Explanation
Correct Answer: D - They are the same instruction
JE (Jump if Equal) and JZ (Jump if Zero) are identical - both check if Zero flag is set.
Show Answer & Explanation
Correct Answer: C - Decrements CX and jumps if CX is not zero
LOOP decrements CX (counter) and jumps to target label if CX is not zero, used for counted loops.
Show Answer & Explanation
Correct Answer: C - Loads effective address into register
LEA (Load Effective Address) calculates and loads the memory address of operand into register, not the value.
Show Answer & Explanation
Correct Answer: D - No operation - does nothing but consume time
NOP (No Operation) performs no operation. Used for timing delays or reserving space for later patching.
Show Answer & Explanation
Correct Answer: A - MOV
MOV Rd, Rs copies the content of source register (Rs) to the destination register (Rd). For example, MOV A, B copies the content of B into A.
Show Answer & Explanation
Correct Answer: C - Immediate addressing
MVI A, 32H uses immediate addressing mode because the data (32H) is specified directly in the instruction as the second byte.
Show Answer & Explanation
Correct Answer: A - LDA address
LDA (Load Accumulator Direct) loads the accumulator with the contents of the memory location specified by a 16-bit address. It is a 3-byte instruction.
Show Answer & Explanation
Correct Answer: B - Stores BC pair on stack (B first, then C)
PUSH B pushes the BC register pair onto the stack. First, SP is decremented and B is stored, then SP is decremented again and C is stored.
Show Answer & Explanation
Correct Answer: C - Decimal Adjust Accumulator for BCD arithmetic
DAA (Decimal Adjust Accumulator) adjusts the result in the accumulator after a BCD addition to ensure the result is valid BCD. It adds 06H or 60H as needed.
Show Answer & Explanation
Correct Answer: B - CMA
CMA (Complement Accumulator) performs a bitwise complement (1's complement) of the accumulator. Each bit is inverted: 0 becomes 1 and 1 becomes 0.
Show Answer & Explanation
Correct Answer: A - HL and DE register pairs
XCHG exchanges the contents of the HL register pair with the DE register pair. H↔D and L↔E. It is a 1-byte instruction requiring 4 T-states.
Show Answer & Explanation
Correct Answer: D - Register indirect addressing
MOV A, M uses register indirect addressing. 'M' refers to the memory location whose address is in the HL register pair. The content at that address is moved to A.
Show Answer & Explanation
Correct Answer: C - RAL
RAL (Rotate Accumulator Left through carry) rotates the accumulator bits left through the carry flag. The carry flag goes to bit 0, and bit 7 goes to carry.
Show Answer & Explanation
Correct Answer: D - Indexed addressing with displacement
LEA BX, [SI+10] uses indexed addressing with displacement. The effective address is computed by adding the index register SI value with the displacement 10.
Show Answer & Explanation
Correct Answer: D - Stops program execution until reset or interrupt
HLT stops the program execution. The processor enters a halt state and waits until an interrupt occurs or the processor is reset using RESET IN pin.
Show Answer & Explanation
Correct Answer: C - MOVSB/MOVSW
MOVSB (Move String Byte) and MOVSW (Move String Word) are used with the REP prefix to transfer blocks of data from DS:SI to ES:DI automatically.
Show Answer & Explanation
Correct Answer: C - HL pair from two consecutive memory locations
LHLD (Load HL Direct) loads the HL register pair from two consecutive memory locations. L is loaded from the specified address and H from the next address.
Show Answer & Explanation
Correct Answer: A - Compares accumulator with immediate data
CPI (Compare Immediate) compares the accumulator with 8-bit immediate data by subtracting the data from A (without storing result). Flags are set based on the result.
Show Answer & Explanation
Correct Answer: D - Software interrupt
INT 21H is a software interrupt instruction. It invokes interrupt service routine number 21H (DOS function calls). Software interrupts are triggered by the INT instruction.
Show Answer & Explanation
Correct Answer: B - CALL and RET
CALL pushes the return address onto the stack and jumps to the subroutine address. RET pops the return address from the stack back into the PC to resume execution.
Show Answer & Explanation
Correct Answer: A - 3 bytes
LDA is a 3-byte instruction: 1 byte for the opcode (3AH) and 2 bytes for the 16-bit memory address (lower byte first, then higher byte).
Show Answer & Explanation
Correct Answer: D - INX H
INX H increments the 16-bit content of the HL register pair by 1. Unlike INR which works on 8-bit registers, INX works on 16-bit register pairs.
Show Answer & Explanation
Correct Answer: A - Replaces AL with a byte from a lookup table at BX+AL
XLAT (Translate) loads AL with the byte from a table in memory. The table address is DS:BX, and AL serves as the index. Effective address = BX + AL.
Show Answer & Explanation
Correct Answer: A - Sets the carry flag to 1
STC (Set Carry) sets the carry flag (CY) to 1. No other flags are affected by this instruction.
Show Answer & Explanation
Correct Answer: C - Based indexed with displacement
MOV AX, [BX+SI+5] uses based indexed with displacement addressing. The effective address = BX + SI + 5, combining a base register, index register, and displacement.
Show Answer & Explanation
Correct Answer: B - Rotate accumulator right without carry
RRC (Rotate Right Carry) rotates the accumulator right. Bit 0 goes to both the carry flag and bit 7. The carry flag is not included in the rotation path.
Show Answer & Explanation
Correct Answer: A - Decrements the memory content pointed by HL
DCR M decrements the content of the memory location addressed by the HL register pair by 1. 'M' refers to the memory location pointed to by HL.
Show Answer & Explanation
Correct Answer: A - Direction Flag
The Direction Flag (DF) controls the direction of string operations. DF=0 (CLD) causes auto-increment; DF=1 (STD) causes auto-decrement of SI and DI.
Show Answer & Explanation
Correct Answer: D - Copies HL content to Program Counter
PCHL copies the contents of the HL register pair to the Program Counter. This effectively jumps to the address stored in HL, providing an indirect jump mechanism.