Computer Science
Grade 5
20 min
Communication Review: Connecting with Others
Review of digital communication methods and the importance of responsible online interactions.
Tutorial Preview
1
Introduction & Learning Objectives
Learning Objectives
Model a simple communication protocol using pseudocode with loops and conditionals.
Explain how binary (0s and 1s) is the fundamental language computers use to connect and communicate.
Identify the roles of a 'sender', 'receiver', and 'message' in a digital communication system.
Design a program that uses a loop with a variable to wait for a specific 'handshake' signal from a user.
Use complex conditionals (IF/ELSE IF/ELSE) to validate and respond to different types of received messages.
Debug a simple communication program that has a logical error in its protocol.
How do video game characters know what you want them to do? You're sending them messages with your controller, and they're programmed to listen...
2
Key Concepts & Vocabulary
TermDefinitionExample
ProtocolA set of rules that computers must follow to communicate with each other, just like how we have rules for talking (like saying 'hello' and taking turns).A simple protocol could be: 1. Sender sends 'HELLO'. 2. Receiver replies 'HELLO'. 3. Sender sends the real message. 4. Receiver replies 'GOT IT'.
SenderThe computer, device, or program that is sending a message.When you type a search into Google, your computer is the sender.
ReceiverThe computer, device, or program that is getting a message.When you type a search into Google, Google's server is the receiver.
Message PacketA small piece of information sent from the sender to the receiver. Big messages are broken down into many small packets.One word in a long email...
3
Core Syntax & Patterns
The Handshake Loop Pattern
WHILE (signal_received != 'SECRET_CODE') {
LISTEN for signal
}
Use this pattern to make your program wait until it receives a specific message or input. The loop continues to 'listen' or ask for input until the correct 'handshake' signal is given.
The Message Validator Pattern
IF (message == 'ACTION_A') {
DO task A
} ELSE IF (message == 'ACTION_B') {
DO task B
} ELSE {
SHOW 'Unknown message' error
}
Use this pattern after receiving a message to check what the message says and decide what action to take. The IF/ELSE IF structure allows the program to handle many different possible commands.
4 more steps in this tutorial
Sign up free to access the complete tutorial with worked examples and practice.
Sign Up Free to ContinueSample Practice Questions
Challenging
A simple robot is programmed to read binary commands in pairs (2 bits at a time). The commands are: `01`=step forward, `10`=turn left, `11`=beep. The robot receives a long message: `01100111`. What sequence of actions will it perform?
A.Step forward, Turn left, Beep, Step forward
B.Turn left, Step forward, Beep, Beep
C.Step forward, Turn left, Step forward, Beep
D.Beep, Step forward, Turn left, Step forward
Challenging
A program is downloading 100 data packets, numbered 1 to 100. It uses a loop with a variable `packets_received` that starts at 0 and increases by 1 for each packet that arrives. The loop continues `WHILE packets_received < 100`. If packet #84 is permanently lost and never re-sent, what will be the final state of the program?
A.The program will finish normally, but the file will be corrupt.
B.The program will detect the error and stop the loop when `packets_received` is 83.
C.The program will crash immediately when it realizes a packet is missing.
D.The program will be stuck in the loop forever, as `packets_received` will stop at 99 and never reach 100.
Challenging
You are designing a simple communication protocol (a set of rules) for two programs to share information reliably. Which set of rules is the most robust and complete?
A.Sender sends a packet. Receiver gets it, checks for errors, and sends back an 'OK' message. If Sender doesn't get 'OK', it resends.
B.Sender sends all packets at once as fast as possible. Receiver tries to catch them all.
C.Sender sends a packet. Receiver sends back the entire packet to prove it was received correctly.
D.Sender sends a packet and just assumes the Receiver got it, then sends the next one.
Want to practice and check your answers?
Sign up to access all questions with instant feedback, explanations, and progress tracking.
Start Practicing Free