0
0
Embedded Cprogramming~10 mins

Bare-metal vs RTOS execution model in Embedded C - Interactive Practice

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

Complete the code to define the main loop in a bare-metal system.

Embedded C
int main() {
    while([1]) {
        // main loop code
    }
    return 0;
}
Drag options to blanks, or click blank then click option'
A1
B0
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 or false causes the loop to never run.
Using variables that might change and stop the loop.
2fill in blank
medium

Complete the code to create a task function prototype for an RTOS.

Embedded C
void [1](void *params) {
    while(1) {
        // task code
    }
}
Drag options to blanks, or click blank then click option'
Atask_function
BTaskFunction
CTask1
Dmain
Attempts:
3 left
💡 Hint
Common Mistakes
Using main as a task function name.
Using names with uppercase letters that don't match style.
3fill in blank
hard

Fix the error in the RTOS task creation code by filling the blank.

Embedded C
xTaskCreate([1], "Task1", 100, NULL, 1, NULL);
Drag options to blanks, or click blank then click option'
ATask1
Btask_function
Cmain
Dvoid
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the task name string instead of the function.
Passing void which is not a function.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps task names to their priorities if priority is greater than 2.

Embedded C
task_priorities = {name: [1] for name, [2] in tasks.items() if priority > 2}
Drag options to blanks, or click blank then click option'
Apriority
Cprio
Dtask
Attempts:
3 left
💡 Hint
Common Mistakes
Using inconsistent variable names for priority.
Using undefined variables like prio or task.
5fill in blank
hard

Fill all three blanks to filter and map tasks with priority above 3 to their uppercase names and priorities.

Embedded C
filtered_tasks = [1]([2].upper(): [3] for [2], priority in tasks.items() if priority > 3)
Drag options to blanks, or click blank then click option'
Adict
Bname
Cpriority
Dtasks
Attempts:
3 left
💡 Hint
Common Mistakes
Using tasks instead of dict.
Mixing variable names in keys and values.