This set of Arduino Multiple Choice Questions & Answers (MCQs) focuses on “Digital Input Output”.
1. How many voltage levels are present when a pin uses digitalWrite()?
a) 1
b) 2
c) 3
d) 4
View Answer
Explanation: The digitalWrite() function can be used to send out two voltage levels; 0V and 5V which correspond to the digital LOW signal and the digital HIGH signal respectively. These voltage levels can however vary from board to board. For example, in some Arduino Boards the digital HIGH signal corresponds to 3.3V instead of 5V. Hence even if the voltage levels are different here, the meaning of the signal remains the same.
2. Can the digitalRead() function identify analog voltages?
a) Yes, it can
b) No, it cannot
c) Yes, it can but only 2
d) Yes, it can but only 4
View Answer
Explanation: The digitalRead() function is used to receive digital signals as input through the port and then process the data further. However, it can only distinguish between 5V (3.3V for some Arduino Boards) and 0V which correspond to the digital HIGH and the digital LOW signals respectively.
3. Can the digitalWrite() function be used from any analog 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
View Answer
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, or a DAC (Digital to Analog Convertor) Circuit. Thus, all analog pins support digital IO but not all digital pins support analog IO. However, this is an exception in the Arduino Nano, Mini and Pro Mini.
4. How many errors are present in the code given below?
int i=10;
void setup() {
pinMode(i,OUTPUT);
digitalwrite(HIGH);
}
void loop() {
//Do Nothing.
}
a) 1
b) 2
c) 3
d) 4
View Answer
Explanation: The above code is wrong in two places, in line 4. Here the name of the digitalWrite() function should be spelled with a capital ‘W’, and the function takes two arguments, not one. They are pin number and state. In the code above, only the state is mentioned with no mention of the pin number.
5. How many arguments does the digitalRead() function have?
a) 1
b) 2
c) 3
d) 4
View Answer
Explanation: The digitalRead() function is used to take digital 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 and 5V.
6. Can the analogRead() function be used as a replacement for the digitalRead() function?
a) No, it cannot be used
b) Yes, it can be used but only on certain Arduino Boards
c) Yes, it can be used
d) Yes, it can be used but only for certain pins
View Answer
Explanation: The digitalRead() function basically reads voltage differences of 0V and 5V which correspond to 0 and 1023, in the Arduino Ecosystem. This can be recreated using the analogRead() function to check whether there is a voltage across the pin that corresponds to 0 and 1023 on the Arduino.
7. What is the need for a quantizer in Digital Communications?
a) Break up a sampled signal to a finite dataset
b) Sample a pure analog signal
c) Sample a digital signal
d) Encode an analog signal
View Answer
Explanation: The ADC (Analog to Digital Convertor) Circuit converts the pure analog signal to a digitized signal with discrete voltage points. However, in order to be able to perform further complicated computations on the data, we need to convert the discrete signal into a set of finite data points. This is done by mapping the values to a set of positive real integers.
8. Which of the following is not a Digital Encoding Technique?
a) NRZ (Non-Return to Zero)
b) Amplitude Modulation
c) Manchester
d) RZ (Return to Zero)
View Answer
Explanation: Any digital signal can be defined as a series of 1’s and 0’s. These series may or may not be in a predefined pattern. This can make it very difficult for the receiver to be able to decipher the signal. Thus, the digital coding techniques involve mostly converting a random pattern of 1’s and 0’s into a predefined pattern of a signal which the receiver can decipher easily. Here Amplitude Modulation Technique is an analog modulation technique.
9. Which of the following is not a method to convert analog signals to digital signals?
a) Pulse Code Modulation
b) Pulse Amplitude Modulation
c) Pulse Width Modulation
d) Frequency Modulation
View Answer
Explanation: Any Modulation Technique that converts an analog signal to a digital signal is of immense importance in pure digital circuits like the Arduino. These help the Arduino’s circuit to receive raw unmodulated signals from the outside and process them in a digital environment. Here frequency modulation is the only modulation technique that only works with analog-to-analog signal modulation.
10. What is the numeric base of the math operations performed in binary?
a) 1
b) 2
c) 3
d) 4
View Answer
Explanation: All binary numbers have a base of 2. This means that this number system has only 2 digits which are 0 and 1. The base of a number system is the number of unique characters or digits that are used for representing numbers.0
Sanfoundry Global Education & Learning Series – Arduino.
To practice all areas of Arduino, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Practice Electrical & Electronics Engineering MCQs
- Check Electrical & Electronics Engineering Books
- Practice Electrical Engineering MCQs
- Check Arduino Books
- Check Electrical Engineering Books