Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

📝 Knowledge Test

/
Knowledge Test Score Board
· 0%

Work through the questions below — your score updates as you go.

Keep going · grade bands mapped to DCU's honours scale

target20:00

Only your first attempt at each question counts toward this score. Reload the page to reset.

This section contains 20 interactive knowledge checks designed to test your understanding of the materials covered in Chapter 11. The questions cover TCP/IP fundamentals, network socket programming in Rust using TcpListener and TcpStream, building robust client-server architectures, and an introduction to advanced protocols like MQTT and HTTP for the IoT Edge.

Please remember that many of the quizzes have multiple correct answers, and you must select all applicable options to succeed. I have carefully balanced the lengths of the answers, so take your time to evaluate each option thoroughly.

Good luck!

Derek.


Part 1: Networking Fundamentals for the Edge

Section titled “Part 1: Networking Fundamentals for the Edge”
Q1
Concept Match

Match the Networking Layers

Drag each definition into its matching concept slot, then click Submit. Tap × to return a placed card to the pool.

IP Address
drag a definition here…
Port Number
drag a definition here…
TCP
drag a definition here…
UDP
drag a definition here…

Definition Pool

A connectionless protocol prioritising speed and low overhead over guaranteed reliability.
A connection-oriented protocol that ensures reliable, ordered, and error-checked delivery.
A 16-bit integer used to identify specific processes or services on a single device.
A unique numerical label assigned to each device connected to a computer network.
Q2
Quiz
Select 0/2

Why is TCP generally preferred over UDP for critical control applications on edge devices, such as industrial PLC units?

Because TCP includes built-in flow control to prevent a fast sender from overwhelming a slower receiver.
Because TCP automatically handles packet retransmission and ensures that data arrives in the correct sequence.
Because TCP provides a smaller binary footprint, which is essential for devices with extremely limited flash memory.
Because TCP uses a stateless architecture that allows it to operate without a permanent network connection.
Q3
Quiz
Select 0/2

Regarding network 'Sockets', which of the following statements accurately describes their role in software development?

They are restricted to communicating only between different physical machines across a local area network.
They represent the software endpoint of a bidirectional communication link between two programs.
They are physical hardware connectors found on the motherboard of high-performance edge gateways.
They are defined by the combination of an IP address and a 16-bit port number (e.g., 127.0.0.1:8080).
Q4
Code Cloze
Rust

Localhost and Loopback

Drag snippets from the pool into the blanks so the program produces the output shown, then click Submit.

1fn main() {
2 // The standard 'loopback' address for testing on the same machine
3 let local_addr = "·····";
4
5 // A common port number for development servers
6 let port = "·····";
7
8 let socket_addr = format!("{}:{}", local_addr, port);
9}

Available Snippets

80
192.168.1.1
8080
127.0.0.1
localhost
0.0.0.0
Q5
Concept Match

Match the Rust Networking Types

Drag each definition into its matching concept slot, then click Submit. Tap × to return a placed card to the pool.

TcpListener
drag a definition here…
TcpStream
drag a definition here…
incoming()
drag a definition here…
io::Error
drag a definition here…

Definition Pool

An iterator that yields new connection attempts as they arrive at the listener.
The error type returned by networking operations, covering timeouts and broken pipes.
A structure that binds to a port and waits for incoming connection requests.
Represents a single active connection, allowing for bidirectional data transfer.
Q6
Code Output
Rust

Predict the output: Binding to a Port

Read the code below, then choose the terminal output it produces and click Submit.

1use std::net::TcpListener;
2
3fn main() {
4 // Attempt to listen on port 80 (requires admin/root)
5 match TcpListener::bind("127.0.0.1:80") {
6 Ok(_) => println!("Success"),
7 Err(e) => println!("Error: {}", e.kind()),
8 }
9}
stdout
Success
stdout
Error: PermissionDenied
stdout
Error: ConnectionRefused
stdout
Error: NotFound
Q7
Quiz
Select 0/2

When using the listener.incoming() iterator, what exactly is yielded for each successful connection?

A TcpStream object representing the active communication channel.
The client's IP address and port number as a formatted String.
A Result type that must be unwrapped to handle potential connection failures.
A raw byte buffer containing the initial packet data from the client.
Q8
Code Cloze
Rust

Writing to a Network Stream

Drag snippets from the pool into the blanks so the program produces the output shown, then click Submit.

1use std::io::Write;
2use std::net::TcpStream;
3
4fn main() -> std::io::Result<()> {
5 let mut stream = TcpStream::connect("127.0.0.1:8080")?;
6
7 let message = "Status: OK";
8 // Convert the string to a byte slice and send it
9 stream.·····(message.·····())?;
10
11 Ok(())
12}

Available Snippets

as_bytes
to_string
send
into_bytes
write_all
push
Q9
Quiz
Select 0/2

In a typical edge sensor network, which entity usually assumes the 'Server' role?

The cloud-based database that stores historical readings for long-term analysis.
The individual battery-powered sensor node waiting for a command to sample data.
The central gateway or desktop dashboard that 'listens' for incoming data packets.
The network router that manages the IP address allocation via DHCP.
Q10
Code Order
Rust

The TCP Server Lifecycle

Drag the tiles to arrange the code in the correct order, then click Submit. Locked lines stay in place. Indentation is dynamically applied based on the location of braces.
let listener = TcpListener::bind("127.0.0.1:8080").unwrap();
for stream in listener.incoming() {
stream.write_all(b"ACK").unwrap();
stream.read(&mut buffer).unwrap();
let mut stream = stream.unwrap();
let mut buffer = [0; 512];
}
Q11
Quiz
Select 0/2

Why is it crucial to spawn a new thread (or use async tasks) for each incoming connection in a production TCP server?

Because the Rust standard library requires a thread-per-connection for memory safety verification.
To allow the server to utilise multiple CPU cores for processing independent client requests in parallel.
To prevent a single slow client from blocking the main listener loop and stalling other incoming connections.
To ensure that the client's IP address is correctly registered in the system's global routing table.
Q12
Code Cloze
Rust

Concurrent Connection Handling

Drag snippets from the pool into the blanks so the program produces the output shown, then click Submit.

1for stream in listener.incoming() {
2 let stream = stream.unwrap();
3 // Offload each connection to its own thread
4 std::thread::·····(····· || {
5 handle_client(stream);
6 });
7}

Available Snippets

ref
spawn
create
move
run
async

Part 4: Data Transmission and Serialisation

Section titled “Part 4: Data Transmission and Serialisation”
Q13
Concept Match

Match the Data Representation

Drag each definition into its matching concept slot, then click Submit. Tap × to return a placed card to the pool.

Plain Text
drag a definition here…
Binary
drag a definition here…
JSON
drag a definition here…
Endianness
drag a definition here…

Definition Pool

Compact, efficient data representation (e.g., raw structs) ideal for bandwidth-limited radio links.
Human-readable data (e.g., CSV or custom strings) easy to debug but higher overhead.
The byte order (Big vs Little) used to represent multi-byte values in a binary stream.
A popular text-based format for structured data, widely supported by web APIs.
Q14
Quiz
Select 0/1

Which crate is the 'gold standard' for serialising and deserialising Rust data structures for network transmission?

tokio
anyhow
cargo
serde
Q15
Quiz
Select 0/1

In binary networking, why is 'Network Byte Order' (Big-Endian) historically significant?

Because it provides a standard, consistent way to represent numbers across systems with different native architectures.
Because it is the only format supported by the standard Rust i32 and f64 types.
Because it was the native format of the original 8-bit Intel processors used in the first edge sensors.
Because it automatically compresses the data by 50% during transmission across wireless links.
Q16
Code Cloze
Rust

Safe Buffer Initialisation

Drag snippets from the pool into the blanks so the program produces the output shown, then click Submit.

1fn handle_read(mut stream: TcpStream) {
2 // Create an empty byte buffer of 1024 bytes
3 let mut buffer = [·····; 1024];
4
5 // Read data from the stream into the buffer
6 let bytes_read = stream.·····(&mut buffer).unwrap();
7
8 // Convert the received bytes into a UTF-8 string slice
9 let msg = std::str::from_utf8(&buffer[..·····]).unwrap();
10}

Available Snippets

recv
len
0
1024
u8
bytes_read
read

Part 5: Advanced Networking and IoT Protocols

Section titled “Part 5: Advanced Networking and IoT Protocols”
Q17
Concept Match

Match the IoT Protocols

Drag each definition into its matching concept slot, then click Submit. Tap × to return a placed card to the pool.

HTTP
drag a definition here…
MQTT
drag a definition here…
WebSocket
drag a definition here…
CoAP
drag a definition here…

Definition Pool

A protocol providing full-duplex, persistent communication over a single TCP connection.
A specialised protocol for restricted nodes and networks, similar to HTTP but over UDP.
A lightweight publish-subscribe protocol ideal for low-power sensors and unreliable networks.
A request-response protocol primarily used for web services and large document transfers.
Q18
Quiz
Select 0/2

What is the primary benefit of the 'Publish-Subscribe' model used in MQTT compared to traditional HTTP?

It requires every device to have a public IP address to receive incoming notifications.
It forces devices to stay awake and connected at all times, ensuring 100% data reliability.
It decouples data producers from consumers, allowing for extremely efficient one-to-many communication.
It provides a way for low-power sensors to receive data without knowing the specific identity of the sender.
Q19
Quiz
Select 0/2

Why is 'Asynchronous Networking' (e.g., using the Tokio crate) preferred for high-concurrency edge gateways?

Because it enables a single OS thread to handle thousands of active connections by yielding during I/O wait times.
Because it is the only way to send data over encrypted TLS channels in the Rust ecosystem.
Because it eliminates the memory overhead of maintaining thousands of separate OS thread stacks.
Because it allows the CPU to run significantly faster by bypassing the standard hardware interrupt system.
Q20
Quiz
Select 0/1

In a bare-metal (#![no_std]) environment like an ESP32 microcontroller, how is networking typically handled?

By running a full Linux kernel in a background task to provide the necessary socket support.
By using the standard library's std::net module, which is fully compatible with all wireless chips.
By utilising specialised crates like 'embedded-nal' (Network Abstraction Layer) and vendor-specific HALs.
By bypassing the IP stack entirely and manually toggling the radio antenna pins at high frequency.

Congratulations on completing the Chapter 11 Knowledge Test! Review any questions you missed to ensure a solid grasp of Rust networking and client-server communication before exploring the final chapters on resource management and optimization.