Arduino Questions and Answers – Interrupt Service Routine

This set of Arduino Multiple Choice Questions & Answers (MCQs) focuses on “Interrupt Service Routine”.

1. What is the use of the Interrupt Service Routine in an Arduino?
a) To automate functions
b) To boot up the arduino
c) To make more memory
d) To exit any code that is running
View Answer

Answer: a
Explanation: The interrupt service routine can be used to automate a number of functions in an arduino. In a situation where the entire focus of the code is bound to one function, the ISR can act as a pause for the arduino to stop the current function temporarily and divert memory to another function. That way, the entire memory of the arduino is used up in one function.

2. What is the use of the digitalPinToInterrupt() function?
a) To create an Interrupt Object
b) To delete an Interrupt Object
c) To map the Arduino Pin to the Interrupt pin
d) To invoke the Interrupt Service Routine
View Answer

Answer: c
Explanation: The digitalPinToInterrupt() function translates the physical pin number on the arduino into the interrupt index. This works in almost all Arduino Boards and is usually used in conjunction with the attachInterrupt() function.

3. What is the use of the attachInterrupt() function?
a) To enable ISR usage
b) To enable ISR usage, but only on certain Arduino Boards
c) To decommission ISR usage for a particular Arduino Board
d) To translate pin numbers
View Answer

Answer: a
Explanation: The attachInterrupt() function allows us to initiate an interrupt routine in any Arduino Board. The interrupt service routine can be used to automate a number of functions in an Arduino.
advertisement
advertisement

4. Will the delay() function work inside an interrupt routine?
a) Yes
b) No
View Answer

Answer: b
Explanation: The delay function will not work inside any Interrupt and it will not be able to function properly in any way. So, no programmer should use it inside the code dedicated for running as Interrupts. However delayMicroseconds() will work as it normally would.

5. What is the use of pin change interrupts?
a) To change pins during interrupts
b) To use more pins for interrupts
c) To disable pin usage during interrupts
d) To enable pin usage during interrupts
View Answer

Answer: b
Explanation: Pin change Interrupts can be used to enable the Arduino to use more than one pin during the interrupt service routine. In ATMega 168 or 328 based Arduino boards, upto 20 pins can be dedicated to interrupts.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. When does the Interrupt Handler execute it’s assigned code?
a) After all the codes executed in the program
b) Before any code is executed in the program
c) Blocks the code from getting executed at any time in the program
d) When the interrupt is in effect
View Answer

Answer: d
Explanation: The Interrupt Handler is an event by nature which, when raised, stops any code that is executing and first executes the code that is assigned to it, then returns the control back to the normal execution.

7. What is the use of the interrupt mode?
a) Decides which type of transition to trigger on
b) Decides when to turn off interrupts
c) Decides which pin to turn off
d) Decides when to turn off the Arduino Board
View Answer

Answer: a
Explanation: There are different types of transition, RISING, FALLING, and CHANGE.
RISING – Triggers interrupt when pin transitions from LOW to HIGH.
FALLING – Triggers interrupt when pin transitions from HIGH to LOW.
CHANGE – Triggers interrupt when pin transitions from LOW to HIGH or HIGH to LOW.
advertisement

8. What is the use of the detachInterrupt() function?
a) To turn off interrupt
b) To turn on interrupt
c) To disable interrupt functions for the remaining ON time.
d) To turn off the Arduino
View Answer

Answer: a
Explanation: The interrupt service routine can be used to automate a number of functions in an arduino. In a situation where the entire focus of the code is bound to one function, the ISR can act as a pause for the arduino to stop the current function temporarily and divert memory to another function. The detachInterrupt() function turns off the ISR functionality temporarily.

9. How many pins are available for interrupt functions in the Arduino Zero?
a) No pins
b) All pins except pin 4
c) Only pin 4
d) Only pin 3
View Answer

Answer: b
Explanation: ISR allows to initiate an interrupt routine in any Arduino Board. The interrupt service routine can be used to automate a number of functions in an Arduino. Usually a number of pins are assigned for any Board. The Arduino Zero has ISR functionality enabled for all it’s pins except pin 4.
advertisement

10. How many pins are available for interrupt functions in the Arduino Uno?
a) No pins
b) All pins except pin 2 and 3
c) Only pin 2
d) Only pins 2 and 3
View Answer

Answer: b
Explanation: ISR allows to initiate an interrupt routine in any Arduino Board. The interrupt service routine can be used to automate a number of functions in an Arduino. Usually a number of pins are assigned for any Board. The Arduino Uno has ISR functionality enabled for only pins 2 and 3.

Sanfoundry Global Education & Learning Series – Arduino.

To practice all areas of Arduino, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.