Bird
0
0

Identify the error in this code snippet intended to get the stack high water mark of a task named myTaskHandle:

medium📝 Troubleshoot Q14 of 15
FreeRTOS - Debugging and Monitoring

Identify the error in this code snippet intended to get the stack high water mark of a task named myTaskHandle:

UBaseType_t mark = uxTaskGetStackHighWaterMark(myTaskHandle);

Assume myTaskHandle is a valid task handle.

AReturn type should be int, not UBaseType_t
BFunction name is incorrect, should be uxGetStackHighWaterMark
CParameter should be NULL to get any task's high water mark
DNo error, code is correct
Step-by-Step Solution
Solution:
  1. Step 1: Verify function and parameter usage

    uxTaskGetStackHighWaterMark takes a task handle to get that task's high water mark. Using myTaskHandle is valid.
  2. Step 2: Check return type and function name

    Return type UBaseType_t is correct. Function name is correct as per FreeRTOS API.
  3. Final Answer:

    No error, code is correct -> Option D
  4. Quick Check:

    Correct function and parameter usage means no error [OK]
Quick Trick: Use task handle parameter for specific task, NULL for current task [OK]
Common Mistakes:
  • Thinking NULL is required for all tasks
  • Using wrong function names
  • Confusing return types

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes