0
0
Drone Programmingprogramming~20 mins

Communication between drones in Drone Programming - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Drone Communication Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Message Passing Output
What is the output of this drone communication code snippet?
Drone Programming
drone1 = {'id': 101, 'message': 'Hello'}
drone2 = {'id': 102, 'message': ''}
# drone2 receives message from drone1
drone2['message'] = drone1['message']
print(drone2['message'])
Anull
BHello
C'' (empty string)
DError: KeyError
Attempts:
2 left
💡 Hint
Think about how drone2 gets the message from drone1.
🧠 Conceptual
intermediate
1:30remaining
Communication Protocol Concept
Which communication protocol is best suited for drones to exchange short messages quickly and reliably over short distances?
AWi-Fi
BSatellite
CBluetooth
DFiber Optic Cable
Attempts:
2 left
💡 Hint
Think about short-range wireless communication.
🔧 Debug
advanced
2:30remaining
Fix the Drone Message Broadcast Bug
What error does this code raise when drones try to broadcast messages to each other?
Drone Programming
drones = [{'id': 1, 'msg': 'Hi'}, {'id': 2, 'msg': ''}]
for drone in drones:
    for other in drones:
        if drone != other:
            other['msg'] = drone['msg']
print(drones[1]['msg'])
ATypeError: unsupported operand type(s)
BIndexError: list index out of range
CNo error, output is 'Hi'
DKeyError: 'message'
Attempts:
2 left
💡 Hint
Check the dictionary keys used in the code.
📝 Syntax
advanced
1:30remaining
Identify the Syntax Error in Drone Communication Loop
Which option contains the syntax error preventing the drone communication loop from running?
Drone Programming
for drone in drones
    print(drone['id'])
Afor drone in drones\n print(drone['id'])
Bfor drone in drones:\nprint(drone['id'])
Cfor drone in drones:\n print(drone['id'])
Dfor drone in drones: print(drone['id'])
Attempts:
2 left
💡 Hint
Look for missing punctuation in the for loop.
🚀 Application
expert
2:00remaining
Calculate Total Messages Exchanged
Given 4 drones where each drone sends a message to every other drone exactly once, how many total messages are exchanged?
A12
B16
C8
D6
Attempts:
2 left
💡 Hint
Each drone sends messages to all other drones except itself.