Bird
Raised Fist0
Drone Programmingprogramming~20 mins

Landing and disarming in Drone Programming - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Master of Landing and Disarming
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 landing sequence code?

Consider this drone landing code snippet. What will be printed after execution?

Drone Programming
drone_status = {'flying': True, 'armed': True}

if drone_status['flying']:
    print('Landing initiated')
    drone_status['flying'] = False

if not drone_status['flying'] and drone_status['armed']:
    print('Disarming drone')
    drone_status['armed'] = False

print(f"Flying: {drone_status['flying']}, Armed: {drone_status['armed']}")
A
Disarming drone
Flying: True, Armed: False
B
Landing initiated
Disarming drone
Flying: True, Armed: False
C
Landing initiated
Flying: False, Armed: True
D
Landing initiated
Disarming drone
Flying: False, Armed: False
Attempts:
2 left
💡 Hint

Check the order of status changes and conditions.

🧠 Conceptual
intermediate
1:30remaining
Which condition ensures safe disarming after landing?

In drone programming, which condition best ensures the drone is safe to disarm?

ADrone is not flying and altitude is zero
BDrone is flying and altitude is zero
CDrone is flying and battery level is below 10%
DDrone is not flying and battery level is above 20%
Attempts:
2 left
💡 Hint

Think about when the drone is fully landed.

🔧 Debug
advanced
2:30remaining
Why does this landing code fail to disarm?

Review this code snippet. Why does the drone never disarm?

Drone Programming
drone = {'flying': True, 'armed': True, 'altitude': 5}

if drone['altitude'] == 0:
    drone['flying'] = False

if not drone['flying']:
    drone['armed'] = False

print(f"Armed: {drone['armed']}")
AThe condition to disarm is wrong; it should check altitude instead of flying
BDrone is disarmed immediately because altitude is not checked properly
CAltitude never reaches zero, so flying stays True and disarming never happens
DSyntax error due to missing colon in if statements
Attempts:
2 left
💡 Hint

Check the altitude value and conditions.

📝 Syntax
advanced
1:30remaining
Identify the syntax error in this landing and disarming code

Which option correctly identifies the syntax error in this code?

Drone Programming
if drone['flying'] == True
    drone['flying'] = False
    drone['armed'] = False
AIncorrect use of square brackets for dictionary keys
BMissing colon at the end of the if statement line
CIndentation error on the second line
DUsing '==' instead of '=' for assignment
Attempts:
2 left
💡 Hint

Look at the if statement syntax.

🚀 Application
expert
2:00remaining
How many steps are in this landing and disarming sequence?

Given this code, how many times will the print statement execute during the landing and disarming process?

Drone Programming
steps = ['descend', 'touchdown', 'stop_motors', 'disarm']

for step in steps:
    if step == 'descend':
        print('Descending...')
    elif step == 'touchdown':
        print('Touchdown confirmed')
    elif step == 'stop_motors':
        print('Motors stopped')
    elif step == 'disarm':
        print('Drone disarmed')
A4
B3
C1
D0
Attempts:
2 left
💡 Hint

Count how many print statements run in the loop.

Practice

(1/5)
1. What is the main purpose of disarm() in drone programming?
easy
A. To increase the drone's speed
B. To make the drone take off automatically
C. To stop the drone's motors and prevent propeller movement
D. To change the drone's flight path

Solution

  1. Step 1: Understand the function of disarm()

    The disarm() function is used to stop the drone's motors, which stops the propellers from spinning.
  2. Step 2: Compare with other options

    Taking off, increasing speed, or changing flight path are not related to disarming.
  3. Final Answer:

    To stop the drone's motors and prevent propeller movement -> Option C
  4. Quick Check:

    Disarm = stop motors [OK]
Hint: Disarm always means stop motors and propellers [OK]
Common Mistakes:
  • Confusing disarm with takeoff
  • Thinking disarm changes flight path
  • Assuming disarm increases speed
2. Which of the following is the correct syntax to land a drone using a function named land()?
easy
A. land()
B. land[]
C. land{}
D. land;

Solution

  1. Step 1: Recall function call syntax

    In most programming languages, calling a function uses parentheses after the function name, like land().
  2. Step 2: Check other options

    Square brackets, curly braces, or semicolons alone are not valid for calling functions.
  3. Final Answer:

    land() -> Option A
  4. Quick Check:

    Function call = name() [OK]
Hint: Functions need parentheses to run [OK]
Common Mistakes:
  • Using brackets [] instead of parentheses ()
  • Adding semicolon without parentheses
  • Using curly braces {} for function calls
3. What will be the output of this code snippet?
drone.arm()
drone.takeoff()
drone.land()
drone.disarm()
print(drone.status)

Assuming status shows 'disarmed' after disarming.
medium
A. armed
B. flying
C. landed
D. disarmed

Solution

  1. Step 1: Follow the code steps

    The drone is first armed, then takes off, then lands, and finally disarms.
  2. Step 2: Understand status after disarm()

    After calling disarm(), the drone's status changes to 'disarmed'.
  3. Final Answer:

    disarmed -> Option D
  4. Quick Check:

    Status after disarm() = disarmed [OK]
Hint: Disarm sets status to 'disarmed' after landing [OK]
Common Mistakes:
  • Assuming status stays 'flying' after land()
  • Confusing 'landed' with 'disarmed'
  • Ignoring the effect of disarm() on status
4. Identify the error in this drone landing and disarming code:
drone.land
safety = drone.disarm()
medium
A. Missing parentheses after land function call
B. Using assignment instead of comparison
C. Incorrect variable name 'safety'
D. Disarm should be called before land

Solution

  1. Step 1: Check function call syntax

    The code uses drone.land without parentheses, so the function is not called.
  2. Step 2: Verify order and variables

    Assigning drone.disarm() to safety is valid, and disarm after land is correct.
  3. Final Answer:

    Missing parentheses after land function call -> Option A
  4. Quick Check:

    Function calls need () [OK]
Hint: Always add () to call functions [OK]
Common Mistakes:
  • Forgetting parentheses on function calls
  • Thinking disarm must come before land
  • Confusing assignment with comparison
5. You want to safely end a drone flight by landing and then disarming. Which code sequence correctly ensures the drone lands before disarming?
hard
A. drone.disarm() drone.land()
B. drone.land() drone.disarm()
C. drone.land() drone.land() drone.disarm()
D. drone.disarm() drone.disarm() drone.land()

Solution

  1. Step 1: Understand safe landing sequence

    The drone must land first to touch the ground safely before motors stop.
  2. Step 2: Check code order

    drone.land() drone.disarm() calls land() first, then disarm(), which is correct.
  3. Final Answer:

    drone.land() followed by drone.disarm() -> Option B
  4. Quick Check:

    Land before disarm = drone.land() drone.disarm() [OK]
Hint: Always land before disarming motors [OK]
Common Mistakes:
  • Disarming before landing causing unsafe stop
  • Repeating land unnecessarily
  • Calling disarm multiple times before landing
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