Bird
Raised Fist0
Drone Programmingprogramming~20 mins

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

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
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.

Practice

(1/5)
1. What does uploading a mission to a drone usually do?
easy
A. It immediately starts the drone's engines.
B. It charges the drone's battery.
C. It returns the drone to its home location.
D. It sends the flight plan to the drone for automatic flying.

Solution

  1. Step 1: Understand mission upload meaning

    Uploading a mission means sending the flight plan to the drone's system.
  2. Step 2: Identify what happens after upload

    The drone receives the plan but does not start flying until commanded.
  3. Final Answer:

    It sends the flight plan to the drone for automatic flying. -> Option D
  4. Quick Check:

    Uploading mission = send flight plan [OK]
Hint: Uploading means sending the flight plan, not starting flight [OK]
Common Mistakes:
  • Confusing upload with starting the drone
  • Thinking upload charges the battery
  • Assuming upload returns drone home
2. Which of the following is the correct syntax to start a mission after uploading it in drone programming?
easy
A. drone.startMission()
B. drone.uploadMission()
C. drone.beginFlight()
D. drone.executePlan()

Solution

  1. Step 1: Identify method to start mission

    The method to start flying the uploaded mission is usually named startMission().
  2. Step 2: Differentiate from upload method

    uploadMission() uploads the plan but does not start flight.
  3. Final Answer:

    drone.startMission() -> Option A
  4. Quick Check:

    Start mission method = startMission() [OK]
Hint: Start mission uses startMission(), not uploadMission() [OK]
Common Mistakes:
  • Using uploadMission() to start flight
  • Confusing method names like beginFlight() which is invalid
  • Assuming executePlan() is standard method
3. Given this code snippet:
drone.uploadMission(missionPlan)
drone.startMission()
print(drone.status())

What is the expected output if the mission starts successfully?
medium
A. "Mission started"
B. "Mission uploaded"
C. "Mission completed"
D. "Error: No mission uploaded"

Solution

  1. Step 1: Analyze code sequence

    The mission is uploaded first, then started, so the drone should be flying.
  2. Step 2: Check status output meaning

    Calling drone.status() after startMission() should return "Mission started" indicating flight began.
  3. Final Answer:

    "Mission started" -> Option A
  4. Quick Check:

    Status after startMission() = "Mission started" [OK]
Hint: Status after startMission() shows "Mission started" [OK]
Common Mistakes:
  • Confusing upload status with start status
  • Expecting "Mission completed" immediately
  • Assuming error without upload
4. Identify the error in this code snippet:
drone.startMission()
drone.uploadMission(missionPlan)
medium
A. Missing drone initialization causes failure.
B. Uploading mission twice is not allowed.
C. Starting mission before uploading causes an error.
D. No error; code runs fine.

Solution

  1. Step 1: Check order of operations

    Mission must be uploaded before starting; here startMission() is called first.
  2. Step 2: Understand consequence

    Starting mission without upload means no flight plan, causing an error.
  3. Final Answer:

    Starting mission before uploading causes an error. -> Option C
  4. Quick Check:

    Upload before startMission() [OK]
Hint: Upload mission before starting flight to avoid errors [OK]
Common Mistakes:
  • Calling startMission() before uploadMission()
  • Assuming no initialization error
  • Thinking multiple uploads cause error here
5. You want to upload a mission and monitor its progress until completion. Which code sequence correctly achieves this?
1. drone.uploadMission(plan)
2. drone.startMission()
3. while not drone.isMissionComplete():
       print(drone.getProgress())
4. print("Mission complete!")
hard
A. Mission cannot be monitored programmatically after upload.
B. This sequence correctly uploads, starts, monitors, and confirms mission completion.
C. The loop should check drone.status() == "started" instead of isMissionComplete().
D. You must call drone.monitorMission() before startMission().

Solution

  1. Step 1: Verify mission upload and start

    Uploading the plan then starting the mission is the correct order.
  2. Step 2: Confirm monitoring loop logic

    The loop checks if mission is complete and prints progress until done, then confirms completion.
  3. Final Answer:

    This sequence correctly uploads, starts, monitors, and confirms mission completion. -> Option B
  4. Quick Check:

    Upload -> start -> monitor -> complete [OK]
Hint: Upload first, then start, then monitor until complete [OK]
Common Mistakes:
  • Trying to monitor before starting mission
  • Checking wrong status in loop
  • Assuming mission can't be monitored