Network protocols

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Network protocols

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What is a protocol?
A An agreed set of rules devices follow to communicate
B A type of cable that connects devices
2. Which protocol is used to send web pages?
A USB
B HTTP
3. Two devices want to communicate. What must be true about the protocol?
A Each device can use a different protocol
B Both devices must use the same protocol
4. Which is the best comparison for a protocol?
A A shared language that both people speak
B A faster battery for your device
5. Your browser asks a web server for a page. Which rules does it follow?
A HTTP
B RAM

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1HTTP AAn agreed set of rules that devices follow so they can communicate with each other
2protocol BA protocol is not a piece of hardware. It is an agreed set of rules that devices follow to communicate.
3Both devices must use the same protocol to understand each other Cprotocols = [HTTP, Bluetooth, Wi-Fi]
4Examples of protocols include HTTP for web pages and Bluetooth for short-range transfer DThe two devices use different rules, so they cannot understand each other. Both must use the same protocol, such as HTTP.
5browser: HTTP <-> server: a different protocol Ebrowser: HTTP <-> server: HTTP
6protocol = a type of cable FThe protocol (set of rules) that web browsers and web servers follow to send and receive web pages

Definitions

protocol

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
________ = "HTTP" print(protocol)
2.
url = "____://www.example.com"
3.
laptop = "HTTP" server = "HTTP" print(laptop __ server)
4.
protocols = ["HTTP", "FTP", "SMTP"] print(len(_________))
5.
def send(data, ________): print("Sending using", protocol)

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A protocol = HTTP
B device_a = 'browser'
C device_b = 'web server'
D print(device_a, protocol)
Question 2
A def send(protocol):
B if protocol = 'HTTP':
C return 'web page'
D return 'unknown'
Question 3
A browser = 'HTTP'
B server = 'HTTP'
C if browser == server:
D print('They cannot talk')
Question 4
A protocols = ['HTTP', 'FTP']
B for p in protocol:
C print(p)
Question 5
A web = 'HTTP
B email = 'SMTP'
C files = 'FTP'
D print(web, email, files)

Answer Key

Network protocols
Section A: Quick Questions
Q1
A — An agreed set of rules devices follow to communicate
Q2
B — HTTP
Q3
B — Both devices must use the same protocol
Q4
A — A shared language that both people speak
Q5
A — HTTP
Section B: Match the Pairs
Q1
HTTP → The protocol (set of rules) that web browsers and web servers follow to send and receive web pages
Q2
protocol → An agreed set of rules that devices follow so they can communicate with each other
Q3
Both devices must use the same protocol to understand each other → browser: HTTP <-> server: HTTP
Q4
Examples of protocols include HTTP for web pages and Bluetooth for short-range transfer → protocols = [HTTP, Bluetooth, Wi-Fi]
Q5
browser: HTTP <-> server: a different protocol → The two devices use different rules, so they cannot understand each other. Both must use the same protocol, such as HTTP.
Q6
protocol = a type of cable → A protocol is not a piece of hardware. It is an agreed set of rules that devices follow to communicate.
Section C: Definitions
Q1
protocol — An agreed set of rules that devices follow so they can communicate, like HTTP for web pages. Both devices must use the same protocol to understand each other.
Section D: Fill in the Blanks
Q1
protocol = "HTTP" print(protocol)
Q2
url = "http://www.example.com"
Q3
laptop = "HTTP" server = "HTTP" print(laptop == server)
Q4
protocols = ["HTTP", "FTP", "SMTP"] print(len(protocols))
Q5
def send(data, protocol): print("Sending using", protocol)
Section E: Spot the Error
Q1
A — HTTP is text, so it must be in quotes. Without them Python looks for a variable called HTTP. It should be protocol = 'HTTP'.
Q2
B — A single = assigns a value. Comparing two values needs ==. It should be if protocol == 'HTTP':.
Q3
D — Both devices use HTTP, so they follow the same rules and can communicate. The message should be print('They can talk').
Q4
B — The list is called protocols, not protocol. Looping over an undefined name causes an error. It should be for p in protocols:.
Q5
A — The string is missing its closing quote. It should be web = 'HTTP'.