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
Recall & Review
beginner
What is a geofence in drone programming?
A geofence is a virtual boundary set around a specific geographic area to control where a drone can fly. It helps keep the drone within safe or legal zones.
Click to reveal answer
beginner
Name two common shapes used to set geofence boundaries.
The two common shapes are circles (defined by a center point and radius) and polygons (defined by multiple points connected to form an area).
Click to reveal answer
intermediate
Why is it important to set altitude limits in geofence boundaries?
Altitude limits prevent drones from flying too high or too low, avoiding collisions with buildings, aircraft, or restricted airspace.
Click to reveal answer
intermediate
How does a drone typically respond when it reaches a geofence boundary?
The drone can stop, hover, return home, or alert the operator to prevent crossing the boundary.
Click to reveal answer
beginner
What data is needed to program a geofence boundary?
You need geographic coordinates (latitude and longitude) for the boundary points, altitude limits, and sometimes time or flight mode restrictions.
Click to reveal answer
What does a geofence boundary do for a drone?
AIncreases the drone's speed
BLimits where the drone can fly
CChanges the drone's camera angle
DControls the drone's battery life
✗ Incorrect
A geofence sets a virtual boundary to limit the drone's flying area.
Which shape is NOT commonly used for geofence boundaries?
ASquare
BPolygon
CCircle
DTriangle
✗ Incorrect
Squares are not typically used as a separate shape; polygons cover all multi-point shapes including triangles and squares.
What happens if a drone reaches the geofence limit?
AIt ignores the boundary
BIt speeds up
CIt shuts down immediately
DIt stops or returns home
✗ Incorrect
Drones usually stop, hover, or return home to avoid crossing the geofence.
Which data is essential to define a geofence?
AGeographic coordinates
BDrone color
CPilot's name
DCamera resolution
✗ Incorrect
Geographic coordinates define the location of the geofence boundary.
Why set altitude limits in geofences?
ATo save battery
BTo increase flight speed
CTo avoid collisions with other objects
DTo improve video quality
✗ Incorrect
Altitude limits help prevent collisions with buildings, aircraft, or restricted airspace.
Explain how to set a geofence boundary for a drone flight.
Think about the area, height, and what the drone should do when it reaches the edge.
You got /4 concepts.
Why are geofence boundaries important for drone safety?
Consider risks of flying without limits.
You got /4 concepts.
Practice
(1/5)
1.
What is the main purpose of setting geofence boundaries for a drone?
easy
A. To improve the drone's camera quality
B. To increase the drone's speed
C. To keep the drone flying within a safe area
D. To reduce the drone's battery usage
Solution
Step 1: Understand geofence boundaries
Geofence boundaries define a virtual area where the drone is allowed to fly.
Step 2: Identify the purpose of geofencing
The main goal is to keep the drone safe by preventing it from flying outside this area.
Final Answer:
To keep the drone flying within a safe area -> Option C
Quick Check:
Geofence = safe flying area [OK]
Hint: Geofence means safe zone for drone flight [OK]
Common Mistakes:
Confusing geofence with speed control
Thinking geofence improves camera
Assuming geofence saves battery
2.
Which of the following is the correct way to define a geofence boundary in code using minimum and maximum latitude and longitude?
D. Change current_position['lon'] to 30.0 to be inside geofence
Solution
Step 1: Identify the syntax error
The if condition is split across lines without parentheses or backslash, causing SyntaxError.
Step 2: Understand the required fix
Parentheses around the condition allow multi-line expressions.
Step 3: Confirm logic after fix
With syntax fixed, lat inside but lon 40.0 > 35.0 outside, prints correctly "Outside geofence".
Final Answer:
Add parentheses around the if condition -> Option A
Quick Check:
if (cond1 and cond2): syntax OK [OK]
Hint: Wrap multi-line if conditions in parentheses [OK]
Common Mistakes:
Using 'or' instead of 'and' in condition
Swapping min and max values incorrectly
Changing data instead of fixing syntax
5.
You want to create a geofence that excludes a small no-fly zone inside a larger allowed area. Which approach correctly sets this using nested geofence boundaries?
# Outer geofence
outer = {'min_lat': 10.0, 'max_lat': 20.0, 'min_lon': 30.0, 'max_lon': 40.0}
# Inner no-fly zone
no_fly = {'min_lat': 14.0, 'max_lat': 16.0, 'min_lon': 34.0, 'max_lon': 36.0}
# Function to check if position is inside a geofence
Which code snippet correctly returns True only if the position is inside the outer geofence but outside the no-fly zone?
hard
A. return (outer['min_lat'] <= lat <= outer['max_lat'] and outer['min_lon'] <= lon <= outer['max_lon']) and not (no_fly['min_lat'] <= lat <= no_fly['max_lat'] and no_fly['min_lon'] <= lon <= no_fly['max_lon'])
B. return (outer['min_lat'] <= lat <= outer['max_lat'] and outer['min_lon'] <= lon <= outer['max_lon']) or (no_fly['min_lat'] <= lat <= no_fly['max_lat'] and no_fly['min_lon'] <= lon <= no_fly['max_lon'])
C. return not (outer['min_lat'] <= lat <= outer['max_lat'] and outer['min_lon'] <= lon <= outer['max_lon']) and (no_fly['min_lat'] <= lat <= no_fly['max_lat'] and no_fly['min_lon'] <= lon <= no_fly['max_lon'])
D. return (outer['min_lat'] >= lat >= outer['max_lat'] and outer['min_lon'] >= lon >= outer['max_lon']) and not (no_fly['min_lat'] >= lat >= no_fly['max_lat'] and no_fly['min_lon'] >= lon >= no_fly['max_lon'])
Solution
Step 1: Check position inside outer geofence
Use conditions to confirm latitude and longitude are within outer boundaries.
Step 2: Exclude position inside no-fly zone
Use 'not' to ensure position is outside the inner no-fly zone boundaries.
Step 3: Combine conditions correctly
Use 'and' to require both conditions: inside outer and outside no-fly zone.
Final Answer:
return (outer['min_lat'] <= lat <= outer['max_lat'] and outer['min_lon'] <= lon <= outer['max_lon']) and not (no_fly['min_lat'] <= lat <= no_fly['max_lat'] and no_fly['min_lon'] <= lon <= no_fly['max_lon']) -> Option A
Quick Check:
Inside outer and outside inner = return (outer['min_lat'] <= lat <= outer['max_lat'] and outer['min_lon'] <= lon <= outer['max_lon']) and not (no_fly['min_lat'] <= lat <= no_fly['max_lat'] and no_fly['min_lon'] <= lon <= no_fly['max_lon']) [OK]
Hint: Use 'and' with 'not' to exclude inner no-fly zone [OK]