Bird
0
0

Which of the following is the correct syntax to create a FreeRTOS task with priority 5?

easy📝 Syntax Q3 of 15
FreeRTOS - Task Creation and Management

Which of the following is the correct syntax to create a FreeRTOS task with priority 5?

void vTaskCode(void *pvParameters) { /* Task code */ }
AxTaskCreate(vTaskCode, "Task", 1000, NULL, NULL, 5);
BxTaskCreate(vTaskCode, "Task", 1000, NULL, 5, NULL);
CxTaskCreate(vTaskCode, 5, "Task", 1000, NULL, NULL);
DxTaskCreate(5, vTaskCode, "Task", 1000, NULL, NULL);
Step-by-Step Solution
Solution:
  1. Step 1: Recall xTaskCreate() parameter order

    The correct order is: task function, name, stack size, parameters, priority, task handle.
  2. Step 2: Match parameters to syntax

    xTaskCreate(vTaskCode, "Task", 1000, NULL, 5, NULL); matches this order with priority as 5 in the fifth parameter.
  3. Final Answer:

    xTaskCreate(vTaskCode, "Task", 1000, NULL, 5, NULL); -> Option B
  4. Quick Check:

    Correct parameter order = xTaskCreate(vTaskCode, "Task", 1000, NULL, 5, NULL); [OK]
Quick Trick: Priority is the 5th parameter in xTaskCreate() [OK]
Common Mistakes:
  • Mixing parameter order
  • Passing priority as NULL
  • Confusing task handle with priority

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes