Quiz Space

Embedded C Programming End Term: 13 April 2025, Set QEF3 (January 2025 term)

Question 1

+4 marksOne correct option

Consider the following FreeRTOS code snippet:

c
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
QueueHandle_t xQueue;
void SenderTask(void *pvParameters) {
int data = 100;
while (1) {
if (xQueueSend(xQueue, &data, pdMS_TO_TICKS(1000)) == pdPASS) {
printf("Data sent: %d\n", data);
}
vTaskDelay(pdMS_TO_TICKS(500));
}
}
void ReceiverTask(void *pvParameters) {
int receivedData;
while (1) {
if (xQueueReceive(xQueue, &receivedData, pdMS_TO_TICKS(2000)) == pdTRUE) {
printf("Data received: %d\n", receivedData);
}
}
}
int main() {
xQueue = xQueueCreate(5, sizeof(int));
xTaskCreate(SenderTask, "Sender", 1000, NULL, 1, NULL);
xTaskCreate(ReceiverTask, "Receiver", 1000, NULL, 1, NULL);
vTaskStartScheduler();
while (1);
}

What will happen if the receiver task is delayed for more than 3 seconds?

  1. A

    The sender task will be blocked permanently

  2. B

    The queue will eventually be full, and the sender task will be blocked until space is available

  3. C

    The queue will clear automatically, allowing the sender to continue

  4. D

    The system will crash due to queue overflow

Question 2

+4 marksOne correct option

Consider a finite state machine (FSM) controlling a motor speed system with a single button. The states and events are defined as follows:

States:

  1. STATE_STOPPED – Motor is off.
  2. STATE_SLOW – Motor runs at slow speed.
  3. STATE_FAST – Motor runs at fast speed.
  4. STATE_OVERSPEED – Motor runs at an unsafe speed.

Events:

  1. EVENT_BUTTON_PRESS – Button is pressed.
  2. EVENT_SENSOR_ALERT – A sensor detects overspeed.

Consider the following code.

c
void handleEvent(Event_t event) {
switch (currentState) {
case STATE_STOPPED:
if (event == EVENT_BUTTON_PRESS) {
currentState = STATE_SLOW;
}
break;
case STATE_SLOW:
if (event == EVENT_BUTTON_PRESS) {
currentState = STATE_FAST;
}
break;
case STATE_FAST:
if (event == EVENT_BUTTON_PRESS) {
currentState = STATE_STOPPED;
} else if (event == EVENT_SENSOR_ALERT) {
currentState = STATE_OVERSPEED;
}
break;
case STATE_OVERSPEED:
if (event == EVENT_BUTTON_PRESS) {
currentState = STATE_STOPPED;
}
break;
default:
currentState = STATE_STOPPED;
break;
}
}

If the initial state is STATE_SLOW, what will be the next state after one EVENT_BUTTON_PRESS and one EVENT_SENSOR_ALERT event?

  1. A

    STATE_STOPPED

  2. B

    STATE_FAST

  3. C

    STATE_OVERSPEED

  4. D

    STATE_SLOW

Also asked in End Term 13 Apr 2025

Question 3

+2 marksOne correct option

What is the main issue caused by priority inversion in an RTOS?

  1. A

    High-priority tasks being blocked by low-priority tasks holding a shared resource

  2. B

    Low-priority tasks consuming all CPU time

  3. C

    Tasks executing in an unpredictable order

  4. D

    RTOS scheduler failing to schedule tasks correctly

Also asked in End Term 13 Apr 2025

18 more questions in this paper

Sign in with Google — it is free — to see every question with its answer and explanation, practise it in learning mode, or take it as a timed mock test.

More on the Embedded C Programming End Term 13 Apr 2025 Set QEF3 paper

The IIT Madras BS Embedded C Programming (Embedded C Programming) End Term paper sat on 13 Apr 2025, in the January 2025 term, set QEF3: 21 questions for 52 marks in 180 minutes. The first 3 questions are below. Sign in with Google — it is free — to see the whole paper with its answers and explanations, in learning mode or as a timed mock test.

FeatureEmbedded C Programming End Term 13 Apr 2025 Set QEF3 at a glance
TermJanuary 2025 term
SubjectEmbedded C Programming
Course codeCS2101
Questions21
Marks52
Duration180 min
MCQ20
Numerical1
Official paperIIT M ES FOUNDATION AN EXAM QEF3 13 Apr 2025
Negative markingNo negative marking.
Updated

Other sets that day

Same End Term, other subjects

More Embedded C Programming