Question 1
Which of the following is/are not valid IPv4 addresses?
300.25.50.100
172.16.254.1
10.0.300.5
192.168.0.256
203.120.45.60
The IIT Madras BS Embedded C Programming (Embedded C Programming) Quiz 2 paper sat on 16 Mar 2025, in the January 2025 term: 17 questions for 50 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.
Which of the following is/are not valid IPv4 addresses?
300.25.50.100
172.16.254.1
10.0.300.5
192.168.0.256
203.120.45.60
Correct answers
300.25.50.100
10.0.300.5
192.168.0.256
Which of the following is NOT a characteristic of SPI communication?
Full-duplex data transmission
Requires a clock signal (SCK)
Uses start and stop bits for framing
Supports multiple slave devices
Correct answer
Uses start and stop bits for framing
Which of the following is an example of a connection-oriented communication protocol?
UDP
TCP
ICMP
DHCP
Correct answer
TCP
Which of the following is a key advantage of using serial communication over parallel communication in embedded systems?
It eliminates the need for data synchronization
It allows for simultaneous data transfer across multiple lines
It reduces the number of required I/O pins
It always provides higher data transfer rates
Correct answer
It reduces the number of required I/O pins
What are the final values of AX and BX registers after executing the following assembly code snippet?
MOV AX, 25MOV BX, 15SUB AX, BXMOV CX, 8ADD BX, CXAX = 10, BX = 23
AX = 10, BX = 8
AX = 40, BX = 23
AX = 40, BX = 8
Correct answer
AX = 10, BX = 23
What happens when a microcontroller receives an interrupt request?
The CPU immediately executes the main program loop.
The interrupt vector table is checked to find the appropriate ISR.
The microcontroller resets and restarts execution.
The interrupt request is ignored until the program finishes execution.
Correct answer
The interrupt vector table is checked to find the appropriate ISR.
What is the primary role of a linker in an embedded system?
It converts source code into machine code.
It loads the executable code into memory for execution.
It resolves symbol references and combines object files into a single executable.
It manages memory allocation during program execution.
Correct answer
It resolves symbol references and combines object files into a single executable.
Which of the following design patterns is most suitable for decoupling a system's components and promoting communication through event-based mechanisms?
Observer Pattern
Singleton Pattern
Factory Pattern
Command Pattern
Correct answer
Observer Pattern
Which of the following is the most effective method to manage power consumption in an embedded system during periods of inactivity?
Keep the system running at full speed
Use low-power sleep modes
Turn off the system entirely
Increase the processor clock frequency
Correct answer
Use low-power sleep modes
What is the result of the expression 0xA5 & 0x3F?
0x15
0x25
0x35
0x5A
Correct answer
0x25
What is the primary role of a makefile in a software project?
To provide code templates
To manage code versioning
To help compile and link code
To improve runtime performance
Correct answer
To help compile and link code
What is the role of an Event Handler in an event-driven architecture?
To process user inputs from keyboards
To manage power states of the system
To define actions in response to specific events
To synchronize tasks in a multi-threaded environment
Correct answer
To define actions in response to specific events
Which wireless communication protocol is best suited for short-range, low-power applications such as smart home automation and sensor networks?
LoRa
WiFi
LTE
Zigbee
Correct answer
Zigbee
Which communication protocol is widely used in both automotive and industrial applications due to its robustness, real-time capabilities, and fault tolerance?
CAN
Profibus
ModBus
Ethernet/IP
Correct answer
CAN
What is the primary advantage of using interrupt-driven programming in embedded systems?
It reduces power consumption by allowing the CPU to sleep until needed.
It eliminates the need for a microcontroller in the system.
It ensures that all tasks run at a fixed time interval.
It increases CPU usage by continuously polling for event
Correct answer
It reduces power consumption by allowing the CPU to sleep until needed.
Consider the following FSM controls a motor with four states:
States:
STATE_STOPPED – The motor is stopped.STATE_RUNNING_LOW – The motor is running at low speed.STATE_RUNNING_HIGH – The motor is running at high speed.STATE_OVERSPEED – The motor has exceeded the safe speed limit.Events:
EVENT_BUTTON_PRESS – The button is pressed.EVENT_SPEED_THRESHOLD – The speed crosses a predefined threshold.EVENT_OVERSPEED_ALARM – The motor exceeds the safe speed limit.EVENT_RESET – A reset signal is received.Consider the following codes
void handleEvent(Event_t event) { switch (currentState) { case STATE_STOPPED: if (event == EVENT_BUTTON_PRESS) { currentState = STATE_RUNNING_LOW; } break; case STATE_RUNNING_LOW: if (event == EVENT_BUTTON_PRESS) { currentState = STATE_RUNNING_HIGH;
} break; case STATE_RUNNING_HIGH: if (event == EVENT_SPEED_THRESHOLD) { currentState = STATE_OVERSPEED; } else if (event == EVENT_BUTTON_PRESS) { currentState = STATE_STOPPED; } break; case STATE_OVERSPEED: if (event == EVENT_RESET) { currentState = STATE_RUNNING_LOW; } else if (event == EVENT_BUTTON_PRESS) { currentState = STATE_STOPPED; } break; default: currentState = STATE_STOPPED; break; }}If the current state is STATE_RUNNING_HIGH, and two events occur in sequence:
What will be the final state after processing both events?
STATE_STOPPED
STATE_RUNNING_LOW
STATE_RUNNING_HIGH
STATE_OVERSPEED
Correct answer
STATE_STOPPED
A system transmits 500 bytes of data using the 8N1 protocol at a baud rate of 115200 bps. What is the minimum time required to complete the transmission?
34.72 milliseconds
43.40 milliseconds
52.08 milliseconds
67.50 milliseconds
Correct answer
43.40 milliseconds