Internet of Things and its Applications

Building IoT Applications

  1. Which of the following operators have the highest precedence ?
    1. == and! =
    2. Logical
    3. Relational
    4. Arithmetic
    Answer : D
    Explain : Arithmetic operator have the highest precedence in operators.
  2. Which of the following operators isn't a bitwise operator ?
    1. ~
    2. &&
    3. |
    4. <<
    Answer : B
    Explain : && - is a logical operator
  3. How to terminate an infinite loop in embedded C ?
    1. End
    2. Exit
    3. Break
    4. Abort
    Answer : C
    Explain : In order to come out of the infinite loop, we can use the break statement.
  4. The format specifier for printf () and wprintf () of long integer in C is denoted as:
    1. % ld
    2. % d
    3. % di
    4. % f
    Answer : A
    Explain : %ld is used for Long Integer Format Specifier.
  5. How to run two variables x and y in for loop simultaneously ?
    1. for (x = 0; x<m, x++), for (y = 0; y<m, y+=3) { }
    2. for (x = 0, y = 0; x<m, y<m; x++, y+=3)
    3. Both (A) and (B)
    4. for (x = 0; x<m, x++) { }, for (y = 0; y<m, y+=3) { }
    Answer : B
    Explain : B Statement is correct.
  6. The output of given C code is:
     #include 
     int main () 
     { 
     	int x=1, y = 1, z; 
    	z= x++ + y; 
    	printf (“%d, %d”, x, y);
     }
    
    1. x=1, y=1
    2. x=2, y=1
    3. x=1, y=2
    4. x=1, y=2
    Answer : B
    Explain : We declare three integer variables: x, y, and z, and initialize x and y with the value 1. In the next line, you have the expression z = x++ + y;. Now,
    x++ is a post-increment operation, which means that x is incremented after its current value is used. So, in this line, x is used in the addition operation with y first (1 + 1), and then it is incremented by 1.
    The result of the expression is 2 (1 + 1), and this result is assigned to z. So, z is now equal to 2.
    Finally, you print the values of x and y using printf. At this point, x has been incremented due to the post-increment operation in the previous line, so it's now equal to 2, and y remains 1.
  7. In the given C code, for loop executes for:
     #include 
     void main () 
     { 
     int x=10; 
    for ( ; ; ) { printf(“%d\n”,x):}
     }
    
    1. 10 times
    2. 9 times
    3. infinite
    4. Zero
    Answer : C
    Explain : The for(;;) statement in C and many other programming languages represents an infinite loop. It's a loop with no specified condition to exit, so it will continue running indefinitely until interrupted or until there's an explicit exit statement within the loop.
  8. How can we initialize the array?
    1. Initializing
    2. Assigning array
    3. Factoring and array
    4. Populating an array
    Answer : A
    Explain : We must need to first -Initialize an array using an Initializer List.
  9. The function pgm_read_word ((&(var_data[x][y]))) reads ______ from flash memory:
    1. Address
    2. Integers
    3. Strings
    4. Data files
    Answer : B
    Explain : The function pgm_read_word is typically used in the context of programming for microcontrollers and embedded systems, especially when dealing with AVR-based systems and the Arduino platform. It is used to read a 16-bit (2-byte) value from the program memory (flash memory) of the microcontroller.
  10. What is the bootloader in the Arduino IDE ?
    1. a piece of code
    2. initiates the sketch
    3. stored in the memory space
    4. All of these
    Answer : D
  11. Arduino is a ______.
    1. Open-source Text editor
    2. Open-source electronics platform
    3. Web programming language
    4. None of these
    Answer : B
    Explain : Arduino is an open-source electronics platform that includes hardware and software. It's designed to make electronics more accessible to artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.
  12. A LED interfacing with Arduino as shown implies:
    digitalWrite (led_pin, LOW);
    digitalWrite (led_pin, HIGH);
    1. LED off and on
    2. LED off and on by varying VCC
    3. Can introduce delay for better o/p
    4. All of these
    Answer : A
    Explain : digitalWrite (led_pin, LOW);- means led off and digitalWrite (led_pin, HIGH);-means led on.
  13. In embedded C, Literals means:
    1. a word
    2. a letter
    3. a digit
    4. a string constant
    Answer : D
    Explain : Literals are the Constant values that are assigned to the constant variables. Literals represent fixed values that cannot be modified.
  14. What is true about Arduino Codes?
    1. Setup () is a startup function
    2. Loop() is executed repeatedly
    3. Also known as sketches
    4. All of these
    Answer : D
    Explain : The setup() function is called when a sketch starts. Use it to initialize variables, pin modes, start using libraries, etc.
  15. The statements that are TRUE about „Arduino.h‟ header file are:
    1. Avrdude software uploads the hex file
    2. Gives access to all of Arduino‟s core functionality
    3. #include <Arduino.h>
    4. All of these
    Answer : D
    Explain : Arduino.h is a header file that contains the supporting information the rest of the "main" needs to function. A header file has definitions for the library, while the source file has the actual code.

Next Set

2 3