MCQ Answer

<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.print("1+");<br>}<br>else{<br>Serial.print("clear+"); <br>delay(100);<br>}</pre>

Predict the output of the following code if the object is moving towards the sensor.

int op = 6;
int isBarrier = HIGH;
void setup() {
pinMode(op, INPUT);
Serial.begin(9600);
}
void loop(){
isBarrier = digitalRead(op);
if (isBarrier == LOW) {
Serial.print("1+");
}
else{
Serial.print("clear+"); 
delay(100);
}


यदि वस्तु सेंसर की ओर बढ़ रही है तो निम्नलिखित कोड के आउटपुट का आउटपुट बताये ?

int op = 6;
int isBarrier = HIGH;
void setup() {
pinMode(op, INPUT);
Serial.begin(9600);
}
void loop(){
isBarrier = digitalRead(op);
if (isBarrier == LOW) {
Serial.print("1+");
}
else{
Serial.print("clear+"); 
delay(100);
}
Topic : Building IoT Applications

A. clear+clear+1+1

B. 1+1+clear+1

C. 1+1+clear+clear

D. clear+clear+clear+clear




Correct Answer is :

D. clear+clear+clear+clear



Explanation
<p>when the object go away&nbsp;</p><p><span style="font-size: 14px;">clear+clear+clear+...</span></p><p><span style="font-size: 14px;">Then as the object is detected:</span></p><p><span style="font-size: 14px;">1+</span><span style="letter-spacing: 0.01rem;">1+</span><span style="letter-spacing: 0.01rem;">1+1</span></p>
Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad