Bird
Raised Fist0
FreeRTOSprogramming~10 mins

What is an RTOS in FreeRTOS - Interactive Quiz & Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a FreeRTOS task that prints "Hello RTOS".

FreeRTOS
void vTaskCode( void * pvParameters ) {
    for( ;; ) {
        printf([1]);
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }
}
Drag options to blanks, or click blank then click option'
AHello_Rtos
BHello RTOS
C'Hello RTOS'
D"Hello RTOS"
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes instead of double quotes for strings.
Not using quotes at all, which causes a syntax error.
2fill in blank
medium

Complete the code to start the FreeRTOS scheduler.

FreeRTOS
int main(void) {
    // Create tasks here
    [1]();
    for( ;; );
}
Drag options to blanks, or click blank then click option'
AvTaskStartScheduler
BvStartScheduler
CstartScheduler
DvSchedulerStart
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect function names that do not exist in FreeRTOS.
Forgetting to call the scheduler function.
3fill in blank
hard

Fix the error in the task creation code by filling the missing parameter.

FreeRTOS
xTaskCreate(
    vTaskCode,       // Task function
    "Task1",        // Name
    1000,            // Stack size
    NULL,            // Parameters
    1,               // Priority
    [1]      // Task handle
);
Drag options to blanks, or click blank then click option'
A0
BNULL
C1
DvTaskHandle
Attempts:
3 left
💡 Hint
Common Mistakes
Passing an integer instead of a pointer.
Passing an uninitialized variable.
4fill in blank
hard

Fill both blanks to create a dictionary of task names and their priorities.

FreeRTOS
const char* tasks[] = {"TaskA", "TaskB", "TaskC"};
int priorities[] = {1, 2, 3};

for(int i = 0; i < 3; i++) {
    printf("%s priority: %d\n", [1], [2]);
}
Drag options to blanks, or click blank then click option'
Atasks[i]
Bpriorities[i]
Ctasks
Dpriorities
Attempts:
3 left
💡 Hint
Common Mistakes
Using array names without index, which prints the pointer address.
Mixing up tasks and priorities arrays.
5fill in blank
hard

Fill all three blanks to create a task that toggles an LED every 500ms.

FreeRTOS
void [1]( void * pvParameters ) {
    for( ;; ) {
        [2]();
        vTaskDelay([3] / portTICK_PERIOD_MS);
    }
}
Drag options to blanks, or click blank then click option'
AvToggleLED
BvTaskToggleLED
C500
D1000
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong function names.
Using 1000 instead of 500 for delay.

Practice

(1/5)
1. What does RTOS stand for in embedded systems?
easy
A. Random Task Operating System
B. Real-Time Operating System
C. Rapid Transfer Operating Software
D. Reliable Time Output System

Solution

  1. Step 1: Understand the acronym RTOS

    RTOS is a common term in embedded systems referring to a type of operating system.
  2. Step 2: Match the correct full form

    RTOS stands for Real-Time Operating System, which manages tasks with timing constraints.
  3. Final Answer:

    Real-Time Operating System -> Option B
  4. Quick Check:

    RTOS = Real-Time Operating System [OK]
Hint: Remember RTOS means system for real-time tasks [OK]
Common Mistakes:
  • Confusing RTOS with general operating systems
  • Thinking RTOS stands for random or rapid terms
  • Mixing up the order of words in the acronym
2. Which of the following is the correct way to create a task in FreeRTOS?
easy
A. xTaskCreate(TaskFunction, "TaskName", StackSize, NULL, Priority, NULL);
B. createTask(TaskFunction, "TaskName", StackSize, Priority);
C. TaskCreate(TaskFunction, StackSize, Priority);
D. xCreateTask(TaskFunction, "TaskName", Priority);

Solution

  1. Step 1: Recall FreeRTOS task creation syntax

    FreeRTOS uses the function xTaskCreate with specific parameters including function, name, stack size, parameters, priority, and task handle.
  2. Step 2: Identify the correct function call

    xTaskCreate(TaskFunction, "TaskName", StackSize, NULL, Priority, NULL); matches the correct syntax with all required parameters and correct function name.
  3. Final Answer:

    xTaskCreate(TaskFunction, "TaskName", StackSize, NULL, Priority, NULL); -> Option A
  4. Quick Check:

    FreeRTOS task creation uses xTaskCreate [OK]
Hint: Look for xTaskCreate with all parameters included [OK]
Common Mistakes:
  • Using incorrect function names like createTask
  • Omitting required parameters
  • Wrong order of parameters
3. Consider this FreeRTOS code snippet:
void Task1(void *pvParameters) {
  for(;;) {
    vTaskDelay(1000 / portTICK_PERIOD_MS);
    printf("Task1 running\n");
  }
}

int main() {
  xTaskCreate(Task1, "Task1", 1000, NULL, 1, NULL);
  vTaskStartScheduler();
  return 0;
}

What will be the output when this program runs?
medium
A. Compilation error due to missing parameters
B. Task1 running printed once then program ends
C. Task1 running printed every 1 second repeatedly
D. No output because scheduler is not started

Solution

  1. Step 1: Analyze the task loop and delay

    The task runs an infinite loop with vTaskDelay of 1000 milliseconds, so it prints "Task1 running" every second.
  2. Step 2: Check scheduler start and task creation

    The task is created and scheduler started, so the task runs indefinitely printing the message repeatedly.
  3. Final Answer:

    Task1 running printed every 1 second repeatedly -> Option C
  4. Quick Check:

    Infinite loop with delay prints repeatedly [OK]
Hint: Infinite loop with delay prints repeatedly [OK]
Common Mistakes:
  • Thinking the program ends after one print
  • Assuming scheduler is not started
  • Confusing delay units or missing infinite loop
4. Identify the error in this FreeRTOS task creation code:
void Task2(void *pvParameters) {
  // Task code
}

int main() {
  xTaskCreate(Task2, "Task2", 500, NULL, 2);
  vTaskStartScheduler();
  return 0;
}
medium
A. Missing last parameter (task handle) in xTaskCreate call
B. Task function should not have parameters
C. Stack size is too small
D. Scheduler should be started before creating tasks

Solution

  1. Step 1: Review xTaskCreate function parameters

    xTaskCreate requires six parameters: function, name, stack size, parameters, priority, and task handle pointer.
  2. Step 2: Check the code for missing parameters

    The code provides only five parameters, missing the last one (task handle), causing a compile error.
  3. Final Answer:

    Missing last parameter (task handle) in xTaskCreate call -> Option A
  4. Quick Check:

    xTaskCreate needs 6 parameters [OK]
Hint: Count parameters in xTaskCreate; must be six [OK]
Common Mistakes:
  • Omitting the task handle parameter
  • Thinking task functions cannot have parameters
  • Starting scheduler before task creation
5. You want to run two tasks in FreeRTOS: one blinking an LED every 500ms and another reading a sensor every 1000ms. Which feature of an RTOS helps you achieve this reliably?
hard
A. Static memory allocation only
B. Single-threaded execution without interrupts
C. Manual delay loops in main program
D. Task scheduling with priorities and time slicing

Solution

  1. Step 1: Understand multitasking needs

    Running two tasks with different timing requires the system to switch between tasks efficiently and predictably.
  2. Step 2: Identify RTOS feature for multitasking

    RTOS uses task scheduling with priorities and time slicing to manage multiple tasks reliably.
  3. Final Answer:

    Task scheduling with priorities and time slicing -> Option D
  4. Quick Check:

    RTOS scheduling enables reliable multitasking [OK]
Hint: RTOS scheduling manages multiple timed tasks [OK]
Common Mistakes:
  • Thinking single-threaded code can handle multitasking well
  • Using manual delays instead of scheduler
  • Confusing memory allocation with task management
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard