Arduino Questions and Answers – Compilation

This set of Arduino Multiple Choice Questions & Answers (MCQs) focuses on “Compilation”.

1. What compiler toolchain is used to compile the Arduino Sketches?
a) AVR-G++/GCC
b) Python
c) PowerShell
d) Perl
View Answer

Answer: a
Explanation: The AVR-GCC/G++ software is a compiler which can take C/C++ code as input and translate or compile it into Binary Code that follows the instruction set for the AVR Microcontrollers. They’re used in the Arduino software since most Arduino Boards use the AVR Microcontroller family.

2. Where does the Arduino IDE search if it needs to find out the Name of a type of Arduino Board?
a) build.txt
b) boards.txt
c) build.core
d) Arduino.h
View Answer

Answer: b
Explanation: The different types of Arduino Boards which are also commonly referred to as “Variants” are present in the boards.txt file. This is a particularly important file because it contains the different configuration information for different Arduino Boards like which compiler toolchain to execute on a particular variant.

3. What is the use of the Arduino.h header file?
a) It gives root access to the microcontroller’s file system
b) It enables the programmer to access all of Arduino’s core functionality
c) It allows other people to create libraries for the Arduino code
d) It doesn’t have any use and can be omitted at any point of time in the code
View Answer

Answer: b
Explanation: The Arduino.h file is not something that we encounter during the process of writing the code for the Arduino board because the preprocessor takes care of it before compilation. However, it is a very important file without which we cannot access the Arduino’s features like GPIO IO, Analog IO, etc.
advertisement
advertisement

4. How many architectures does the Arduino subfolder in the Hardware section contain?
a) 2
b) 3
c) 4
d) 9
View Answer

Answer: a
Explanation: The Arduino subfolder of the Hardware section contains support for 2 architectures; AVR and SAM. The AVR Microcontrollers are included in the most common Arduino Boards like the Uno, Nano, Mega, etc. However, some Arduino Boards like the Arduino Due don’t use AVR but use the SAM 32-bit ARM processors.

5. How many configuration files are there which allows us to customize the architecture in an Arduino in order to add support for custom boards?
a) 1
b) 2
c) 3
d) 4
View Answer

Answer: c
Explanation: There are 3 configuration files which allow a person to tweak the configurations. These include the following files; platform.txt, boards.txt, and programmers.txt. These files are all really important in defining the architecture for different processors.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. After the compilation process, the file containing the assembly instructions for the microcontroller is stored in a file. What is the file type?
a) .o
b) .hex
c) .cpp
d) .hpp
View Answer

Answer: b
Explanation: The assembly instructions for the microcontroller is stored in a hex file. This file contains the assembly instructions in hex format for the microcontroller to understand and execute. It is the binary executable file that allows us to execute the high-level C code on any microcontroller.

7. Which of the following file format is generated once the C code is compiled?
a) .c
b) .h
c) .ino
d) .o
View Answer

Answer: d
Explanation: All C code is compiled to a .o file. This file format is called the Object File Format. The compiler creates these object files during compilation, for each source code and then links each of these together for making the executable file for that language.
advertisement

8. What is the .d file format’s use in C?
a) For managing dependencies
b) For the D programming language
c) For storing the variables and memory locations
d) For creating new errors in dependencies
View Answer

Answer: a
Explanation: The “.d” file format is used for managing and generating the dependency list for a program. A dependency is a supporting program that has the functionality that is required for the smooth and in times, the very execution of another program.

9. Why does every compilation of a source code in Arduino check for previous compilations?
a) To delete the previously generated “.o” files
b) To use the previously generated “.o” files
c) To relocate the previously generated “.o” files
d) To copy the previously generated “.o” files
View Answer

Answer: b
Explanation: During the compilation process, the Arduino compiler before compilation searches for previously generated “.o” files in the directory, to make the compilation process faster in some cases. This reduces the redundancy of compiling the same parts of the code repeatedly.
advertisement

10. How to view each command that gets executed during the compilation process?
a) Enable Verbose Output
b) Disable Verbose Output
c) Show Sketch Folder
d) Open Serial Plotter
View Answer

Answer: a
Explanation: A verbose is a feature that reports all information in a process, function or code. The Arduino Verbose Output helps in displaying the output for each execution step in the Arduino Compilation Process.

Sanfoundry Global Education & Learning Series – Arduino.

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

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.