Bird
0
0

Given the following code snippet, what will be the output stored in buffer after calling vTaskList(buffer); if there are two tasks named "TaskA" and "TaskB" running?

medium📝 Predict Output Q13 of 15
FreeRTOS - Debugging and Monitoring
Given the following code snippet, what will be the output stored in buffer after calling vTaskList(buffer); if there are two tasks named "TaskA" and "TaskB" running?
char buffer[512];
vTaskList(buffer);
printf("%s", buffer);
AA formatted table listing TaskA and TaskB with their states, priorities, and stack usage
BOnly the names of TaskA and TaskB separated by commas
CAn empty string because buffer is not initialized
DA runtime error due to buffer overflow
Step-by-Step Solution
Solution:
  1. Step 1: Understand what vTaskList() writes

    The function writes a formatted string showing all tasks with details like name, state, priority, stack usage, and task number.
  2. Step 2: Analyze the buffer content after call

    Since buffer is large enough (512 bytes), it will contain a readable table listing TaskA and TaskB with their statuses.
  3. Final Answer:

    A formatted table listing TaskA and TaskB with their states, priorities, and stack usage -> Option A
  4. Quick Check:

    vTaskList() output = formatted task table [OK]
Quick Trick: vTaskList() outputs full task info table, not just names [OK]
Common Mistakes:
  • Expecting only task names without details
  • Assuming buffer needs initialization before call
  • Thinking it causes runtime error if buffer is large enough

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes