XIII: Understand the interrupts on Arduino UNO
----------------------------------------------------------------
1. What is an interrupt in Arduino UNO?
a) A way of pausing the main program to handle an event
b) A way of resetting the board
c) A way of speeding up the program
d) A way of adding more memory to the board
Answer: a) A way of pausing the main program to handle an event
2. How many interrupt pins does the Arduino UNO have?
a) 1
b) 2
c) 3
d) 4
Answer: b) 2
3. What is the maximum number of interrupts that can be handled by the Arduino UNO?
a) 1
b) 2
c) 3
d) 4
Answer: b) 2
4. What are the two types of interrupts in Arduino UNO?
a) External and internal
b) High and low
c) Digital and analog
d) Interrupt 0 and interrupt 1
Answer: d) Interrupt 0 and interrupt 1
5. Which interrupt pin is associated with interrupt 0?
a) Pin 2
b) Pin 3
c) Pin 4
d) Pin 5
Answer: a) Pin 2
6. Which interrupt pin is associated with interrupt 1?
a) Pin 2
b) Pin 3
c) Pin 4
d) Pin 5
Answer: b) Pin 3
7. Which function is used to enable an interrupt in Arduino UNO?
a) enableInterrupt()
b) attachInterrupt()
c) activateInterrupt()
d) startInterrupt()
Answer: b) attachInterrupt()
8. Which function is used to disable an interrupt in Arduino UNO?
a) detachInterrupt()
b) removeInterrupt()
c) deactivateInterrupt()
d) stopInterrupt()
Answer: a) detachInterrupt()
9. Which type of interrupt occurs when a digital pin changes state?
a) External
b) Internal
c) Hardware
d) Software
Answer: a) External
10. Which type of interrupt occurs when a timer overflows?
a) External
b) Internal
c) Hardware
d) Software
Answer: c) Hardware
11. Which function is used to set up an interrupt for a digital pin?
a) attachInterrupt()
b) pinMode()
c) digitalWrite()
d) digitalRead()
Answer: a) attachInterrupt()
13. Which interrupt mode is triggered when a pin goes from HIGH to LOW?
a) LOW
b) CHANGE
c) FALLING
d) RISING
Answer: c) FALLING
14. Which interrupt mode is triggered when a pin goes from LOW to HIGH?
a) LOW
b) CHANGE
c) FALLING
d) RISING
Answer: d) RISING
15. Which interrupt mode is triggered when a pin changes state?
a) LOW
b) CHANGE
c) FALLING
d) RISING
Answer: b) CHANGE
16. Which function is used to specify the interrupt mode for a digital pin?
a) attachInterruptMode()
b) pinMode()
c) digitalRead()
d) Interrupt.setMode()
Answer: d) Interrupt.setMode()
17. Which function is used to read the value of a digital pin during an interrupt?
a) digitalRead()
b) analogRead()
c) pinMode()
d) digitalWrite()
Answer: a) digitalRead()
---
19. How many external interrupts does the Arduino UNO have?
a) 1
b) 2
c) 3
d) 4
Answer: b) 2
20. Which pins on the Arduino UNO can be used for external interrupts?
a) Analog pins A0-A5
b) Digital pins D0-D13
c) Digital pins D2 and D3
d) All of the above
Answer: c) Digital pins D2 and D3
21. Which interrupt mode is triggered when a low level is detected on the interrupt
pin?
a) LOW
b) CHANGE
c) RISING
d) FALLING
Answer: a) LOW
22. Which interrupt mode is triggered when the interrupt pin changes from low to
high or high to low?
a) LOW
b) CHANGE
c) RISING
d) FALLING
Answer: b) CHANGE
23. Which interrupt mode is triggered when the interrupt pin changes from low to
high?
a) LOW
b) CHANGE
c) RISING
d) FALLING
Answer: c) RISING
24. Which interrupt mode is triggered when the interrupt pin changes from high to
low?
a) LOW
b) CHANGE
c) RISING
d) FALLING
Answer: d) FALLING
24. What is the purpose of the attachInterrupt() function?
a) To enable interrupts on the Arduino UNO
b) To disable interrupts on the Arduino UNO
c) To specify the interrupt pin and mode
d) To reset the microcontroller
Answer: c) To specify the interrupt pin and mode
26. What is the purpose of the detachInterrupt() function?
a) To enable interrupts on the Arduino UNO
b) To disable interrupts on the Arduino UNO
c) To specify the interrupt pin and mode
d) To reset the microcontroller
Answer: b) To disable interrupts on the Arduino UNO
27. What is the ISR function?
a) The function that is called when an interrupt is triggered
b) The function that initializes the interrupt pins
c) The function that disables interrupts
d) The function that resets the microcontroller
Answer: a) The function that is called when an interrupt is triggered
28. What is the syntax for defining an ISR function in Arduino?
a) void ISR_function(){}
b) void ISR_function(void){}
c) void ISR_function(interrupt){}
d) void ISR_function(interrupt, mode){}
Answer: a) void ISR_function(){}
29. How long can an ISR function take to execute?
a) As long as necessary
b) Less than 1 millisecond
c) Less than 10 milliseconds
d) Less than 100 milliseconds
Answer: b) Less than 1 millisecond
30. What is the purpose of the noInterrupts() function?
a) To disable interrupts temporarily
b) To enable interrupts temporarily
c) To reset the microcontroller
d) To initialize the interrupt pins
Answer: a) To disable interrupts temporarily
31. What is the purpose of the interrupts() function?
a) To disable interrupts temporarily
b) To enable interrupts temporarily
c) To reset the microcontroller
d) To initialize the interrupt pins
Answer: b) To enable interrupts temporarily
---
32. Which pin of Arduino UNO is used for external interrupts?
a. Pin 2 and 3
b. Pin 5 and 6
c. Pin 9 and 10
d. Pin 13 and 14
Answer: a
33. How many external interrupts are available on Arduino UNO?
a. Two
b. Four
c. Six
d. Eight
Answer: a
34. What is the difference between external and internal interrupts?
a. External interrupts are triggered by external events, while internal interrupts
are triggered by software
b. Internal interrupts are triggered by external events, while external interrupts
are triggered by software
c. External interrupts are triggered by timers, while internal interrupts are
triggered by sensors
d. None of the above
Answer: a
35. What is the function used to enable interrupts in Arduino UNO?
a. attachInterrupt()
b. detachInterrupt()
c. enableInterrupt()
d. None of the above
Answer: a
36. What is the syntax of attachInterrupt() function?
a. attachInterrupt(pin, mode, ISR)
b. attachInterrupt(mode, pin, ISR)
c. attachInterrupt(ISR, mode, pin)
d. None of the above
Answer: a
37. What is the purpose of ISR in attachInterrupt() function?
a. It specifies the interrupt pin
b. It specifies the interrupt mode
c. It specifies the interrupt service routine
d. None of the above
Answer: c
38. What is the maximum frequency of external interrupts on Arduino UNO?
a. 1 kHz
b. 2 kHz
c. 4 kHz
d. 8 kHz
Answer: a
39. What is the function used to disable interrupts in Arduino UNO?
a. attachInterrupt()
b. detachInterrupt()
c. enableInterrupt()
d. None of the above
Answer: b
40. What is the syntax of detachInterrupt() function?
a. detachInterrupt(pin)
b. detachInterrupt(mode)
c. detachInterrupt(ISR)
d. None of the above
Answer: a
41. What is the purpose of detachInterrupt() function?
a. To disable external interrupts
b. To enable external interrupts
c. To change the interrupt pin
d. None of the above
Answer: a
42. What is the function used to change the interrupt mode in Arduino UNO?
a. changeInterruptMode()
b. setInterruptMode()
c. modifyInterrupt()
d. None of the above
Answer: b
43. What is the syntax of setInterruptMode() function?
a. setInterruptMode(pin, mode)
b. setInterruptMode(mode, pin)
c. setInterruptMode(ISR, mode)
d. None of the above
Answer: a
---
44. What is an interrupt?
a) A function that runs continuously
b) A function that runs only when called
c) A function that runs only when a specific event occurs
d) A function that runs when the program is terminated
Answer: c) A function that runs only when a specific event occurs
45. How many types of interrupts are there in Arduino UNO?
a) 2
b) 3
c) 4
d) 5
Answer: b) 3
46. Which interrupt is triggered when a digital pin changes state?
a) Timer interrupt
b) External interrupt
c) Pin change interrupt
d) None of the above
Answer: c) Pin change interrupt
47. What is the purpose of the External interrupt?
a) It is triggered by an external hardware signal
b) It is triggered by a timer
c) It is triggered by a pin change
d) It is triggered by a software interrupt
Answer: a) It is triggered by an external hardware signal
48. Which interrupt is used to measure time intervals?
a) Timer interrupt
b) External interrupt
c) Pin change interrupt
d) None of the above
Answer: a) Timer interrupt
49. How many timer interrupts does Arduino UNO have?
a) 1
b) 2
c) 3
d) 4
Answer: b) 2
50. Which timer interrupt is used for generating PWM signals?
a) Timer0
b) Timer1
c) Timer2
d) Timer3
Answer: a) Timer0
51. Which timer interrupt is used for counting external events?
a) Timer0
b) Timer1
c) Timer2
d) Timer3
Answer: b) Timer1
---
52. What is an interrupt in Arduino UNO?
a) A signal that stops the execution of the main code
b) A function that starts a new task
c) A loop that runs continuously
d) A variable that holds the state of the program
Answer: a) A signal that stops the execution of the main code
53. Which of the following is an external interrupt in Arduino UNO?
a) Timer interrupt
b) Analog-to-digital converter interrupt
c) External pin change interrupt
d) Software interrupt
Answer: c) External pin change interrupt
54. What is the maximum number of interrupts that can be handled by Arduino UNO?
a) 1
b) 2
c) 4
d) 6
Answer: d) 6
55. Which of the following pins can be used for external interrupts on Arduino UNO?
a) A0 to A5
b) D0 to D7
c) D2 and D3
d) D8 to D13
Answer: c) D2 and D3
56. Which of the following functions is used to enable an external interrupt in
Arduino UNO?
a) pinMode()
b) attachInterrupt()
c) digitalRead()
d) digitalWrite()
Answer: b) attachInterrupt()
57. Which of the following modes is used to trigger an interrupt on a falling edge?
a) LOW
b) CHANGE
c) RISING
d) FALLING
Answer: d) FALLING
58. Which of the following modes is used to trigger an interrupt on a rising edge?
a) LOW
b) CHANGE
c) RISING
d) FALLING
Answer: c) RISING
59. Which of the following modes is used to trigger an interrupt when a pin changes
state?
a) LOW
b) CHANGE
c) RISING
d) FALLING
Answer: b) CHANGE
--