250+ TOP MCQs on Arithmetic and Logic Instructions and Answers

AVR Micro-controller Multiple Choice Questions on “Arithmetic and Logic Instructions”.

1. In AVR microcontrollers, ADD instruction affects the status of which of the following bits of a status register?
a) Z
b) C
c) N
d) All of the mentioned

Answer: d
Clarification: ADD instruction affects the status of Z, C, N, V, H and S bits of a status register.

2. ADC instruction is used for?
a) addition of two 16 bit numbers
b) analog to digital conversion
c) automatic digital control
d) none of the mentioned

Answer: a
Clarification: ADC instruction can be used for addition of two 16 bit numbers as here two 8 bit numbers are added simultaneously along with the carry coming from the previous 8 bits. So it can be used for the addition of two 16 bit numbers.

3. AVR supports which of the following mentioned subtraction instructions?
a) SUB
b) SBC
c) SUBI
d) All of the mentioned

Answer: d
Clarification: AVR supports five types of subtraction instructions. They are SUB, SBC, SUBI, SBCI, SBIW.

4. What steps are involved when we subtract two numbers present at two different locations?
a) take the two’s complement of the subtrahend
b) add it to the minuend
c) invert the carry
d) all of the mentioned

Answer: d
Clarification: When we need to subtract two numbers present at two different locations then firstly we need to take the 2’s complement of the subtrahend, then we add it with the minuend and then when we invert the carry then the complete procedure of the subtraction is completed.

5. In executing subtraction based instructions, state the role of the C flag?
a) if C=1, the result is negative
b) if C=1, the result is positive
c) none of the mentioned
d) all of the mentioned

Answer: a
Clarification: If the C flag comes out to be 1, then the result is assumed to be negative and vice versa.

6. Which of the following is correct about the MUL instruction?
a) it is a byte-by-byte multiplication instruction
b) the product is stored in two registers R1 and R0
c) all of the mentioned
d) none of the mentioned

Answer: c
Clarification: MUL instruction is a byte-by-byte multiplication instruction whose result is stored in two registers R1 and R0.

7. In AVR, when is the V flag set?
a) there is a carry from D7 bit
b) there is a carry from D6 to D7 bit
c) when carry is generated only from D6 to D7 or carry is generated only from D7
d) none of the mentioned

Answer: c
Clarification: In AVR, V i.e. Overflow flag is set when carry is generated only from D6 to D7 or carry is generated only from D7. Overflow flag is used to detect errors in signed arithmetic operations.

8. To set the bits of a register R1 to 1, we must OR the contents of the register with?
a) 00H
b) 11H
c) FFH
d) 0FH

Answer: c
Clarification: To make the contents of the register R1 to 1 we must OR the contents of that register with FFH because according to Or algorithm 0+1=1 and 1+0=1.

9. CP instruction alters the value of the register?
a) true
b) false
c) none of the mentioned
d) can’t be said

Answer: b
Clarification: CP command is used to compare the contents of the two registers. It doesn’t actually alter the value of the register.

10. What is right about the ROR instruction?
a) it rotates the contents of the register left to right
b) it rotates the contents of the register from right to left
c) it rotates the contents of the register from left to right through carry
d) it rotates the contents of the register from right to left through carry

Answer: c
Clarification: ROR instruction is used to rotate the contents of the register from left to right through carry.

Leave a Reply

Your email address will not be published. Required fields are marked *