Bird
0
0

Given the code snippet below, what will be the priority of TaskA after vTaskPrioritySet() is called?

medium📝 Predict Output Q4 of 15
FreeRTOS - Task Priorities

Given the code snippet below, what will be the priority of TaskA after vTaskPrioritySet() is called?

TaskHandle_t TaskA;
vTaskPrioritySet(TaskA, 5);

Assume TaskA was created with priority 2.

A2
B0
C5
DUndefined behavior
Step-by-Step Solution
Solution:
  1. Step 1: Understand initial priority

    TaskA was created with priority 2 initially.
  2. Step 2: Effect of vTaskPrioritySet()

    Calling vTaskPrioritySet(TaskA, 5); changes TaskA's priority to 5 dynamically.
  3. Final Answer:

    5 -> Option C
  4. Quick Check:

    Priority after set = 5 [OK]
Quick Trick: vTaskPrioritySet updates priority immediately [OK]
Common Mistakes:
  • Assuming priority stays the same
  • Thinking priority resets to zero
  • Believing it causes undefined behavior

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes