Quiz Space

January 2025 term · Embedded C Programming · CS2101

Embedded C Programming Quiz 2: 16 March 2025 (January 2025 term)

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.

Questions
17
Marks
50
Duration
120 min
MSQ
1
MCQ
16

Updated

Official paper: IIT M ES FOUNDATION AN EXAM QEF2 16 Mar 2025 · No negative marking.

Question 1

+3 marksOne or more correct options

Which of the following is/are not valid IPv4 addresses?

Select all that apply.

  1. A

    300.25.50.100

  2. B

    172.16.254.1

  3. C

    10.0.300.5

  4. D

    192.168.0.256

  5. E

    203.120.45.60

Show answer

Correct answers

  • A

    300.25.50.100

  • C

    10.0.300.5

  • D

    192.168.0.256

Question 2

+3 marksOne correct option

Which of the following is NOT a characteristic of SPI communication?

  1. A

    Full-duplex data transmission

  2. B

    Requires a clock signal (SCK)

  3. C

    Uses start and stop bits for framing

  4. D

    Supports multiple slave devices

Show answer

Correct answer

  • C

    Uses start and stop bits for framing

Question 3

+3 marksOne correct option

Which of the following is an example of a connection-oriented communication protocol?

  1. A

    UDP

  2. B

    TCP

  3. C

    ICMP

  4. D

    DHCP

Show answer

Correct answer

  • B

    TCP

Question 4

+3 marksOne correct option

Which of the following is a key advantage of using serial communication over parallel communication in embedded systems?

  1. A

    It eliminates the need for data synchronization

  2. B

    It allows for simultaneous data transfer across multiple lines

  3. C

    It reduces the number of required I/O pins

  4. D

    It always provides higher data transfer rates

Show answer

Correct answer

  • C

    It reduces the number of required I/O pins

Question 5

+3 marksOne correct option

What are the final values of AX and BX registers after executing the following assembly code snippet?

asm
MOV AX, 25
MOV BX, 15
SUB AX, BX
MOV CX, 8
ADD BX, CX
  1. A

    AX = 10, BX = 23

  2. B

    AX = 10, BX = 8

  3. C

    AX = 40, BX = 23

  4. D

    AX = 40, BX = 8

Show answer

Correct answer

  • A

    AX = 10, BX = 23

Question 6

+3 marksOne correct option

What happens when a microcontroller receives an interrupt request?

  1. A

    The CPU immediately executes the main program loop.

  2. B

    The interrupt vector table is checked to find the appropriate ISR.

  3. C

    The microcontroller resets and restarts execution.

  4. D

    The interrupt request is ignored until the program finishes execution.

Show answer

Correct answer

  • B

    The interrupt vector table is checked to find the appropriate ISR.

Question 7

+3 marksOne correct option

What is the primary role of a linker in an embedded system?

  1. A

    It converts source code into machine code.

  2. B

    It loads the executable code into memory for execution.

  3. C

    It resolves symbol references and combines object files into a single executable.

  4. D

    It manages memory allocation during program execution.

Show answer

Correct answer

  • C

    It resolves symbol references and combines object files into a single executable.

Question 8

+3 marksOne correct option

Which of the following design patterns is most suitable for decoupling a system's components and promoting communication through event-based mechanisms?

  1. A

    Observer Pattern

  2. B

    Singleton Pattern

  3. C

    Factory Pattern

  4. D

    Command Pattern

Show answer

Correct answer

  • A

    Observer Pattern

Question 9

+3 marksOne correct option

Which of the following is the most effective method to manage power consumption in an embedded system during periods of inactivity?

  1. A

    Keep the system running at full speed

  2. B

    Use low-power sleep modes

  3. C

    Turn off the system entirely

  4. D

    Increase the processor clock frequency

Show answer

Correct answer

  • B

    Use low-power sleep modes

Question 10

+3 marksOne correct option

What is the result of the expression 0xA5 & 0x3F?

  1. A

    0x15

  2. B

    0x25

  3. C

    0x35

  4. D

    0x5A

Show answer

Correct answer

  • B

    0x25

Question 11

+3 marksOne correct option

What is the primary role of a makefile in a software project?

  1. A

    To provide code templates

  2. B

    To manage code versioning

  3. C

    To help compile and link code

  4. D

    To improve runtime performance

Show answer

Correct answer

  • C

    To help compile and link code

Question 12

+3 marksOne correct option

What is the role of an Event Handler in an event-driven architecture?

  1. A

    To process user inputs from keyboards

  2. B

    To manage power states of the system

  3. C

    To define actions in response to specific events

  4. D

    To synchronize tasks in a multi-threaded environment

Show answer

Correct answer

  • C

    To define actions in response to specific events

Question 13

+2 marksOne correct option

Which wireless communication protocol is best suited for short-range, low-power applications such as smart home automation and sensor networks?

  1. A

    LoRa

  2. B

    WiFi

  3. C

    LTE

  4. D

    Zigbee

Show answer

Correct answer

  • D

    Zigbee

Question 14

+2 marksOne correct option

Which communication protocol is widely used in both automotive and industrial applications due to its robustness, real-time capabilities, and fault tolerance?

  1. A

    CAN

  2. B

    Profibus

  3. C

    ModBus

  4. D

    Ethernet/IP

Show answer

Correct answer

  • A

    CAN

Question 15

+2 marksOne correct option

What is the primary advantage of using interrupt-driven programming in embedded systems?

  1. A

    It reduces power consumption by allowing the CPU to sleep until needed.

  2. B

    It eliminates the need for a microcontroller in the system.

  3. C

    It ensures that all tasks run at a fixed time interval.

  4. D

    It increases CPU usage by continuously polling for event

Show answer

Correct answer

  • A

    It reduces power consumption by allowing the CPU to sleep until needed.

Question 16

+4 marksOne correct option

Consider the following FSM controls a motor with four states:

States:

  1. STATE_STOPPED – The motor is stopped.
  2. STATE_RUNNING_LOW – The motor is running at low speed.
  3. STATE_RUNNING_HIGH – The motor is running at high speed.
  4. STATE_OVERSPEED – The motor has exceeded the safe speed limit.

Events:

  1. EVENT_BUTTON_PRESS – The button is pressed.
  2. EVENT_SPEED_THRESHOLD – The speed crosses a predefined threshold.
  3. EVENT_OVERSPEED_ALARM – The motor exceeds the safe speed limit.
  4. EVENT_RESET – A reset signal is received.

Consider the following codes

c
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:

  1. EVENT_SPEED_THRESHOLD
  2. EVENT_BUTTON_PRESS

What will be the final state after processing both events?

  1. A

    STATE_STOPPED

  2. B

    STATE_RUNNING_LOW

  3. C

    STATE_RUNNING_HIGH

  4. D

    STATE_OVERSPEED

Show answer

Correct answer

  • A

    STATE_STOPPED

Question 17

+4 marksOne correct option

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?

  1. A

    34.72 milliseconds

  2. B

    43.40 milliseconds

  3. C

    52.08 milliseconds

  4. D

    67.50 milliseconds

Show answer

Correct answer

  • B

    43.40 milliseconds