Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

151.

What is the use of the MSBFIRST argument in the shiftIn() function?(a) To denote the least significant bit(b) To denote the maximum number of Bits(c) To denote the most significant bit(d) To denote the minimum number of bitsI got this question in an internship interview.Question is taken from Advanced Input Output topic in chapter Arduino Programming of Arduino

Answer»

Correct ANSWER is (c) To denote the most significant bit

To explain I WOULD say: The shiftIn() function shifts in one byte of a binary number bit by bit starting from either the most significant bit or the least significant bit. Now after each bit is pulled, the CLOCK pin is turned to HIGH until the next one at which point the clock pin is turned down to LOW again. Now the MSBFIRST argument denotes that the byte of data be read from left to right.

152.

How many voltage levels are present when a pin uses digitalWrite()?(a) 1(b) 2(c) 3(d) 4I had been asked this question during a job interview.Query is from Digital Input Output topic in division Arduino Programming of Arduino

Answer»

Correct choice is (b) 2

To explain I would SAY: 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.

153.

What is the name for the library to manipulate data in and out of the EEPROM of the Arduino Board?(a) EEPROM.h(b) eeprom.h(c) Eeprom.h(d) eepROM.hI have been asked this question during an interview.Enquiry is from Standard Libraries topic in chapter Arduino Programming of Arduino

Answer»

The correct OPTION is (a) EEPROM.h

Best explanation: The EEPROM is a type of memory in microcontrollers that is ABLE to retain the data that was FED to it even after the power supply is CUT off from the chip.The EEPROM.h library allows us to perform read, WRITE, clear, updating, etc. operations on the EEPROM of our Arduino Board. This is a standard library that can be used for all Arduino Boards.

154.

How many times does the loop() function run on every startup of the Arduino System?(a) 1(b) Depends upon the setup() function(c) Infinitely till the power is supplied to the Arduino(d) 3This question was posed to me in an interview for job.My question comes from The loop() Function in portion Arduino Programming of Arduino

Answer»

Right answer is (c) INFINITELY till the POWER is supplied to the Arduino

Easy EXPLANATION: The loop() function is generally used to carry out most of the calculations that are required to sustain the working of the Arduino project. It is preprogrammed to run CONTINUOUSLY once the Arduino is successfully BOOTED and the setup() function has been executed once.

155.

Can the PROGMEM Utility work on non-static variables?(a) Yes(b) NoI had been asked this question by my school teacher while I was bunking the class.My enquiry is from PROGMEM Utility in section Arduino Programming of Arduino

Answer»

The CORRECT choice is (a) Yes

To explain: The PROGMEM Utility can be USED with non-static variables provided they are defined outside any function, i.e. they are defined GLOBALLY. Conversely if one needs to WORK on a variable that is not defined globally then they would NEED to convert that variable into a static variable in order to use the PROGMEM Utility.

156.

What is Type Casting?(a) Converting a file from one type to another(b) Creating new arrays(c) Deleting the variable from memory(d) Converting a variable from one type to anotherThe question was posed to me in homework.This question is from Type Conversions topic in chapter Arduino Programming of Arduino

Answer»

The correct option is (d) Converting a VARIABLE from ONE type to another

Explanation: Casting is the PROCESS of forcefully converting a variable from one data type to another. There are 4 types of casting; static CAST, dynamic cast, const cast, reinterpret cast.

157.

What is the minimum number of arguments that the strcpy() function accept?(a) 4(b) 3(c) 2(d) 1The question was posed to me in an interview for job.This interesting question is from String Manipulation in chapter Arduino Programming of Arduino

Answer»

The correct answer is (c) 2

To explain: The strcpy() function is used to COPY the contents from one String variable to another. Hence it requires a minimum of TWO arguments that INCLUDE the source variable (The variable from WHOSE contents NEED to be copied from) and the destination variable (The variable to which the contents are to be copied to).

158.

What is the use of the cos() function?(a) To find the cosine of a number(b) To find the sine of a number(c) To find the tan of a number(d) To find the inverse cosine of a numberI got this question in an internship interview.My question is based upon Mathematical Functions in chapter Arduino Programming of Arduino

Answer»

Correct answer is (a) To find the cosine of a number

The explanation is: The COS() function is used to find the cosine of a number. It takes one argument; the number whose cosine is to be found out. This number is to be ENTERED in the radian format and not the degree format. This function can accept any number-based datatypes and GIVES the output in the DOUBLE DATATYPE.

159.

What is the math function to find out the maximum of 2 numbers?(a) The maximumOf() function(b) The maximum_number() function(c) The max() function(d) The m() functionThe question was asked during a job interview.Asked question is from Mathematical Functions topic in section Arduino Programming of Arduino

Answer»

Right answer is (C) The max() FUNCTION

To explain: The max() function takes in 2 arguments and outputs only 1 NUMBER. This function finds out the MAXIMUM of the 2 numbers that are ENTERED as arguments to the function. This function is essential in sorting techniques.

160.

What is the maximum number of arguments that the pulseIn() function accepts?(a) 1(b) 2(c) 3(d) 4The question was asked in examination.My doubt is from Advanced Input Output topic in portion Arduino Programming of Arduino

Answer»

The correct option is (c) 3

For EXPLANATION: The pulseIn() FUNCTION is used to determine the length of a pulse supplied to a digital pin. It generally accepts two arguments; the pin NUMBER, and the state, i.e. HIGH or LOW. If the state is given as HIGH, then it will wait for the pin to go HIGH and then start counting the time TILL the pin returns back to LOW. Here the length of the pulse is given by the function in microseconds.

161.

What is the resolution of analog readings on the Arduino Uno?(a) 5V/1023(b) 3.3V/1024(c) 5V/1024(d) 3.3V/100The question was posed to me in semester exam.The question is from Analog Input Output topic in chapter Arduino Programming of Arduino

Answer»

Correct choice is (C) 5V/1024

The best 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.

162.

In which versions of the Arduino IDE can the PROGMEM Utility be used without declaration in the Arduino code?(a) Any Arduino IDE version above 2.0(b) Any Arduino IDE version above 1.0(c) Any Arduino IDE version below 1.0(d) Any Arduino IDE version above 3.1I had been asked this question in homework.I would like to ask this question from PROGMEM Utility topic in portion Arduino Programming of Arduino

Answer» RIGHT choice is (b) Any Arduino IDE VERSION above 1.0

The explanation is: PROGMEM is PART of the avr/pgmspace.h library. It is imported automatically in the more recent versions of the Arduino IDE. However, if one is using an IDE version below 1.0, then the header must be included first at the top of the code.
163.

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 SignalThis question was posed to me in homework.My question comes from Analog Input Output topic in chapter Arduino Programming of Arduino

Answer» CORRECT answer is (a) Pulse Width 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.
164.

Who carries out implicit type casting?(a) The programmer(b) The assembler(c) The compiler(d) The microcontrollerThis question was addressed to me during an online exam.This interesting question is from Type Conversions topic in portion Arduino Programming of Arduino

Answer»

The correct choice is (c) The compiler

For explanation: This is also CALLED type promotion and is carried out AUTOMATICALLY by the compiler wherein it automatically converts a variable from one DATA type to another data type which is HIGHER than that. Usually this is done to avoid any loss of data during calculations of floating type NUMBERS.

165.

What is the maximum number of arguments for the map() function?(a) 1(b) 3(c) 5(d) 7The question was asked in a job interview.This is a very interesting question from Mathematical Functions topic in division Arduino Programming of Arduino

Answer»

Correct OPTION is (c) 5

Easiest explanation: The map() function is used to map a NUMBER from one number set to another number set. It takes THREE arguments; the number to be mapped, the LOWEST number of the source number set, the highest number of the source number set, the lowest number of the destination number set, the highest number of the destination number set.

166.

Can the loop() function be called recursively?(a) Yes, it can be called recursively(b) No, it cannot be called recursively(c) Yes, it can be called recursively but only by the setup() function(d) Yes, it can be called recursively but only twiceThe question was posed to me by my school teacher while I was bunking the class.My doubt stems from The loop() Function in division Arduino Programming of Arduino

Answer»

The CORRECT choice is (a) Yes, it can be called recursively

To explain: The ARDUINO Programming Language is a working SUBSYSTEM of the C++ Programming Language. This allows for any function to be called recursively at any point in the program. Since the LOOP() function is a custom predefined function in the Arduino Ecosystem, it too has to follow that rule.

167.

What character does the preprocessor look out for whilst searching for commands in the code?(a) x(b) @(c) #(d) !I have been asked this question in an online interview.My question is taken from Preprocessing in chapter Arduino Programming of Arduino

Answer»

The CORRECT answer is (c) #

Easy EXPLANATION: Any special commands that need to be executed by the preprocessor is always initialized with the help of the ‘#’ symbol. This helps in ENHANCING the clarity of the code that the programmer WRITES and also makes it easier for the preprocessor to complete it’s job faster SINCE it does not have to process each and every token throughout the program to simply find out what are the preprocessor commands that have been used.

168.

Can the break statement be used to abort a program?(a) Yes(b) Yes, but only if it is used within the global scope(c) No(d) Yes, but only for some Arduino BoardsI got this question in a national level competition.My enquiry is from Control Structures in division Arduino Programming of Arduino

Answer»

The correct OPTION is (c) No

To explain I would SAY: The break statement is almost never used for aborting the execution of a program. It was designed for EXITING looping structures and shifting the CONTROL to the next scope available. The control statement that helps with that is the exit function.

169.

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 pinsI had been asked this question during an internship interview.Origin of the question is Digital Input Output in section Arduino Programming of Arduino

Answer»

The CORRECT choice is (c) Yes, it can be used

Easy explanation: The digitalRead() FUNCTION basically READS voltage differences of 0V and 5V which correspond to 0 and 1023, in the ArduinoEcosystem. 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.

170.

What is the use of the dmesg command?(a) Sending messages to the device connected(b) Reading messages generated from avrdude(c) Receiving messages from the gcc compiler(d) Receiving messages from the particular deviceThe question was asked during an online exam.I want to ask this question from Uploading topic in portion Arduino Programming of Arduino

Answer»

Right choice is (d) RECEIVING MESSAGES from the particular device

To elaborate: The dmesg command is used for displaying any messages like errors or warnings that a device might have issued to the system. It can give US 3 THINGS; the time, i.e. the time after startup when the message was generated, the device name, and the message text or message content.

171.

What is the way of throwing an error using preprocessing directives to the Arduino Compiler and forcing it to stop compilation?(a) #stop(b) #cut(c) #error(d) #warningI had been asked this question at a job interview.This interesting question is from Preprocessing topic in portion Arduino Programming of Arduino

Answer»

The correct ANSWER is (c) #error

For EXPLANATION I would say: The #error directive first THROWS an error to the ARDUINO IDE which is then DISPLAYED and then the compilation process is stopped prematurely. This is used to enable the user to stop the compilation process programmatically if some criteria or condition is not met before he or she can allow the program to start running.

172.

Does the Arduino code get processed by an interpreter or a compiler?(a) The Arduino code is processed by an interpreter(b) The Arduino code is first compiled to C++ and then processed using an interpreter(c) The Arduino code is processed by a compiler(d) The Arduino code is directly executed by the processorThe question was asked in homework.The doubt is from Programming in portion Arduino Programming of Arduino

Answer»

Correct OPTION is (c) The Arduino code is processed by a compiler

The best I can explain: The Arduino code is a working subset of the C++ programming language. The C++ programming language is a COMPILED one, not an interpreted language. The main difference between an interpreter and a compiler is the way that each one of them handles the debugging and execution of the code. A compiler first checks if the code has any SYNTAX errors or not and then PROCEEDS to converting or more appropriately translating the written code into assembly, while the interpreter executes the code LINE by line irrespective of whether there is any syntax error in the code or not.