Bird
0
0

Consider this code snippet in FreeRTOS:

medium📝 Predict Output Q13 of 15
FreeRTOS - RTOS Fundamentals
Consider this code snippet in FreeRTOS:
TickType_t start = xTaskGetTickCount();
vTaskDelay(50);
TickType_t end = xTaskGetTickCount();
TickType_t diff = end - start;
What is the expected value of diff?
A0
B50
C100
DDepends on task priority
Step-by-Step Solution
Solution:
  1. Step 1: Understand xTaskGetTickCount()

    This function returns the current tick count since the scheduler started.
  2. Step 2: Analyze vTaskDelay(50)

    The task delays itself for 50 ticks, so the tick count advances by 50 during the delay.
  3. Step 3: Calculate difference

    Subtracting start from end gives the delay duration, which should be 50 ticks.
  4. Final Answer:

    50 -> Option B
  5. Quick Check:

    Delay ticks = 50 [OK]
Quick Trick: Delay of 50 ticks means tick count difference is 50 [OK]
Common Mistakes:
  • Assuming delay is zero or doubled
  • Thinking task priority affects tick count difference
  • Confusing ticks with milliseconds

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes