«
»

1. What type of signal does the analogWrite() function output?
a) Pulse Width Modulated Signal
b) Pulse Code Modulated Signal
c) Pulse Amplitude Modulated Signal
d) Frequency Modulated Signal

Explanation: The Pulse Width Modulated Signal is the one which is transmitted by the analogWrite() function. This is done in an attempt to replicate the analog functionality to control certain sensors and actuators.

2. What is the resolution of analog readings on the Arduino Uno?
a) 5V/1023
b) 3.3V/1024
c) 5V/1024
d) 3.3V/100

Explanation: The Arduino converts all analog voltages (0V to 5V or 3.3V) taken as input into a range of 0 to 1023. This is done by mapping the voltage levels. On the Arduino Uno the maximum voltage level is 5V and the onboard ADC has a resolution of 10 bits which means it can divide the analog signal it receives into 210 levels.

3. Can the analogRead() function be used from any digital pin?
a) No, it cannot
b) Yes, it can, but only on certain Arduino Boards
c) Yes, it can
d) Yes, it can, but only through certain pins

Explanation: The pins in the Arduino Boards are all digital by default. The analog functionality is an addon to the board with the help of an ADC (Analog to Digital Convertor) Circuit which is only connected to a certain number of digital pins, so therefore not all pins can support analog communications.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

4. What is the output of the program if the input to pin1 is 3.3V on the Arduino Due?

1. `int pin1=A0;`
2. `void setup() {`
3. `    pinMode(pin1,INPUT);`
4. `    Serial.begin(9600);`
5. `}`
6. `void loop() {`
7. `    if(analogRead(pin1)==1023) {`
8. `        Serial.println(“Digital HIGH Detected!”);`
9. `    }`
10. `    else {`
11. `        Serial.println(“Digital LOW Detected!”);`
12. `    }`
13. `}`

a) Digital HIGH Detected!
b) Digital LOW Detected!
c) Runtime Error
d) Null

Explanation: The above code takes an input and then classifies the voltage level into two levels; 0 and 1023. This virtually forces the user to send a 3.3V signal to the Arduino Due to get a “Digital HIGH Detected!” Message and vice versa.

5. How many arguments does the analogRead() function have?
a) 1
b) 2
c) 3
d) 4

Explanation: The analogRead() function is used to take analog signal inputs to the Arduino. It requires 1 argument; the pin number which would indicate which pin is to be used for that particular operation. This will make the Arduino to start reading voltage fluctuations of the order of 0V to 5V or 3.3V for some Arduino Boards.

6. What is the purpose of the code given below?

1. `int pin1=A1;`
2. `void setup() {`
3. `    pinMode(pin1,INPUT);`
4. `    Serial.begin(9600);`
5. `}`
6. `void loop() {`
7. `    analogReadResolution(10);`
8. `    int a=analogRead(pin1);`
9. `    analogReadResolution(8);`
10. `    int b=analogRead(pin1);`
11. `    Serial.println(a);`
12. `    Serial.println(b);`
13. `}`

a) To demonstrate different resolution settings of the ADC
b) To demonstrate different resolution settings of the DAC
c) To convert a digital input to an analog signal

Explanation: The analogReadResolution() function changes the resolution of the ADC (Analog to Digital Convertor) present onboard the Arduino. This will change the value that is mapped to the same voltage level for different levels of resolution.

7. What is the use of the analogReference() function?
a) To change the digital signal reference value
b) To change the analog signal reference value
c) To print the analog signal reference voltage
d) To print the digital signal reference voltage

Explanation: The analogReference() function changes the value of the internal reference voltage for all analog calculations in the Arduino Board. For the function to work properly we need to supply the desired voltage level to the AREF pin on the Arduino Board physically before invoking the function. However, any voltage greater than 5V is not recommended since it can damage the board.

8. How many errors are present in the code given below if it is made to run on an Arduino Uno?

1. `void setup() {`
2. `    Serial.begin();`
3. `    analogReference(AR_DEFAULT);`
4. `}`
5. `void loop() {`
6. `    //Do nothing.`
7. `}`

a) 1
b) 2
c) 3
d) 4

Explanation: In the code above there are 2 errors in lines 2 and 3. The first one is that the Serial.begin() function is given no baud-rate as input. The second one is that the AR_DEFAULT argument only works for Arduino SAMD Boards like the Arduino Zero and not the Arduino AVR Based Boards like the Arduino Uno on which the above code is to be executed.

9. On which of the following Arduino Boards does the analogReadResolution() function not work?
a) Arduino Zero
b) Arduino MKR Vidor 4000
c) Arduino Due
d) Arduino Uno

Explanation: The analogReadResolution() function is used to change the resolution of the ADC for reading a particular voltage and mapping it to the number set. The resolution of the ADC is the number of levels up to which the ADC can quantize the analog Signal. The Arduino Uno is not capable of executing that command.

10. What happens to the output if the analogReadResolution() function is invoked with a resolution higher than the board’s ADC can physically handle?
a) The output is padded with zeros
b) The output is not obtained as an error is thrown during compile time
c) The output is not obtained as an error is thrown during run time
d) The output is padded with ones

Explanation: If the value passed as an argument to the analogReadResolution() function is higher than the physical capability of that particular board’s ADC, then the output is padded with zeros so as to enable other boards equipped with ADC’s having higher resolutions can process the data.

Sanfoundry Global Education & Learning Series – Arduino.

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