Bird
0
0

Find the problem in this FreeRTOS task function:

medium📝 Debug Q7 of 15
FreeRTOS - Task Creation and Management
Find the problem in this FreeRTOS task function:
void TaskC(void *pvParameters) {
  while(1) {
    // Do work
  }
  vTaskDelete(NULL);
}
ATask function should return int
BvTaskDelete is unreachable because of infinite loop
CMissing delay causes CPU hogging
DpvParameters should not be void pointer
Step-by-Step Solution
Solution:
  1. Step 1: Analyze control flow in task function

    The infinite while loop prevents reaching vTaskDelete(NULL), making it unreachable.
  2. Step 2: Check other options

    Task functions return void, delay is recommended but not an error, and pvParameters must be void*.
  3. Final Answer:

    vTaskDelete is unreachable because of infinite loop -> Option B
  4. Quick Check:

    Infinite loop blocks code after it [OK]
Quick Trick: Code after infinite loop is never executed [OK]
Common Mistakes:
  • Expecting task function to return int
  • Ignoring need for delays to yield CPU
  • Misunderstanding parameter types

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes