Bird
0
0

Which of the following is the correct syntax to create a FreeRTOS task with a stack size of 128 words?

easy📝 Syntax Q3 of 15
FreeRTOS - Task Creation and Management
Which of the following is the correct syntax to create a FreeRTOS task with a stack size of 128 words?
AxTaskCreate(TaskFunction, "TaskName", 128 * sizeof(char), NULL, 1, NULL);
BxTaskCreate(TaskFunction, "TaskName", 128, NULL, 1, NULL);
CxTaskCreate(TaskFunction, "TaskName", 128 * sizeof(int), NULL, 1, NULL);
DxTaskCreate(TaskFunction, "TaskName", 128 / sizeof(int), NULL, 1, NULL);
Step-by-Step Solution
Solution:
  1. Step 1: Recall FreeRTOS stack size parameter meaning

    The stack size parameter is the number of words, so 128 means 128 words.
  2. Step 2: Check syntax correctness

    xTaskCreate(TaskFunction, "TaskName", 128, NULL, 1, NULL); passes 128 directly, which is correct. Multiplying by sizeof(int) or dividing is incorrect.
  3. Final Answer:

    xTaskCreate(TaskFunction, "TaskName", 128, NULL, 1, NULL); -> Option B
  4. Quick Check:

    Stack size param = number of words, no sizeof needed [OK]
Quick Trick: Pass stack size as word count, no sizeof multiplication [OK]
Common Mistakes:
  • Multiplying stack size by sizeof(int)
  • Dividing stack size by sizeof(int)
  • Using bytes instead of words

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes