0
0
Drone Programmingprogramming~20 mins

Search and rescue assistance in Drone Programming - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Search and Rescue Drone Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Drone path calculation output
What is the output of this drone path calculation code snippet?
Drone Programming
def calculate_path(start, end):
    path = []
    x, y = start
    ex, ey = end
    while x != ex or y != ey:
        if x < ex:
            x += 1
        elif x > ex:
            x -= 1
        if y < ey:
            y += 1
        elif y > ey:
            y -= 1
        path.append((x, y))
    return path

print(calculate_path((0, 0), (2, 1)))
A[(1, 1), (1, 0), (2, 1)]
B[(0, 1), (1, 1), (2, 1)]
C[(1, 0), (2, 0), (2, 1)]
D[(1, 1), (2, 1)]
Attempts:
2 left
💡 Hint
Trace the increments of x and y carefully in the loop.
🧠 Conceptual
intermediate
1:30remaining
Understanding drone sensor data filtering
A drone receives noisy sensor data for temperature readings. Which method best filters out sudden spikes while keeping the trend smooth?
AApply a moving average filter over the last 5 readings
BUse the maximum value from the last 3 readings
CTake the difference between consecutive readings
DIgnore all readings below a fixed threshold
Attempts:
2 left
💡 Hint
Think about smoothing data to reduce noise.
🔧 Debug
advanced
1:30remaining
Fix the drone battery check logic
What error does this drone battery check code raise when battery_level is 15?
Drone Programming
battery_level = 15
if battery_level > 20:
    status = 'Full'
elif battery_level > 10:
    status = 'Medium'
else:
    status = 'Low'
print(status)
ASyntaxError due to missing colon after else
BNameError because status is not defined
CTypeError from comparing int and str
DNo error, prints 'Medium'
Attempts:
2 left
💡 Hint
Check the syntax of the else statement.
Predict Output
advanced
2:00remaining
Drone search grid coverage count
What is the number of unique grid cells covered by the drone after this movement sequence?
Drone Programming
moves = ['N', 'N', 'E', 'E', 'S', 'W', 'W', 'N']
visited = set()
x, y = 0, 0
visited.add((x, y))
for move in moves:
    if move == 'N':
        y += 1
    elif move == 'S':
        y -= 1
    elif move == 'E':
        x += 1
    elif move == 'W':
        x -= 1
    visited.add((x, y))
print(len(visited))
A8
B6
C7
D9
Attempts:
2 left
💡 Hint
Count each unique coordinate visited after each move.
🚀 Application
expert
3:00remaining
Optimizing drone search pattern for battery life
Given a drone must search a rectangular area of 10x5 units and return to start, which path minimizes total distance traveled?
AFly around the perimeter only, skipping inner area
BFly in a zigzag pattern row by row, then return directly to start
CFly diagonally corner to corner, then cover remaining cells randomly
DFly in a spiral from center outward, then back to center
Attempts:
2 left
💡 Hint
Consider covering all cells efficiently without backtracking.