Quiz Space

May 2024 term · Embedded C Programming · CS2101

Embedded C Programming End Term: 1 September 2024, Set QEF1 (May 2024 term)

The IIT Madras BS Embedded C Programming (Embedded C Programming) End Term paper sat on 1 Sept 2024, in the May 2024 term, set QEF1: 23 questions for 50 marks in 180 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
23
Marks
50
Duration
180 min
MCQ
22
Numerical
1

Updated

Official paper: IIT M ES FOUNDATION AN EXAM QEF3 01 Sep 2024 · No negative marking.

Question 1

+1 markOne correct option

In which of the following scenarios would you typically choose a microcontroller (MCU) over a microprocessor (MPU)?

  1. A

    Building a high-performance gaming computer.

  2. B

    Developing a specialized device for monitoring temperature and humidity.

  3. C

    Designing a server for hosting multiple websites.

  4. D

    Creating a software application for financial modeling.

Show answer

Correct answer

  • B

    Developing a specialized device for monitoring temperature and humidity.

Question 2

+2 marksOne correct option

Which programming language is an object-oriented extension of C and is often used in embedded systems for its enhanced features and modularity?

  1. A

    C++

  2. B

    Rust

  3. C

    Assembly language

  4. D

    Fortran

Show answer

Correct answer

  • A

    C++

Question 3

+2 marksOne correct option

Which of the following data types would be most memory-efficient for storing the small integer number in an array, given that the maximum value of numbers can be 100?

  1. A

    int

  2. B

    unsigned int

  3. C

    uint8_t

  4. D

    uint16_t

Show answer

Correct answer

  • C

    uint8_t

Question 4

+2 marksOne correct option

You are using a 10-bit ADC to digitize a signal in the range of 0 to 3.3V. What is the minimum difference (approx) between two voltages that you can measure?

  1. A

    1 mV

  2. B

    2.22 mV

  3. C

    3.22 mV

  4. D

    4.56 mV

Show answer

Correct answer

  • C

    3.22 mV

Question 5

+2 marksOne correct option

Which wireless communication protocol is designed for low-power, short-range communication and is commonly used for home automation and sensor networks?

  1. A

    WiFi

  2. B

    Zigbee

  3. C

    LTE

  4. D

    LoRa

Show answer

Correct answer

  • B

    Zigbee

Question 6

+2 marksOne correct option

What does the scalability of a communication protocol in embedded systems refer to?

  1. A

    The protocol’s ability to function in real-time

  2. B

    The protocol’s ability to handle an increasing number of devices efficiently

  3. C

    The protocol’s speed of data transmission

  4. D

    The protocol’s resistance to electromagnetic interference

Show answer

Correct answer

  • B

    The protocol’s ability to handle an increasing number of devices efficiently

Question 7

+2 marksOne correct option

How does loop unrolling optimize code execution in embedded systems?

  1. A

    By increasing the number of iterations.

  2. B

    By reducing the number of iterations and the overhead of loop control.

  3. C

    By combining multiple loops into one.

  4. D

    By eliminating the loop entirely.

Show answer

Correct answer

  • B

    By reducing the number of iterations and the overhead of loop control.

Question 8

+2 marksOne correct option

What is the primary factor that determines the power consumption in an electronic system when the voltage is constant?

  1. A

    The number of logic gates

  2. B

    The type of microcontroller

  3. C

    The duration of operation

  4. D

    The current drawn

Show answer

Correct answer

  • D

    The current drawn

Question 9

+2 marksOne correct option

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

asm
MOV AX, 15
MOV DX, 25
ADD AX, DX
MOV BX, 10
SUB DX, BX
  1. A

    AX = 40, DX = 15

  2. B

    AX = 40, DX = 20

  3. C

    AX = 25, DX = 15

  4. D

    AX = 40, DX = 10

Show answer

Correct answer

  • A

    AX = 40, DX = 15

Question 10

+2 marksOne correct option

What is the primary purpose of a driver in the context of embedded systems?

  1. A

    To create high-level application software

  2. B

    To provide an abstraction layer over hardware components

  3. C

    To design user interfaces

  4. D

    To manage network communications

Show answer

Correct answer

  • B

    To provide an abstraction layer over hardware components

Question 11

+2 marksOne correct option

What is the role of assertions in error handling?

  1. A

    To catch unexpected conditions during development

  2. B

    To handle hardware failures

  3. C

    To manage memory overflows

  4. D

    To simulate system-level behavior

Show answer

Correct answer

  • A

    To catch unexpected conditions during development

Question 12

+2 marksOne correct option

What action is performed when a task is deleted?

  1. A

    Allocating memory for the task stack

  2. B

    Initializing task context

  3. C

    Releasing allocated memory

  4. D

    Adding the task to the scheduler's ready list

Show answer

Correct answer

  • C

    Releasing allocated memory

Question 13

+2 marksOne correct option

You are designing an embedded system for a real-time audio processing application. The system needs to handle audio data sampled at 48 kHz. The CPU must perform complex signal processing algorithms on the audio data without interruption. How would you use Direct Memory Access (DMA) to optimize the system's performance?

  1. A

    Configure the CPU to handle all audio data transfers to ensure real-time processing.

  2. B

    Use DMA to transfer audio data from the ADC (Analog-to-Digital Converter) to a memory buffer and generate an interrupt when the buffer is full, allowing the CPU to process the data while DMA continues to handle new data transfers.

  3. C

    Disable DMA and increase the CPU clock speed to handle data transfers and processing simultaneously.

  4. D

    Use the CPU to transfer audio data from the ADC to memory and DMA to transfer data from memory to the DAC (Digital-to-Analog Converter).

Show answer

Correct answer

  • B

    Use DMA to transfer audio data from the ADC (Analog-to-Digital Converter) to a memory buffer and generate an interrupt when the buffer is full, allowing the CPU to process the data while DMA continues to handle new data transfers.

Question 14

+2 marksOne correct option

Which strategy is most effective for reducing leakage currents in an embedded system?

  1. A

    Using a lower clock frequency

  2. B

    Reducing the operating voltage

  3. C

    Implementing sleep modes for unused components

  4. D

    Increasing the transistor size

Show answer

Correct answer

  • C

    Implementing sleep modes for unused components

Question 15

+2 marksOne correct option

While developing an embedded system for an automotive application, you need to ensure that the system responds to sensor inputs within a strict time frame. What is the most effective way to debug and ensure your system meets these real-time requirements?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

Question 16

+2 marksOne correct option

Which of the following strategies would be the most effective for using static analysis to enhance the safety and reliability of the drone's RTOS, and why?

  1. A

    Use static analysis to generate test cases automatically and execute them during runtime to identify bugs under real-world conditions.

  2. B

    Employ static analysis early in the development cycle to detect and correct memory management issues, such as buffer overflows and memory leaks, before the code is compiled.

  3. C

    Apply static analysis after deployment to monitor the drone's performance in real-time and make adjustments as needed.

  4. D

    Rely solely on static analysis to ensure code reliability, skipping dynamic testing altogether.

Show answer

Correct answer

  • B

    Employ static analysis early in the development cycle to detect and correct memory management issues, such as buffer overflows and memory leaks, before the code is compiled.

Question 17

+2 marksOne correct option

What is the key aspect of the "ethics of care" framework?

  1. A

    Maximizing overall happiness

  2. B

    Following strict rules and regulations

  3. C

    Understanding and responding to the needs of others

  4. D

    Prioritizing personal virtues

Show answer

Correct answer

  • C

    Understanding and responding to the needs of others

Question 18

+3 marksOne correct option
  1. A

    0x08

  2. B

    0x10

  3. C

    0x20

  4. D

    0x40

Show answer

Correct answer

  • C

    0x20

Question 19

+3 marksOne correct option

A CPU has 512KB of SRAM connected to it starting at address 0x00200000. What is the address of the last byte in the SRAM?

  1. A

    0x0027FFFF

  2. B

    0x00280000

  3. C

    0x002FFFFF

  4. D

    0x00260000

Show answer

Correct answer

  • A

    0x0027FFFF

Question 20

+3 marksOne correct option

A memory-mapped peripheral has a register set starting at address 0xABCDEF00. Each register is 32 bits wide. If there are 10 registers in the set, what is the address of the 6th register?

  1. A

    0xABCDEF14

  2. B

    0xABCDEF18

  3. C

    0xABCDEF0C

  4. D

    0xABCDEFEE

Show answer

Correct answer

  • A

    0xABCDEF14

Question 21

+3 marksOne correct option

Let's use the example of a finite state machine (FSM) for controlling an LED with a single button. The states and events will be defined as follows:

  • States:
    1. STATE_OFF - LED is off.
    2. STATE_ON - LED is on.
    3. STATE_BLINKING - LED is blinking.
  • Events:
    1. EVENT_BUTTON_PRESS - Button is pressed.
    2. EVENT_BLINK_DONE - Blinking sequence is completed (5 blinks).

Consider the following code.

c
void handleEvent(Event_t event) {
switch (currentState) {
case STATE_OFF:
if (event == EVENT_BUTTON_PRESS) {
currentState = STATE_ON;
}
break;
case STATE_ON:
if (event == EVENT_BUTTON_PRESS) {
currentState = STATE_BLINKING;
}
break;
case STATE_BLINKING:
if (event == EVENT_BUTTON_PRESS || event == EVENT_BLINK_DONE) {
currentState = STATE_OFF;
}
break;
default:
currentState = STATE_OFF;
break;
}
}

In the given FSM code snippet, what will be the next state if the initial state is STATE_ON and the EVENT_BUTTON_PRESS event occurs twice?

  1. A

    STATE_OFF

  2. B

    STATE_ON

  3. C

    STATE_BLINKING

  4. D

    STATE_ERROR

Show answer

Correct answer

  • A

    STATE_OFF

Question 22

+3 marksOne correct option

Given the following FreeRTOS code for an Arduino project:

c
#include <Arduino_FreeRTOS.h>
void Task1(void *pvParameters) {
for (;;) {
Serial.println("Task 1");
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
void Task2(void *pvParameters) {
for (;;) {
Serial.println("Task 2");
vTaskDelay(500 / portTICK_PERIOD_MS);
}
}
void setup() {
Serial.begin(9600);
xTaskCreate(Task1, "Task 1", 128, NULL, 1, NULL);
xTaskCreate(Task2, "Task 2", 128, NULL, 1, NULL);
vTaskStartScheduler();
}
void loop() {}

What would be the consequence of omitting vTaskStartScheduler() in the setup() function?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 23

+2 marksNumerical answer

A 12-bit ADC can digitize an analog value into ___ distinct levels.

Show answer

Correct answer: 4096