0
0
Drone Programmingprogramming~20 mins

Mission upload and execution in Drone Programming - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Mission Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this mission upload status code?

Consider this code snippet that uploads a mission to a drone and prints the status. What will it print?

Drone Programming
mission = ['takeoff', 'fly_to:10,20,30', 'land']
status = upload_mission(mission)
print(status)
A"Mission empty"
B"Upload failed: connection lost"
C"Upload successful"
D"Error: invalid command"
Attempts:
2 left
💡 Hint

Assume the upload_mission function returns "Upload successful" if the mission list is valid and non-empty.

Predict Output
intermediate
2:00remaining
What does this mission execution code print?

This code executes a mission and prints the result. What is printed?

Drone Programming
mission = ['takeoff', 'fly_to:5,5,5', 'hover:10', 'land']
result = execute_mission(mission)
print(result)
A"Mission completed successfully"
B"Mission aborted: low battery"
C"Error: unknown command hover"
D"Mission paused"
Attempts:
2 left
💡 Hint

The execute_mission function completes the mission if all commands are valid.

Predict Output
advanced
2:00remaining
What error does this mission upload code raise?

What error will this code raise when trying to upload the mission?

Drone Programming
mission = ['takeoff', 'fly_to:10,20', 'land']
status = upload_mission(mission)
print(status)
ANo error, prints "Upload successful"
BValueError: Invalid coordinates format
CKeyError: 'fly_to' command missing parameters
DTypeError: mission must be a list
Attempts:
2 left
💡 Hint

The fly_to command expects three coordinates separated by commas.

🧠 Conceptual
advanced
2:00remaining
Which option will cause the mission execution to pause?

Given the mission commands below, which option will cause the drone to pause execution?

Drone Programming
mission = ['takeoff', 'fly_to:0,0,10', 'pause', 'land']
AThe 'pause' command causes a runtime error stopping execution
BThe 'pause' command is ignored and mission continues without pause
CThe 'pause' command causes the drone to land immediately
DThe 'pause' command is recognized and causes the drone to pause
Attempts:
2 left
💡 Hint

Some drones support a 'pause' command to temporarily stop mission execution.

🔧 Debug
expert
3:00remaining
Why does this mission execution code raise a runtime error?

Analyze the code below. Why does it raise a runtime error during mission execution?

Drone Programming
mission = ['takeoff', 'fly_to:10,20,30', 'hover:-5', 'land']
execute_mission(mission)
ANegative hover time is invalid and causes a runtime error
BThe 'fly_to' command has invalid coordinates causing the error
CThe mission list is empty causing an error
DThe 'land' command is missing parameters causing the error
Attempts:
2 left
💡 Hint

Hover time must be a positive number.