Skip to content
Book 5: Computer Systems

Book 5 · Chapter 5

The internet and its uses

§5.1§5.2§5.3Banker · ≈ 14.9 m · →B5·5

This chapter is in the ebook.

Read it in full on cswithzak.com. Every question has its mark scheme and every program is ready to run. The free practice for each section is below, with the short code the book prints beside it.

Open in the ebook

For the whole chapter

§5.1 The internet and the world wide web

Short code B5·5·1

§5.2 Digital currency

Short code B5·5·2

§5.3 Cyber security

Short code B5·5·3

The internet and the world wide web

Short code B5·5·10

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

URLs: the address of a web page

Short code B5·5·11

url = "https://www.crumbs-bakery.example/cakes/menu.html"
protocol, rest = url.split("://")
parts = rest.split("/")
print("Protocol:", protocol)
print("Domain name:", parts[0])
print("Path:", "/".join(parts[1:-1]))
print("File name:", parts[-1])
Splitting the bakery's URL into its parts. Notice the separators: :// after the protocol, then / between the domain name, the folders and the file name.

Output

Protocol: https
Domain name: www.crumbs-bakery.example
Path: cakes
File name: menu.html
Run and checked before printing

HTTP and HTTPS

Short code B5·5·12

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

The web browser

Short code B5·5·13

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Finding a web page: the DNS

Short code B5·5·14

local_dns = {"www.school.example": "192.0.2.7"}
other_dns = {"www.crumbs-bakery.example": "192.0.2.15"}
name = "www.crumbs-bakery.example"
if name in local_dns:
    ip = local_dns[name]
else:
    print("Not found here: asking another DNS")
    ip = other_dns[name]
print("IP address sent to the browser:", ip)
A model of the DNS as lookup tables. The first DNS does not hold the domain name, so the request is passed to a second DNS, and the IP address goes back to the browser.

Output

Not found here: asking another DNS
IP address sent to the browser: 192.0.2.15
Run and checked before printing

Cookies

Short code B5·5·15

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Digital currency

Short code B5·5·16

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Blockchain

Short code B5·5·17

Output

Block 1 | previous 00000000 | hash 96635438
Block 2 | previous 96635438 | hash 7790b4b1
Block 3 | previous 7790b4b1 | hash e5e34bc6
Block 2 changed: new hash 27500eef
Block 3 still stores 7790b4b1
Chain valid? False
Run and checked before printing

Threats: brute force and data interception

Short code B5·5·18

from itertools import product
secret = "CB"
attempt = 0
for letters in product("ABC", repeat=2):
    guess = "".join(letters)
    attempt = attempt + 1
    print(attempt, guess, guess == secret)
    if guess == secret:
        break
The brute-force trace: every two-letter code from A, B and C, tried in order until the secret is found.

Output

1 AA False
2 AB False
3 AC False
4 BA False
5 BB False
6 BC False
7 CA False
8 CB True
Run and checked before printing
for length in (4, 6, 8):
    print(length, "digits:", 10 ** length, "PINs")
total = 62 ** 8
print("8 characters (a-z, A-Z, 0-9):", total)
print("Days at a million guesses a second:", total // 1000000 // 86400)
How many passwords a brute-force attack may have to try. Each extra character multiplies the total; the last line assumes a million guesses every second.

Output

4 digits: 10000 PINs
6 digits: 1000000 PINs
8 digits: 100000000 PINs
8 characters (a-z, A-Z, 0-9): 218340105584896
Days at a million guesses a second: 2527
Run and checked before printing

Threats: DDoS attacks and hacking

Short code B5·5·19

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Threats: malware

Short code B5·5·20

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Threats: phishing, pharming and social engineering

Short code B5·5·21

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Keeping data safe: people and passwords

Short code B5·5·22

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Keeping data safe: software and networks

Short code B5·5·23

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Matching threats to solutions

Short code B5·5·24

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Workbook: The internet and its uses

Short code W5·5 · Computer Systems Workbook

The write-in workbook for this chapter has drills, exam-style practice, trace tables, fix-the-mistake and mark-it-yourself pages. Its full mark schemes and an interactive version arrive here with the chapter.

Ask Z about The internet and its uses
Buy ZAK's books — WhatsApp the books desk: Buy the booksPrint or ebook