Embedded C Language basics

Qus. 1 : Which command is used in Arduino to set 9th pin as output?

  1. int sensorPin=9
  2. int sensorValue=9
  3. pinMode(9, OUTPUT);
  4. digitalWrite(9, HIGH);
Qus. 2 : <p>What will be the output of the following code?</p><pre><span style="font-size: 14px;">void main()<br></span><span style="font-size: 14px;">{<br></span><span style="font-size: 14px;"><span style="white-space:pre"> </span>int x = 5*6/2 +8;<br></span><span style="font-size: 14px;"><span style="white-space:pre"> </span>printf("%d",x);<br></span><span style="font-size: 14px;"><span style="white-space:pre"> </span>return 0;<br></span><span style="font-size: 14px;">}</span></pre><p><br></p>

  1. 20
  2. 21
  3. 23
  4. 19
Qus. 3 : <p>What will be the output of the following code?</p><pre><span style="font-size: 14px;">int main()<br></span><span style="font-size: 14px;">{<br></span><span style="font-size: 14px;"><span style="white-space:pre"> </span>int a=5;<br></span><span style="font-size: 14px;"><span style="white-space:pre"> </span>while(a=123)<br></span><span style="font-size: 14px;"><span style="white-space:pre"> </span>{<br></span><span style="font-size: 14px;"><span style="white-space:pre"> </span>printf("RABBIT\n");<br></span><span style="font-size: 14px;"><span style="white-space:pre"> </span>}<br></span><span style="font-size: 14px;"><span style="white-space:pre"> </span>printf("GREEN");<br></span><span style="font-size: 14px;"><span style="white-space:pre"> </span>return 0;<br></span><span style="font-size: 14px;">}</span></pre>

  1. RABBIT is printed unlimited number of times
  2. RABBIT GREEN
  3. Compiler error
  4. GREEN
Qus. 4 : <p>What will be the output of the following piece of code?</p><pre><span style="font-size: 14px;">#include &lt;stdio.h&gt;<br></span><span style="font-size: 14px;">int main()&nbsp;<br></span><span style="font-size: 14px;">{<br></span><span style="font-size: 14px;"><span style="white-space:pre"> </span>int i;<br></span><span style="font-size: 14px;"><span style="white-space:pre"> </span>for(i=0;i&lt; 8; i++);<br></span><span style="font-size: 14px;"><span style="white-space:pre"> </span>printf("%d",i);<br></span><span style="font-size: 14px;"><span style="white-space:pre"> </span>return 0;<br></span><span style="font-size: 14px;">}</span></pre><div><br></div>

  1. 0
  2. 1234567
  3. 8
  4. Infinite loop
Qus. 5 : In C, how do you set up an array?

  1. int k={3,4}
  2. int k=new int[2]
  3. int k [2] = {3,4};
  4. int k(2)={3,4};
Qus. 6 : <p>What is the output of C program with functions?</p><pre>int main()&nbsp;<br>{<br>&nbsp; <span style="white-space:pre"> </span>int a = 0;<br>&nbsp; <span style="white-space:pre"> </span>printf("AJAY");<br><span style="white-space:pre"> </span>return 1;<br>&nbsp; &nbsp;<span style="white-space:pre"> </span>printf("VIJAY");<br>&nbsp; &nbsp;<span style="white-space:pre"> </span>return 1;<br>}</pre><div><br></div>

  1. AJAY VIJAY
  2. AJAY
  3. VIJAY
  4. Compiler Error
Qus. 7 : <p>What is the output of C Program?</p><pre>int main()<br>{<br><span style="white-space:pre"> </span>int k=10;<br><span style="white-space:pre"> </span>while(k &lt;= 12)<br><span style="white-space:pre"> </span>{<br><span style="white-space:pre"> </span>printf("%d", k);<br><span style="white-space:pre"> </span>k++;<br><span style="white-space:pre"> </span>}<br><span style="white-space:pre"> </span>return 0;<br>}</pre><p> </p>

  1. 10 10 10
  2. 12 12 12
  3. 10 11 12
  4. 12 11 10
Qus. 8 : What programming language is the Arduino IDE written in?

  1. Java
  2. C/C++
  3. Python
  4. Assembly
Qus. 9 : When a= 4, what is the value of b? in the given below statement b = (a > 6 ? 4 : 6);

  1. 0
  2. Error
  3. 4
  4. 6
Qus. 10 : Which compiler is used to translate C/C++ code into binary for AVR microcontrollers?

  1. G++
  2. AVR- GCC
  3. PYTHON
  4. Both A and B
Qus. 11 : What are the functions preprocessor directive in Embedded C programming?

  1. Tell compiler where to find symbols that are not present in program
  2. Give compiler instructions to compile the program
  3. Define variables
  4. Define functions
Qus. 12 : <p>What will be the output of the following code C?</p><pre><span style="font-size: 12.6px;">#include &lt;stdio.h&gt; void solve(){ char ch[5] = "abcde"; int ans=0; for(int i =0; i&lt; 5; i++) { ans += (ch[i] - 'a'); } printf("%d", ans); } int main(){ solve(); return 0; }</span><br></pre>

  1. 5
  2. 20
  3. 40
  4. 10
Qus. 13 : <p>What is the out come of the following Arduino code?</p><p style="letter-spacing: 0.14px;">void setup(){</p><p style="letter-spacing: 0.14px;">Serial.begin(9600);</p><p style="letter-spacing: 0.14px;">}</p><p style="letter-spacing: 0.14px;">void setup0{</p><p style="letter-spacing: 0.14px;">Serial.write(20);</p><p style="letter-spacing: 0.14px;">}</p>

  1. Send a signal to pin 20 on the Arduino board
  2. Send a octal number of 20 through the Serial pins
  3. Send a byte with value 20 through the Serial pins
  4. Send a hexadecimal number of 20 through the Serial pins
Qus. 14 : Which language is used to bult Arduino IDE ?

  1. Java
  2. HTML
  3. C/C++
  4. Python
Qus. 15 : How are multiline comments denoted in Embedded C?

  1. ##
  2. /**/
  3. %%
  4. //
Qus. 16 : How are comments denoted in Embedded C?

  1. #
  2. %
  3. ;
  4. //
Qus. 17 : <p>Predict the output of the following code if the object is moving away from the sensor</p><pre><span style="font-size: 12.6px;">int op = 7; int isBarrier = HIGH; void setup() { pinMode(op, INPUT); Serial.begin(9600); } void loop() { isBarrier = digitalRead(op); if (isBarrier == LOW) { Serial.println("1+"); } else { Serial.print("clear+"); } delay(100); }</span><br></pre>

  1. clear+clear+1+1
  2. 1+1+clear+clear
  3. clear+clear+clear+clear
  4. 1+1+clear+1
Qus. 18 : Embedded C is?

  1. A subset of traditional C
  2. An extension of traditional C
  3. A superset of traditional C
  4. Same as traditional C
Qus. 19 : A set of homogenous data stored in consecutive memory locations is called

  1. List
  2. Structure
  3. Array
  4. Union
Qus. 20 : <p>What will be the output of the following code</p><pre><span style="font-size: 12.6px;">#include &lt;stdio.h&gt; void solve(){ int b=4; int res = b++ + ++b + ++b; printf("%d", res); } int main(){ solve(); return 0; }</span><br></pre>

  1. 12
  2. 15
  3. 17
  4. 20
Qus. 21 : <p>What is the output of the following program?</p><p>for(;;)</p><p>{</p><p>Statements</p><p>}</p><div><br></div>

  1. Error
  2. Statements will run forever
  3. This an infinite loop
  4. Both (B) and (C)
Qus. 22 : <p>What is the objective of the code given below if it is executed on the Arduino Uno?</p><pre>#include&lt;EEPROM.h&gt;<br>int pin=13;<br>void setup() {<br>pinMode(pin,OUTPUT);<br>Serial.begin(9600);<br>{<br>void loop()<br>for(int i-0; i&lt;EEPROM.length(); it+) {<br>EEPROM.write(i, 1)<br>digitalWrite(pin,HIGH;<br>exit(0);<br>}</pre>

  1. Clear EEPROM
  2. Fill EEPROM with 1's
  3. Export EEPROM data
  4. Fill EEPROM with 0's
Qus. 23 : <p>What is the output of the following program?</p><pre>for(;;)&nbsp;<br>{<br>Statements<br>}</pre><p><br style="letter-spacing: 0.14px;"></p>

  1. Error
  2. Statemernts will run forever
  3. This an infinite loop
  4. Both (B) and (C)
Qus. 24 : <p>Predict the output of the following code if the object is moving towards the sensor.</p><pre>int op = 6;<br>int isBarrier = HIGH;<br>void setup() {<br>pinMode(op, INPUT)<br>Serial.begin(9600);<br>}<br>void loop(){<br>isBarrier = digitalRead(op);<br>if (isBarrier == LOW) {<br>Serial.println("1+");<br>}<br>else{<br>Serial.print("clear+");&nbsp;<br>delay(100);<br>}</pre>

  1. clear+clear+1+1
  2. 1+1+clear+1
  3. 1+1+clear+clear
  4. clear+clear+clear+clear
Qus. 25 : A single line comment begins with _____

  1. // (two adjacent slashes )
  2. /**/
  3. */ */
  4. None of the Above
Qus. 26 : Single line comment in C Language starts with

  1. #
  2. //
  3. !-
  4. /*
Qus. 27 : In C programming language, preprocessors are specified with _____________symbol

  1. #
  2. $
  3. ^
  4. %
Qus. 28 : Which of the following is not logical operator in C language?

  1. &&
  2. ||
  3. !
  4. |
Qus. 29 : In C language, the bitwise complement operator is

  1. !
  2. |
  3. ~
  4. &

Programs

Arduino Program to take input from serial and on the led based on input.

View Solution


Arduino program to fade the led bulb using for loop

View Solution


Arduino program to connect a led through push button

View Solution


Arduino program to change the blinking speed of led using the potentiometer

View Solution


Arduino program to print all integer number from 0 to 99 using for loop

View Solution


Arduino program to print odd numbers from 1 to 99

View Solution


Arduino program to print odd numbers from 99 to 1

View Solution


arduino program to interface buzzer with Arduino board to buzz on off with the delay of 1sec

View Solution


Arduino program to Blink a Light Emitting Diode LED

View Solution


Arduino program to print Hello word in LCD

View Solution


Arduino program to run a counter and display in LCD

View Solution


Arduino program to interface the sensor and led

View Solution


Arduino program to sound the buzzer on press on push button for 1 second

View Solution


Arduino program to interface buzzer with LDR and LED

View Solution


Arduino program to create automatic street light control by using LDR sensor

View Solution


Arduino program to read a integer number and print its table

View Solution


Arduino program to print the square root of a given number

View Solution


Design a night lamp using a LDR and a LED using Arduino Uno and find out the time delays associated in keeping ON the lamp

View Solution


Design a counter using an atmega microcontroller (like ATMEGA328P) using Arduino to display the number of entries per day in an office.

View Solution


Write a program to interface a temperature sensor (LM35) and water Nozzle with the Arduino.

View Solution


Arduino program to interface led buzzer with Arduino or raspberry pi and turn ON LED for 2 second after every 3 second

View Solution


Arduino program to connect RGB Led Bulb

View Solution


Arduino program to turns on LED when the button is pressed once and remains on until the button is pressed again to turn it off

View Solution


Arduino program to interface security password with Arduino board to show green light for correct password and red light for incorrect password.

View Solution


Arduino program to input any integer number and print its table

View Solution


Arduino program to connect with Servo Motor

View Solution


Arduino program to interface LCD with Arduino board and print some text

View Solution


Arduino application where pressing a button increases a counter value, which is then displayed on an LCD

View Solution


Arduino program to interface DHT 22 sensor and find the Humidity Temperature and Heat index

View Solution


Arduino program to interface soil moisture sensor

View Solution


Arduino program to interface a temperature monitoring system in a public environment which will display information

View Solution


Arduino program to interface a PIR (Passive Infrared) sensor

View Solution


Arduino program to interface gas sensor to detect the gas

View Solution


Arduino program to Design a night lamp using a photodiode and a LED and find out the time delay associated with turning the lamp on and off.

View Solution


Arduino program to implement Two way traffic signal system.

View Solution


Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad