Complete the code to define the main loop in a bare-metal system.
int main() {
while([1]) {
// main loop code
}
return 0;
}In bare-metal programming, the main loop runs indefinitely, so the condition should always be true. Using 1 ensures the loop never ends.
Complete the code to create a task function prototype for an RTOS.
void [1](void *params) { while(1) { // task code } }
main as a task function name.Task functions in RTOS often use lowercase and underscore naming. task_function is a clear, valid prototype name.
Fix the error in the RTOS task creation code by filling the blank.
xTaskCreate([1], "Task1", 100, NULL, 1, NULL);
void which is not a function.The first argument to xTaskCreate must be the task function name. task_function is the correct function to run.
Fill both blanks to create a dictionary comprehension that maps task names to their priorities if priority is greater than 2.
task_priorities = {name: [1] for name, [2] in tasks.items() if priority > 2}prio or task.The dictionary comprehension maps each task name to its priority. The variable priority is used both in the value and in the loop unpacking.
Fill all three blanks to filter and map tasks with priority above 3 to their uppercase names and priorities.
filtered_tasks = [1]([2].upper(): [3] for [2], priority in tasks.items() if priority > 3)
tasks instead of dict.The code creates a dictionary from a comprehension. It uses name for keys (converted to uppercase) and priority for values.