Bird
0
0

What is wrong with this FreeRTOS task creation code snippet?

medium📝 Debug Q14 of 15
FreeRTOS - Task Creation and Management

What is wrong with this FreeRTOS task creation code snippet?

void vTask(void *pvParameters) { /* code */ }

xTaskCreate(vTask, "Task", 1000, NULL, 5, NULL);
xTaskCreate(vTask, "Task", 1000, NULL, -1, NULL);
APriority cannot be negative
BTask name must be unique
CStack size must be zero
DTask function must return int
Step-by-Step Solution
Solution:
  1. Step 1: Check priority values

    FreeRTOS priorities must be zero or positive integers; negative values are invalid.
  2. Step 2: Validate other parameters

    Task name can be reused, stack size 1000 is valid, and task function returns void as required.
  3. Final Answer:

    Priority cannot be negative -> Option A
  4. Quick Check:

    Priority >= 0 required [OK]
Quick Trick: Priority must be zero or positive [OK]
Common Mistakes:
  • Using negative priority values
  • Thinking task names must be unique
  • Expecting task function to return int

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes