Bird
Raised Fist0
Drone Programmingprogramming~20 mins

Indian drone regulations (DGCA rules) in Drone Programming - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
DGCA Drone Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate
2:00remaining
Output of Drone Flight Authorization Check
What is the output of this code that checks if a drone flight is authorized based on altitude and no-fly zone?
Drone Programming
def check_authorization(altitude, in_no_fly_zone):
    if altitude > 400:
        return "Flight not authorized: altitude too high"
    if in_no_fly_zone:
        return "Flight not authorized: no-fly zone"
    return "Flight authorized"

print(check_authorization(350, False))
A"Flight not authorized: altitude too high"
B"Flight authorized"
C"Flight not authorized: no-fly zone"
D"Flight authorized with restrictions"
Attempts:
2 left
💡 Hint
Check the altitude and no-fly zone conditions carefully.
🧠 Conceptual
intermediate
1:30remaining
Understanding Drone Weight Categories
According to DGCA rules, which weight category does a drone weighing 3.5 kg belong to?
ANano drone (less than 250 grams)
BMicro drone (250 grams to 2 kg)
CSmall drone (2 kg to 25 kg)
DMedium drone (25 kg to 150 kg)
Attempts:
2 left
💡 Hint
Check the weight ranges for each category carefully.
🔧 Debug
advanced
2:00remaining
Identify the Error in Geo-fencing Code
What error does this code raise when checking if a drone is inside a geo-fenced area?
Drone Programming
def is_inside_geo_fence(lat, lon, fence):
    return fence['lat_min'] <= lat <= fence['lat_max'] and fence['lon_min'] <= lon <= fence['lon_max']

fence = {'lat_min': 12.0, 'lat_max': 13.0, 'lon_min': 77.0}
print(is_inside_geo_fence(12.5, 77.5, fence))
AKeyError: 'lon_max'
BTypeError: unsupported operand type(s) for <=: 'dict' and 'float'
CReturns False
DSyntaxError: invalid syntax
Attempts:
2 left
💡 Hint
Check if all required keys exist in the fence dictionary.
📝 Syntax
advanced
1:30remaining
Syntax Error in Drone Flight Plan Dictionary
Which option contains the correct syntax for defining a drone flight plan dictionary with keys 'start', 'end', and 'altitude'?
Aflight_plan = {'start': (12.9716, 77.5946), 'end': (13.0358, 77.5970), 'altitude': 300}
Bflight_plan = {'start': (12.9716, 77.5946), 'end': (13.0358, 77.5970) 'altitude': 300}
Cflight_plan = {'start': (12.9716, 77.5946), 'end': (13.0358, 77.5970), 'altitude': 300,}
Dflight_plan = {'start': (12.9716, 77.5946), 'end': (13.0358, 77.5970), altitude: 300}
Attempts:
2 left
💡 Hint
Check commas and quotes around keys.
🚀 Application
expert
2:30remaining
Calculate Total Flight Time with Battery Constraints
Given a drone with a battery capacity of 6000 mAh and a consumption rate of 1200 mAh per 10 minutes, what is the maximum flight time in minutes?
A50 minutes
B60 minutes
C70 minutes
D80 minutes
Attempts:
2 left
💡 Hint
Divide battery capacity by consumption rate per minute.

Practice

(1/5)
1. Which of the following is a mandatory requirement for flying a drone in India according to DGCA rules?
easy
A. Flying in restricted no-fly zones
B. Flying above 400 feet without permission
C. Registering the drone before flight
D. Ignoring the drone weight limits

Solution

  1. Step 1: Understand DGCA registration rule

    DGCA mandates that all drones must be registered before flying in India.
  2. Step 2: Check other options against DGCA rules

    Flying above 400 feet or in no-fly zones is prohibited without permission, and ignoring weight limits is not allowed.
  3. Final Answer:

    Registering the drone before flight -> Option C
  4. Quick Check:

    Registration is mandatory = C [OK]
Hint: Remember: Registration is the first step before flying [OK]
Common Mistakes:
  • Assuming flying above 400 feet is allowed
  • Ignoring no-fly zone restrictions
  • Thinking weight limits don't matter
2. Which Python code snippet correctly checks if a drone's altitude is within the DGCA allowed limit of 400 feet?
easy
A. if altitude <= 400: print('Safe to fly')
B. if altitude < 400: print('Safe to fly')
C. if altitude >= 400: print('Safe to fly')
D. if altitude > 400: print('Safe to fly')

Solution

  1. Step 1: Understand altitude limit condition

    DGCA allows flying up to 400 feet inclusive, so altitude <= 400 is correct.
  2. Step 2: Analyze each condition

    if altitude <= 400: print('Safe to fly') uses <= 400, which includes 400 feet. if altitude < 400: print('Safe to fly') excludes 400 feet, the other options allow unsafe altitudes.
  3. Final Answer:

    if altitude <= 400:\n print('Safe to fly') -> Option A
  4. Quick Check:

    Altitude must be at most 400 = B [OK]
Hint: Use <= 400 to include max allowed altitude [OK]
Common Mistakes:
  • Using < 400 excludes exactly 400 feet
  • Using >= or > allows unsafe altitudes
  • Confusing comparison operators
3. What will be the output of this Python code snippet checking drone weight compliance?
weight = 2.5  # in kg
if weight <= 2:
    print('Light drone')
elif weight <= 25:
    print('Medium drone')
else:
    print('Heavy drone')
medium
A. Light drone
B. Medium drone
C. Heavy drone
D. No output

Solution

  1. Step 1: Check weight against conditions

    Weight is 2.5 kg, which is not <= 2 but is <= 25.
  2. Step 2: Determine which print executes

    Since 2.5 <= 25, the 'Medium drone' print statement runs.
  3. Final Answer:

    Medium drone -> Option B
  4. Quick Check:

    2.5 kg fits medium drone category = A [OK]
Hint: Check conditions top to bottom; first true runs [OK]
Common Mistakes:
  • Assuming 2.5 kg is light drone
  • Ignoring elif condition
  • Thinking else runs for 2.5 kg
4. Identify the error in this Python code snippet that checks if a drone is flying in a no-fly zone:
no_fly_zones = ['airport', 'military_base']
drone_location = 'airport'
if drone_location = no_fly_zones:
    print('Drone in no-fly zone!')
medium
A. Using '=' instead of '==' in the if condition
B. Incorrect list syntax for no_fly_zones
C. Missing colon ':' after if statement
D. Wrong variable name drone_location

Solution

  1. Step 1: Check the if condition syntax

    The code uses '=' which is assignment, not comparison. It should be '==' or 'in'.
  2. Step 2: Understand correct membership check

    To check if drone_location is in no_fly_zones, use 'if drone_location in no_fly_zones:'. Using '=' causes syntax error.
  3. Final Answer:

    Using '=' instead of '==' in the if condition -> Option A
  4. Quick Check:

    Use '==' or 'in' for comparison, not '=' [OK]
Hint: Use '==' or 'in' for comparisons, '=' is assignment [OK]
Common Mistakes:
  • Using '=' instead of '==' or 'in'
  • Confusing assignment with comparison
  • Not checking membership properly
5. You want to write a Python function to check if a drone flight is legal under DGCA rules. The drone must be registered, fly below 400 feet, and not be in a no-fly zone. Which function correctly implements these checks?
hard
A. def is_legal(registered, altitude, location): if registered and altitude > 400 and location not in ['airport', 'military_base']: return True return False
B. def is_legal(registered, altitude, location): if registered or altitude < 400 or location in ['airport', 'military_base']: return True return False
C. def is_legal(registered, altitude, location): if not registered and altitude > 400 and location in ['airport', 'military_base']: return True return False
D. def is_legal(registered, altitude, location): if registered and altitude <= 400 and location not in ['airport', 'military_base']: return True return False

Solution

  1. Step 1: Analyze legal conditions

    Drone must be registered, altitude <= 400, and location not in no-fly zones.
  2. Step 2: Check each option's logic

    def is_legal(registered, altitude, location): if registered and altitude <= 400 and location not in ['airport', 'military_base']: return True return False uses 'and' for all conditions correctly. Others use 'or' or wrong comparisons allowing illegal flights.
  3. Final Answer:

    def is_legal(registered, altitude, location):\n if registered and altitude <= 400 and location not in ['airport', 'military_base']:\n return True\n return False -> Option D
  4. Quick Check:

    All conditions must be true = A [OK]
Hint: Use 'and' to combine all legal conditions [OK]
Common Mistakes:
  • Using 'or' instead of 'and' allowing illegal flights
  • Wrong altitude comparison signs
  • Incorrect no-fly zone membership check
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