Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to identify the protocol used for communication.
HLD
if message.protocol == '[1]': process_http(message)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing HTTP with FTP or SMTP protocols.
✗ Incorrect
The code checks if the message protocol is HTTP to process it accordingly.
2fill in blank
mediumComplete the code to select the right protocol for secure data transfer.
HLD
if use_encryption: protocol = '[1]' else: protocol = 'HTTP'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing FTP or TCP which are not secure by default.
✗ Incorrect
HTTPS is the secure version of HTTP, used for encrypted data transfer.
3fill in blank
hardFix the error in the protocol check to avoid runtime failure.
HLD
if message.protocol == [1]: process_message(message)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted protocol names causing syntax errors.
✗ Incorrect
The protocol name must be a string literal, so it needs quotes.
4fill in blank
hardFill both blanks to correctly define a protocol handler function.
HLD
def handle_[1](message): if message.protocol == '[2]': process_[1](message)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing case between function name and protocol string.
✗ Incorrect
The function name uses lowercase 'http' while the protocol string is uppercase 'HTTP'.
5fill in blank
hardFill all three blanks to create a dictionary mapping protocols to ports.
HLD
protocol_ports = {
'[1]': [2],
'[3]': 443
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing port numbers or protocol names.
✗ Incorrect
HTTP uses port 80 and HTTPS uses port 443 for secure communication.