Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set a task state to Ready.
FreeRTOS
eTaskState state = [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing Running instead of Ready, which means the task is currently executing.
✗ Incorrect
The eReady state means the task is ready to run but not currently running.
2fill in blank
mediumComplete the code to check if a task is currently Running.
FreeRTOS
if (eTaskGetState(taskHandle) == [1]) { // Task is running }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing Ready with Running state.
✗ Incorrect
The eRunning state means the task is currently executing on the CPU.
3fill in blank
hardFix the error in the code to correctly set a task to Blocked state.
FreeRTOS
vTaskDelay([1]); // Delay causes task to enter Blocked state Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using zero or negative values which do not block the task.
✗ Incorrect
Using a positive delay value like 100 ticks causes the task to enter Blocked state for that time.
4fill in blank
hardFill both blanks to create a task and then suspend it.
FreeRTOS
xTaskCreate(taskFunction, "Task", 1000, NULL, 1, &taskHandle); vTask[1](taskHandle); // Suspend the task // Later vTask[2](taskHandle); // Resume the task
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Delete instead of Suspend, which removes the task permanently.
✗ Incorrect
vTaskSuspend() pauses the task, and vTaskResume() restarts it.
5fill in blank
hardFill all three blanks to create a dictionary of task states for given tasks.
FreeRTOS
eTaskState states[] = {
[1],
[2],
[3]
}; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Repeating the same state multiple times.
✗ Incorrect
This array holds three task states: Suspended, Running, and Blocked.