Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Programming 1 Assistive Questions

1. What is a variable in Arduino, declare at least 3 variables of different data types? 

__________________________________________________________________________________

__________________________________________________________________________________

2. Explain the difference between global and local variables in Arduino. 

__________________________________________________________________________________

__________________________________________________________________________________

3. How do you assign a value to a variable in Arduino? Give 3 examples using 3 data types. 

__________________________________________________________________________________

__________________________________________________________________________________

4. What is the maximum value an int, float and byte variables can hold in Arduino?   

__________________________________________________________________________________

__________________________________________________________________________________

5. Define and explain the purpose of the `const` keyword when declaring variables give an example
by declaring 2 constant variables. 

__________________________________________________________________________________

__________________________________________________________________________________

6. How do you convert a `float` variable to an `int` variable in Arduino? What would be the result of
converting 4.633 to an integer.

__________________________________________________________________________________

__________________________________________________________________________________

7. What is the scope of a variable declared within a function in Arduino? 

__________________________________________________________________________________

__________________________________________________________________________________

8. How do you write an `if` statement in Arduino? Provide an example by checking if the
temperature is above 25 

__________________________________________________________________________________

__________________________________________________________________________________

9. Explain the use of the `else` statement in conjunction with an `if` statement. 

__________________________________________________________________________________
__________________________________________________________________________________

10. What is the purpose of the `switch` statement in Arduino, and how is it used? 

__________________________________________________________________________________

__________________________________________________________________________________

11. How do you compare two variables in an Arduino `if` statement using logical operators give 2
examples?

__________________________________________________________________________________

__________________________________________________________________________________

12. What is boolean operator, and how is it used in Arduino? 

__________________________________________________________________________________

__________________________________________________________________________________

13. Describe the difference between a `for` loop and a `while` loop in Arduino. 

__________________________________________________________________________________

__________________________________________________________________________________

14. Write a `for` loop that counts from 1 to 10 and prints each number after 1 second to the Serial
Monitor. 

__________________________________________________________________________________

__________________________________________________________________________________

15. How do you use the `break` statement within a loop in Arduino, and why might you use it? 

__________________________________________________________________________________

__________________________________________________________________________________

16. Explain the purpose of the `continue` statement in an Arduino loop e.g. in a for loop write an
example code. 

__________________________________________________________________________________

__________________________________________________________________________________

17. What is an infinite loop, and why is it important to avoid them in Arduino programming? 

__________________________________________________________________________________

__________________________________________________________________________________

18. What is an array in Arduino, and how do you declare one? 

__________________________________________________________________________________
__________________________________________________________________________________

19. Write code to initialize an integer array with values 5, 10, 15, 20, 25. 

__________________________________________________________________________________

__________________________________________________________________________________

20. How do you access and modify elements of an array in Arduino use the previous array change
the values to 3,6,9,12,50. 

__________________________________________________________________________________

__________________________________________________________________________________

For assistance use

https://www.arduino.cc/reference/en/

https://chat.openai.com

https://www.google.com/

https://www.w3schools.com/c/index.php

You might also like