Assembly language Online Quiz

Welcome to our Assembly Language Online Quiz, tailored to assess and enhance your understanding of assembly language programming. Assembly language, a low-level programming language, allows direct interaction with a computer's hardware. It requires a detailed understanding of computer architecture and operations. This quiz focuses on various assembly languages, including x86 and ARM, covering basic syntax, data manipulation, control structures, and system calls. Whether you're a student or a professional, these questions will challenge your skills and deepen your knowledge.

1. What is the primary purpose of assembly language?

a) High-level application development
b) Direct hardware manipulation and performance optimization
c) Cross-platform software development
d) Web development

2. How do you move data into a register in x86 assembly?

MOV AX, 1234h
a) MOV AX, 1234h
b) SET AX, 1234h
c) PUSH AX, 1234h
d) LOAD AX, 1234h

3. What does the following assembly code do?

INC ECX
DEC EDX
a) Increments ECX and decrements EDX
b) Multiplies ECX and EDX
c) Divides ECX and EDX
d) Compares ECX and EDX

4. How do you define a constant byte in assembly?

a) CONST BYTE 0x1F
b) DB 0x1F
c) BYTE 0x1F
d) DEF BYTE 0x1F

5. What is the output of the following assembly code?

MOV AL, 1
ADD AL, 2
a) 1
b) 2
c) 3
d) 4

6. What instruction compares two values in x86 assembly?

a) CMP
b) COMP
c) TEST
d) CHECK

7. How do you create a loop that repeats 5 times in assembly?

MOV CX, 5
label: NOP
LOOP label
a) MOV CX, 5\nlabel: NOP\nLOOP label
b) REPEAT 5 TIMES\nNOP
c) FOR CX, 5\nNOP\nEND FOR
d) WHILE CX < 5\nNOP\nWEND

8. What does the INT instruction do in assembly language?

a) Integrates a function
b) Performs integer division
c) Triggers a software interrupt
d) Converts a floating-point number to an integer

9. How do you access an array element at a specific index in assembly?

MOV BX, OFFSET ARRAY
MOV AX, [BX+4]
a) MOV BX, OFFSET ARRAY\nMOV AX, [BX+4]
b) ARRAY[4]
c) LOAD ARRAY[4], AX
d) ACCESS ARRAY, 4

10. What is the purpose of the NOP instruction in assembly language?

a) Performs a bitwise NOT operation
b) No operation, used for timing adjustments and code alignment
c) Negates the operation of the previous instruction
d) Normal operation procedure

11. How is data transferred between memory and registers in assembly?

a) Using the TRANSFER command
b) Using the XFER instruction
c) Using the MOV instruction
d) Using the COPY instruction

12. What assembly instruction is used to return from a subroutine?

a) RETURN
b) EXIT
c) RET
d) BACK

13. How do you set a register to zero using x86 assembly?

XOR AX, AX
a) SET AX, 0
b) AX = 0
c) XOR AX, AX
d) ZERO AX

14. How do you declare a string in assembly language?

myString DB 'Hello, world!',0
a) myString DB 'Hello, world!',0
b) DECLARE STRING 'Hello, world!'
c) STRING 'Hello, world!'
d) DEFSTR 'Hello, world!'

15. What is the role of the stack in assembly programming?

a) To perform arithmetic operations
b) To manage function calls and local variables
c) To increase the execution speed
d) To connect to hardware

16. What assembly directive is used to include libraries or other assembly files?

a) #include
b) INCLUDE
c) LIB
d) INSERT

17. How do you perform a bitwise AND operation in assembly?

AND AX, BX
a) AND AX, BX
b) BITAND AX, BX
c) AX & BX
d) AX AND BX

18. How do you jump to a label conditionally based on the zero flag?

a) JZ LABEL
b) JMPZ LABEL
c) JUMPZ LABEL
d) CZ LABEL

19. What is the effect of the INC instruction on the carry flag?

a) It clears the carry flag
b) It sets the carry flag
c) It does not affect the carry flag
d) It toggles the carry flag

20. How do you handle floating-point operations in assembly?

a) Using the standard arithmetic instructions
b) Using specific floating-point registers and instructions
c) Floating-point operations are not supported
d) Using software emulation libraries

Comments