Engineering Questions with Answers - Multiple Choice Questions

MCQs on Interrupt Programming

1 - Question

On reset, what are the contents of the SREG register?
a) 00h
b) ffh
c) 1fh
d) 11h

View Answer

Answer: a
Explanation: On reset, all the interrupts are masked and so the contents of the SREG register is also set to zero as it shows the status of the flags.




2 - Question

TIMSK register is used for?
a) knowing the status of the timer count
b) used for masking the interrupts flags of the Timer0, Timer1 and Timer2
c) it is used for enabling all the timer interrupts
d) it is used for resetting the value of the interrupts

View Answer

Answer: b
Explanation: TIMSK is used for masking the interrupt flags of the timers. They mask the bits of the timer flags if the D7 bit of the SREG register is set to 1 or when firstly all interrupts are enabled.




3 - Question

Why RETI instruction be the last instruction of ISR?
a) because it returns with carry
b) because it returns to the main program with all the flags of the SREG raised
c) because it returns to the main program where interrupt is generated and set the global interrupt enable bit in SREG
d) none of the mentioned

View Answer

Answer: c
Explanation: When an interrupt occurs, the global interrupt enable bit is cleared. If global interrupt enable is cleared it means interrupts are disabled. RETI instruction must last instruction of ISR because it returns to the main program where interrupt is generated and sets the global interrupt enable bit in SREG.




4 - Question

In AVR what is the ISR address for an external hardware interrupt?
a) 0002h
b) 0004h
c) 0006h
d) all of the mentioned

View Answer

Answer: d
Explanation: The ISR addresses for the external hardware interrupts are 0002h, 0004h, 0006h.




5 - Question

What is the address in the interrupt service routine assigned for the timer0 overflow flag?
a) 0012h
b) 000Ah
c) 0016h
d) all of the mentioned

View Answer

Answer: c
Explanation: 0016h is the address in the interrupt service routine assigned for the timer0 overflow flag.




6 - Question

Is the same address is assigned for the timer0 and timer1 overflow flag in the interrupt vector table of the interrupts?
a) true
b) false
c) can’t be determined
d) depends on the situation

View Answer

Answer: b
Explanation: Different addresses are assigned for Timer0 and Timer1 overflow flags in the interrupt vector table. They are 0016h and 0012h for timer0 and timer1 respectively.




7 - Question

External hardware interrupts are assigned to which pins of the atmega32?
a) PORTD.2
b) PORTD.3
c) PORTB.2
d) All of the mentioned

View Answer

Answer: d
Explanation: There are three external hardware interrupts in the atmega32 microcontrollers. They are assigned to bits PORTD.2, PORTD.3 and PORTB.2.




8 - Question

Which register is responsible for handling all the external hardware interrupts?
a) TIMSK
b) GICR
c) MCUCR
d) IVCE

View Answer

Answer: b
Explanation: GICR register is responsible for all the external hardware interrupts in the AVR.




9 - Question

By default, INT0-INT2 interrupts are?
a) edge triggered
b) level triggered
c) all of the mentioned
d) none of the mentioned

View Answer

Answer: b
Explanation: By default, INT0-INT2 are the level triggered pulses. The low level of the pulse generates the interrupt.




10 - Question

What will happen in that condition, if an interrupt occurs while the microcontroller is serving any other interrupt?
a) both the interrupts will be handled simultaneously
b) the interrupt which is being done first will be served first
c) the interrupt that is more priority in the interrupt vector table will be served first
d) the interrupt having low priority in the interrupt vector table will be served first

View Answer

Answer: c
Explanation: If two or more interrupts occur simultaneously then the interrupt that is having more priority in the interrupt vector table will be served first.

Get weekly updates about new MCQs and other posts by joining 18000+ community of active learners