Bird
0
0

Which of the following is the correct way to check a shutdown flag inside a FreeRTOS task loop?

easy📝 Syntax Q3 of 15
FreeRTOS - Design Patterns for RTOS
Which of the following is the correct way to check a shutdown flag inside a FreeRTOS task loop?
Aif (shutdownFlag == true) { /* cleanup */ }
Bif shutdownFlag = true { /* cleanup */ }
Cif (shutdownFlag = true) { /* cleanup */ }
Dif shutdownFlag == true then { /* cleanup */ }
Step-by-Step Solution
Solution:
  1. Step 1: Review correct C syntax for conditionals

    Conditions require parentheses and double equals for comparison.
  2. Step 2: Identify syntax errors in options

    "if (shutdownFlag == true) { /* cleanup */ }" uses correct syntax. The others have errors: missing parentheses around the condition, using single '=' (assignment) instead of '==' (comparison), or invalid keywords like 'then'.
  3. Final Answer:

    if (shutdownFlag == true) { /* cleanup */ } -> Option A
  4. Quick Check:

    Correct conditional syntax = if (shutdownFlag == true) { /* cleanup */ } [OK]
Quick Trick: Use '==' for comparison inside parentheses [OK]
Common Mistakes:
  • Using single '=' instead of '=='
  • Omitting parentheses in if condition
  • Using invalid keywords like 'then'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes