MidSem Question Bank
Subject : Internet of Things & Embedded System
1. Which of the following is NOT a characteristic of IoT?
A) Interconnectivity
B) Heterogeneity
C) Real-time monitoring
D) Offline processing
2. Which IoT communication model involves a central broker?
A) Request-Response
B) Publisher-Subscriber
C) Push-Pull
D) Exclusive-Receive
3. REST API typically uses which protocol?
A) FTP
B) HTTP
C) SMTP
D) Telnet
4. Which of the following is a valid IoT communication model?
A) Binary-star
B) Request-Response
C) Push-mail
D) Peer-to-peer
5. Digital sensors communicate with micro-controllers using which type of signal?
A) Voltage levels
B) PWM signals only
C) Binary signals
D) Frequency-modulated signals
6. LM35 Sensor is used to detect the…….
A) Temperature B) Pressure of gas C) Humidity D) Volume
7. How many GPIO pins are generally available on NodeMCU ESP8266?
A) 8
B) 11
C) 16
D) 20
8. What is the function of the A0 pin on NodeMCU?
A) Digital output only
B) Serial transmission
C) Analog input
D) PWM output
3 Marks Questions
1. Explain WebSocket API.
WebSocket API is a communication protocol that allows real-time, two-way
communication between devices over the internet.
🔹 Why it's used in IoT:
IoT devices often need to send and receive data instantly, such as:
• A sensor sending temperature updates
• A user controlling a smart bulb from their phone
WebSocket helps in such cases by keeping the connection open, instead of repeatedly
opening and closing like HTTP.
🔑 Key Features of WebSocket API:
• Full-duplex communication: Data flows both ways at the same time (device ↔
server).
• Real-time updates: Instant data transfer with low delay.
• Less overhead: Uses a single connection, so it's faster and uses less power than
repeated HTTP requests.
📱 Example (conceptual):
Imagine a smart home app:
• You turn on a fan from your phone.
• The command goes to the fan immediately through WebSocket.
• The fan replies back with status (e.g., "Fan is ON").
This happens instantly, without reloading anything.
✅ In short:
WebSocket API allows continuous, fast, and two-way communication between IoT
devices and servers, making it ideal for real-time IoT applications.
2. Draw and explain Functional Block Diagram of IoT.
3. Write syntax of while and do while loop. Differentiate between them
1. while loop:
The while loop checks the condition first.
• If the condition is true, the loop runs.
• If the condition is false, the loop does not run at all.
while (condition) {
// code to execute
}
2. do while loop:
• The do while loop runs the code block first, then checks the condition.
• It always executes at least once, even if the condition is false.
do {
// code to execute
} while (condition);
Difference between while and do while loop:
Point while loop do while loop
Condition checking Before loop body After loop body
Execution if condition false May not execute even once Executes at least once
Syntax ends with Just a closing brace } Semicolon ; after condition
4. Write short note on SPI Pins, I2C pins and UART Pins.
SPI Pins (Serial Peripheral Interface)
SPI is a synchronous serial communication protocol used for short-distance
communication. It typically requires four main pins:
1. MOSI (Master Out Slave In): Transmits data from the master device to the slave.
2. MISO (Master In Slave Out): Transmits data from the slave device to the master.
3. SCLK (Serial Clock): Provides the clock signal generated by the master to
synchronize data transmission.
4. SS (Slave Select): Used by the master to select the specific slave device to
communicate with.
Some implementations might include additional pins like CS (Chip Select) for multi-slave
systems.
I2C Pins (Inter-Integrated Circuit)
I2C is a two-wire serial communication protocol used for connecting low-speed devices. It
uses the following two pins:
1. SCL (Serial Clock): Carries the clock signal generated by the master.
2. SDA (Serial Data): Carries the data for both transmission and reception between
the master and slave.
I2C uses a master-slave configuration, and devices are addressed by a unique address.
UART Pins (Universal Asynchronous Receiver/Transmitter)
UART is a protocol for asynchronous serial communication between two devices. It
typically requires two main pins:
1. TX (Transmit): Transmits data from the UART transmitter to the receiver.
2. RX (Receive): Receives data from the UART transmitter to the receiver.
Some systems might include RTS (Request to Send) and CTS (Clear to Send) for
hardware flow control.
Each of these protocols is commonly used in embedded systems, with SPI and I2C being
used for connecting multiple devices, and UART often being used for simple point-to-
point communication.
8 Marks Questions
1. Write short note on following communication models.
1. Request-Response Model
The Request-Response communication model is a basic interaction pattern, where a client
sends a request to a server, and the server responds with the requested data or action. This
is typically used in web services (HTTP requests) and client-server architecture.
• Example: A user visiting a webpage sends an HTTP request to a web server, which
processes the request and sends an HTTP response containing the requested data
(such as HTML content).
• Characteristics:
• Synchronous: The client waits for the server's response before continuing.
• Stateless: Each request is independent; no information is retained between
requests (unless session management is used).
2. Publish-Subscriber Model
In the Publish-Subscriber model, also known as Pub-Sub, there are two main
participants:
• Publisher: Sends messages to a topic or channel.
• Subscriber: Listens to a specific topic/channel and receives the messages published
to it.
This model decouples the sender (publisher) from the receivers (subscribers), meaning that
publishers do not need to know who is receiving the messages. It is widely used in event-
driven systems and messaging frameworks like MQTT or RabbitMQ.
• Example: A weather station (publisher) sends updates on temperature data to a
channel, and various devices (subscribers) such as weather apps receive this data.
• Characteristics:
• Asynchronous: The publisher sends messages without waiting for a
response.
• Scalable: Multiple subscribers can receive the same messages.
• Loose coupling: Publishers and subscribers do not know about each other.
3. Push-Pull Model
The Push-Pull model is often used in data distribution systems. It involves two main
entities:
• Push: The sender actively pushes data to the receiver.
• Pull: The receiver requests or pulls data from the sender.
The combination of both "push" and "pull" mechanisms allows for efficient and flexible
communication, depending on whether the sender is pushing data proactively or the
receiver is pulling data as needed.
• Example: A server sends real-time updates to a client (push), and the client can
also request additional information if needed (pull).
• Characteristics:
• Hybrid approach: Incorporates both proactive and reactive
communication.
• Used in streaming services, where data is pushed continuously, but users
can also pull more data (e.g., media files or messages).
4. Exclusive Pair Communication
Exclusive Pair Communication involves a direct communication link between two
entities where both are exclusively involved in the interaction. This model is typically
symmetric, meaning that each participant can send and receive messages, and the
communication is private between these two entities.
• Detailed Explanation: This model ensures that the communication channel is
exclusively dedicated to the pair of entities, and no other external entities can
access or interfere with this communication. Exclusive pair communication is often
used in applications where secure, direct, and reliable communication is needed
between two systems.
• Example: In a Peer-to-Peer (P2P) network, two devices can establish an exclusive
connection for transferring files, messages, or data.
• Characteristics:
• Private: The communication channel is restricted to the two entities
involved.
• Synchronous or Asynchronous: Communication can happen in real-time
or as per the requirements.
• Reliability: Direct interaction between the two entities often means
communication is more stable and less prone to interference.
In systems like chat applications or dedicated network services, exclusive pair
communication is essential to prevent unauthorized access and ensure high-level security
during the exchange.
2. Explain Interfacing of Anaolg sensor in details with Program
The process mentioned on the page involves using Arduino to read analog sensor input.
Here's a simplified explanation:
1. Connect an analog sensor (e.g., a potentiometer or temperature sensor) to an
analog input pin (A0).
2. Initialize the input pin in the Arduino code using analogRead().
3. Convert the sensor’s output to a readable value (range: 0-1023).
4. Optionally, use the Serial Monitor to display the sensor’s data.
5. Map the values to a desired range if needed (e.g., 0-255 for LED brightness).
int pot = A0; // Potentiometer is connected to the Analog pin A0
int potvalue; // a variable that stores the Pot value.
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); // This enables the serial port, 9600 is the Baud Rate.
pinMode(pot,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
potvalue=analogRead(pot); // we use analogRead function for reading analog sensors
Serial.println(potvalue); // This instruction sends the Potentiometer value to the Serial
Monitor
}
3. Explain Different pins of NodeMCU 8266..