Skip to the page
Year 11 · Computer Science · Autumn 2 · The internet and its uses

Exam questions and the scenario question

Exam practicePresent ▶

What this lesson covers

5.1 The internet and the World Wide Web

Cambridge IGCSE Computer Science 0478 · Topic 5: The internet and its uses · Paper 1

5.3 Cyber security

Cambridge IGCSE Computer Science 0478 · Topic 5: The internet and its uses · Paper 1

7.9 Writing and amending algorithms

Cambridge IGCSE Computer Science 0478 · Topic 7: Algorithm design and problem-solving · Paper 2

You will learn to

  • Answer past-paper questions on topic 5 within the time allowed.
  • Use the mark scheme to find the exact words that earn each mark.
  • Plan and write a scenario question answer, then mark it.

Success criteria

  • I can finish the topic 5 questions in the time given.
  • I can rewrite one lost-mark answer so it would earn full marks.
  • I can tick off each scenario requirement I met on the mark scheme.
The syllabus points for these sections
  • Explain the difference between the internet and the World Wide Web.
  • Identify the parts of a URL: protocol, domain name and web page/file name.
  • Explain the purpose of HTTP and HTTPS.
  • Describe the functions of a web browser.
  • Describe how a web page is located, retrieved and displayed, including the role of DNS.
  • Explain session and persistent cookies and their uses.
  • Describe each cyber security threat: brute-force attack, data interception, DDoS, hacking, malware, pharming, phishing and social engineering.
  • Describe the six types of malware: virus, worm, Trojan horse, spyware, adware and ransomware.
  • Explain how each security solution helps keep data safe.
  • Explain how proxy servers and SSL work.
  • Choose the best defence for a given threat and justify it.
  • Write algorithms precisely, with the exact comparison the problem needs.
  • Amend a given algorithm to do a new job.
  • Plan and answer a 15-mark scenario question.
  • Explain how the scenario question is marked.

Key words

Say each word, then read what it means. Every one is in the glossary too.

Internet
The worldwide network of connected computer networks: the physical infrastructure.
World Wide Web (WWW)
The collection of websites and web pages that are reached using the internet.
URL
Uniform resource locator: the text address of a web page, made of protocol, domain name and file name.
HTTP / HTTPS
The rules for sending web pages; HTTPS adds encryption using SSL.
Web browser
Application software that fetches web pages and renders HTML so you can see them.
DNS
Domain Name System: servers that find the IP address that matches a domain name.
IP address
A number that identifies a device on a network, such as 151.101.0.81.
Cookie
A small text file a website stores on your device to remember you.
Digital currency
Money that exists only electronically.
Brute-force attack
Trying every possible password or key until the right one is found.
DDoS
Distributed denial of service: flooding a server with requests from many computers so real users cannot reach it.
Malware
Software designed to cause harm, such as a virus, worm, Trojan horse, spyware, adware or ransomware.
Phishing
A fake message that tricks the user into clicking a link and giving personal details on a fake site.
Pharming
Malicious code or a tampered DNS server redirects the user to a fake website, even if they type the correct URL.
Social engineering
Manipulating people into breaking normal security rules.
Firewall
Hardware or software that checks traffic in and out against rules and blocks anything that breaks them.
Proxy server
A server between the user and the internet that filters requests, hides the user's IP address and caches pages.
SSL
Secure Sockets Layer: a protocol that uses certificates and encryption to secure data between browser and server.
Algorithm
A precise, ordered set of steps that solves a problem.
Program development life cycle
The four stages of making a program: analysis, design, coding and testing.
Structure diagram
A top-down diagram that shows how a system is split into sub-systems.
Pseudocode
A structured, code-like way of writing an algorithm that is not tied to one language.
Totalling
Adding values into a running total, for example Total ← Total + Value.
Counting
Adding 1 to a counter each time something happens.
Bubble sort
Sorting by comparing neighbouring items and swapping them if they are in the wrong order, pass after pass.
Validation
An automatic check that input data is reasonable and follows set rules.
Verification
A check that data has been copied or typed in exactly as the original.
Check digit
An extra digit calculated from the other digits, used to catch typing errors.
Normal data
Test data that should be accepted.

The explanation

Read it here, or open the study page below to go one step at a time with things to try.

5.1 The internet and the World Wide Web

The internet is not the same as the web

The internet is the physical network. It is millions of computers, cables, routers and wireless links joined together across the world. It is the infrastructure.

The World Wide Web (WWW) is a collection of websites and web pages stored on computers connected to the internet.

The web is one service that uses the internet. Email, online gaming and video calls also use the internet, but they are not the web.

InternetWorld Wide Web
What it isA global network of networks (hardware and connections)A collection of web pages and websites (information)
Made ofCables, routers, servers, wireless linksPages written in HTML, linked by hyperlinks
UsesWeb, email, video calls, file transfer, online gamesViewing web pages in a browser
ProtocolsTCP/IP and many othersHTTP and HTTPS
e.g.Example
Think of the Madrid Metro. The tunnels, tracks and stations are the internet. The trains carrying people to places are like services. The web is one line on that network; email is another.
!Watch out

Do not use the two words as if they mean the same thing. The internet is the network. The web is the pages.

The parts of a URL

A URL (uniform resource locator) is the text address of a web page. It is what you type into the address bar.

Cambridge splits a URL into three parts: the protocol, the domain name and the web page/file name.

The protocol is the set of rules used to transfer the page, such as `https`. The domain name names the web server, such as `www.bbc.co.uk`. The web page/file name is the exact page or file on that server, often with a folder path before it.

Part of the domainMeaning
wwwThis is a web server
bbcThe organisation's name
.co.ukTop-level part: a company in the UK (others: .com, .org, .es, .gov)
e.g.Example
https://www.bbc.co.uk/news/technology.html Protocol: https Domain name: www.bbc.co.uk Path (folder): /news/ Web page/file name: technology.html Try it in the toy: type this URL to see its parts. Then press Step to follow the DNS lookup and the request.
?Why?

People remember names far more easily than numbers. The URL is a human-friendly label; DNS later turns the domain name into the server's IP address.

!Watch out

The protocol is not "www". The protocol is the part before `://`, such as `http` or `https`.

There is something to try for this step in the IGCSE library.

HTTP and HTTPS

HTTP (Hypertext Transfer Protocol) is the set of rules for sending web pages between a web server and a browser.

HTTPS (Hypertext Transfer Protocol Secure) is HTTP with encryption added, using SSL/TLS. Encryption scrambles the data so that anyone who intercepts it cannot read it.

A browser shows a padlock in the address bar when HTTPS is used. You should only type passwords or card numbers on HTTPS pages.

?Why?

With plain HTTP, data travels as readable text. Someone on the same public Wi-Fi could read your password. HTTPS stops this.

!Watch out

HTTPS means the connection is encrypted. It does not prove the website is honest. A fake website can also use HTTPS.

What a web browser does

A web browser is application software that lets you find, fetch and view web pages. Examples are Chrome, Firefox, Safari and Edge.

Its main job is to render HTML: it reads the HTML code from the server and turns it into the page you see, with text, images and links.

Cambridge lists these other functions. Learn each one.

Browser functionWhat it does
Renders HTMLTurns HTML code into a visible web page
Bookmarks / favouritesSaves the URL of a page so you can go back to it in one click
HistoryKeeps a list of pages you have visited, with dates and times
TabsLets you open several pages in one browser window
CookiesStores small files from websites on your device
Navigation toolsBack, forward, refresh/reload and home buttons; clickable hyperlinks
Address barWhere you type or see the URL; often also works as a search box

How a web page is retrieved, step by step

Every web server has an IP address, a number that identifies it on the internet, such as `151.101.0.81`. Computers need this number to send data to each other.

People type a domain name, not a number. The Domain Name System (DNS) is a system of servers that look up the IP address for a domain name. It works like a phone book for the internet.

Follow the numbered arrows in the diagram, then read the steps.

e.g.Example
You type www.bbc.co.uk/news into the address bar. 1. The browser sends the domain name www.bbc.co.uk to a DNS server. 2. The DNS server looks up the matching IP address. If it does not know it, it asks another DNS server. 3. The DNS server sends the IP address back to the browser. 4. The browser sends an HTTP(S) request to the web server at that IP address, asking for the page. 5. The web server sends back the page's HTML (and files such as images). 6. The browser renders the HTML and shows the page.
?Why?

Splitting the job lets humans use names and computers use numbers. DNS servers also store recent lookups, so popular sites are found faster.

!Watch out

The DNS server does not send the web page. It only sends the IP address. The page comes from the web server.

There is a diagram for this step in the IGCSE library.

Cookies: session and persistent

A cookie is a small text file that a website stores on the user's device. The next time the browser visits that site, it sends the cookie back, so the site recognises the user.

A session cookie is temporary. It is kept in memory and deleted when the browser is closed.

A persistent cookie is saved on the device's storage. It stays until its expiry date or until the user deletes it. It remembers you between visits.

Session cookiePersistent cookie
How long it lastsUntil the browser is closedUntil its expiry date or until deleted
Where it is keptTemporary memory (RAM)Storage on the device (for example the SSD)
Typical useHolding items in a shopping cart during one visitStaying logged in, remembering language and preferences, tracking for adverts

What cookies are used for

Cambridge lists four main uses of cookies.

Saving personal details, such as your name and delivery address, so you do not retype them.

Tracking user preferences, such as language, dark mode or the pages you look at, so the site can be personalised and show targeted adverts.

Holding items in an online shopping cart while you keep browsing.

Storing login details, so you stay logged in when you return.

e.g.Example
On a supermarket website you add milk and bread to the cart, then go to another page. A session cookie keeps the cart full. Next week the site greets you by name and shows Spanish prices: that is a persistent cookie.
!Watch out

Cookies are not programs and cannot run code. They are data. The privacy worry is that persistent cookies can track your browsing, which is why sites must ask your permission in Spain and the UK.

5.3 Cyber security

Brute-force attack

A brute-force attack is when a criminal tries every possible password (or key) until one works. Software tries millions of guesses each second.

The aim is to get into an account or system, then steal data or cause harm.

Longer passwords with a mix of character types have far more possible combinations, so they take much longer to crack.

e.g.Example
A 4-digit PIN: 10 choices per digit. 10 × 10 × 10 × 10 = 10,000 possible PINs. An 8-character password using a–z, A–Z and 0–9: 62 choices per character. 62^8 = 218,340,105,584,896 possible passwords (about 218 million million).
?Why?

Each extra character multiplies the number of guesses needed. That is why length matters more than anything else.

!Watch out

Defences: long, complex passwords; locking the account after a few failed attempts; two-step verification.

Data interception

Data interception is when data is stolen while it is being sent, for example over Wi-Fi or across the internet.

A criminal can use a packet sniffer, a program that captures and examines data packets as they pass. On an unsecured public Wi-Fi network this is easy.

The aim is to read passwords, card numbers or private messages.

e.g.Example
In a café, someone on the same free Wi-Fi captures the packets from your laptop. If a website uses plain HTTP, they can read the password you typed.
!Watch out

Defences: encryption (HTTPS/SSL so captured data cannot be read); avoid public Wi-Fi for banking, or use a VPN; use strong Wi-Fi encryption at home.

Distributed denial of service (DDoS)

A denial of service (DoS) attack floods a web server with so many requests that it cannot cope. Real users cannot reach the website.

In a distributed DoS (DDoS), the requests come from thousands of computers at once. These are often ordinary devices infected with malware and controlled by the criminal. This group is called a botnet.

The aim is to take a website offline, often to cause loss of sales or to demand money.

e.g.Example
On the morning concert tickets go on sale, a botnet of 50,000 infected computers and cameras sends requests to the ticket website. The server is overloaded and real fans see an error page.
?Why?

Requests from so many different places are hard to block, because they look like normal visitors.

!Watch out

Defences: a proxy server or firewall that filters out the flood of traffic; anti-malware on your own devices so they do not join a botnet.

Hacking

Hacking is gaining unauthorised access to a computer system. Unauthorised means without permission.

A hacker may steal, change or delete data, or install malware. This is illegal in most countries.

Ethical hacking is different: a company pays an expert to try to break in, so weaknesses can be found and fixed.

!Watch out

Defences: firewalls, strong passwords and authentication, access levels, and keeping software updated so known weaknesses are fixed.

Malware: virus, worm and Trojan horse

Malware (malicious software) is any software written to cause harm. Cambridge lists six types. The first three spread or get in; the last three do specific damage.

TypeHow it worksExample of harm
VirusAttaches itself to a program or file. Needs a user to run that file. Then copies itself to other files.Deletes or corrupts files; makes the computer crash
WormA standalone program that copies itself across a network on its own. No user action needed.Uses up bandwidth and slows networks; can carry other malware
Trojan horseDisguised as useful, legitimate software. The user installs it willingly.Once installed, it lets in other malware such as spyware, or gives the criminal remote access
e.g.Example
A student downloads a free "game cheat" from an unknown site. It works, but it also installs spyware. That download was a Trojan horse.
!Watch out

Virus versus worm: a virus needs a host file and a user to run it. A worm spreads by itself across a network.

Malware: spyware, adware and ransomware

These three types are named after what they do once they are on a device.

TypeHow it worksExample of harm
SpywareSecretly records what the user does and sends it to the criminal. A keylogger records every key pressed.Steals passwords and bank details
AdwareShows unwanted adverts, often as pop-ups. May redirect the browser to advertising sites.Annoying, slows the device; some adware also contains spyware
RansomwareEncrypts the user's files so they cannot be opened. Demands payment for the key to unlock them.A hospital cannot open patient records until it pays or restores from backup
?Why?

Regular backups are the best answer to ransomware. If the files are backed up elsewhere, the victim can restore them without paying.

!Watch out

Defences for all malware: anti-malware software, automatic updates, not opening unknown attachments, downloading only from trusted sources.

Phishing and pharming

Phishing is sending a fake email or message that looks like it comes from a trusted organisation, such as a bank. It tries to make the user click a link to a fake website and type in their personal details.

Pharming is when malicious code is installed on the user's computer, or a DNS server is tampered with. It redirects the user to a fake website, even when they type the correct URL.

Both aim to steal login details, card numbers or other personal data.

PhishingPharming
How the user reaches the fake siteClicks a link in an email or textIs redirected automatically, even after typing the correct URL
Needs the user to click a link?YesNo
Main defenceCheck spelling, tone and URLs; do not click links in unexpected messagesAnti-malware; check the URL and padlock before entering details
e.g.Example
Phishing: a text says "Your Correos parcel is held. Pay 1.99 euros here" with a link to a fake site. Pharming: you type your bank's correct address, but malware on your PC sends you to a copy of the bank's site.
!Watch out

Learn the difference: phishing tricks you into clicking; pharming redirects you without you knowing.

Social engineering

Social engineering is manipulating people, rather than computers, into breaking security. It uses trust, fear, curiosity or urgency.

Phishing is one kind. Another is a phone call from someone pretending to be the IT department.

Baiting leaves a USB stick labelled "Salaries" in the car park, hoping someone plugs it in. Scareware is a fake pop-up saying "Your PC is infected, call now".

The aim is to get passwords, access to a building or system, or to get malware installed.

e.g.Example
A caller says: "Hi, it's Sam from IT. Your account is locked. Tell me your password and I'll fix it now." The caller is not from IT.
?Why?

People are often the weakest link. The best technical security fails if someone gives away a password.

!Watch out

Defence: training staff to be suspicious, never sharing passwords, checking who is really asking.

Solutions: access levels, anti-malware and authentication

Access levels give each user only the rights they need. A student can read the school timetable but cannot change it. This limits the damage if an account is hacked.

Anti-malware software includes anti-virus and anti-spyware. It scans files and compares them with a database of known malware. It quarantines or deletes anything harmful and checks downloads as they arrive.

Authentication proves a user is who they say they are.

Authentication methodHow it worksStrength / weakness
Username and passwordUser types a secret word or phraseEasy to use; can be guessed, stolen or brute-forced
BiometricsUses a body feature: fingerprint, face, iris, voiceHard to fake and cannot be forgotten; costly; cannot be changed if copied
Two-step verificationAfter the password, a second step: a code sent to your phone or an appA stolen password alone is not enough; needs the phone with you
?Why?

Anti-malware needs to update its database often, because new malware appears every day.

Solutions: updates, checking messages and links

Automating software updates means the OS and apps download and install fixes by themselves. Updates close security holes that hackers and malware use.

Checking the spelling and tone of communications helps spot phishing. Warning signs are spelling mistakes, a general greeting such as "Dear customer", and an urgent or threatening tone.

Checking URLs in links before clicking: hover over the link to see where it really goes. Look for misspellings such as `paypa1.com` or extra words such as `bbva-secure-login.net`.

e.g.Example
Email: "URGENT!! Dear costumer, your acount will be close in 24 hours. Click here." Red flags: spelling errors (costumer, acount), generic greeting, urgent threat. The link shows http://santander.verify-acc.ru when you hover. The domain is not the bank's real domain.

Solutions: firewalls and privacy settings

A firewall sits between a computer (or network) and the internet. It can be hardware, software or both.

It examines all traffic coming in and going out. It checks each packet against a set of rules, such as allowed IP addresses or ports. Traffic that breaks the rules is blocked.

It can also log traffic and warn the user when a program tries to connect to the internet.

Privacy settings control who can see your information, for example on social media. Setting a profile to "friends only" stops strangers seeing your location and photos, which social engineers use.

!Watch out

A firewall does not remove malware that is already on a computer. That is the job of anti-malware.

Solutions: proxy servers

A proxy server is a server that sits between the user's computer and the web server. Requests go to the proxy first, and the proxy fetches the page on the user's behalf.

It can filter requests, blocking access to certain websites. Schools use this to block unsuitable sites.

It hides the user's IP address, because the web server only sees the proxy's address. This protects the user's identity.

It can cache (store copies of) popular pages, so they load faster the next time.

In front of a web server, it can absorb and filter heavy traffic, helping to protect against DDoS attacks.

?Why?

Putting a middle step between the user and the internet means harmful traffic can be stopped before it reaches either side.

Solutions: SSL

SSL (Secure Sockets Layer) is a security protocol that encrypts data sent between a browser and a web server. Its modern version is called TLS, but the exam uses the name SSL.

It is what turns HTTP into HTTPS. It uses an SSL certificate: a digital document that proves the website is who it claims to be.

e.g.Example
How an SSL connection starts: 1. The browser asks the web server to identify itself. 2. The server sends a copy of its SSL certificate. 3. The browser checks the certificate is real and trusted. 4. If it is, the browser sends a message back to the server. 5. The server replies with a digitally signed acknowledgement to start the session. 6. All data sent from now on is encrypted.
?Why?

Even if the data is intercepted, it cannot be read. The certificate also helps the user know they are on the real website.

!Watch out

SSL protects data in transit (while it travels). It does not stop malware on your own computer or protect data stored on the server.

Matching threats to defences

Exam questions often give a scenario and ask you to name the threat and the best defence. Try the threats toy: read each scenario, name the threat, then pick the defence.

Always explain how the defence stops that threat. "Install a firewall" is a weak answer. "A firewall blocks incoming traffic that does not meet its rules" is stronger.

ThreatGood defences
Brute-force attackLong, complex passwords; lock after failed attempts; two-step verification
Data interceptionEncryption, SSL/HTTPS; avoid public Wi-Fi
DDoSProxy server; firewall; anti-malware so devices do not join a botnet
HackingFirewall; strong authentication; access levels; automatic updates
MalwareAnti-malware; automatic updates; do not open unknown attachments; backups for ransomware
PhishingCheck spelling, tone and URLs; do not click links in unexpected messages
PharmingAnti-malware; check the URL and SSL certificate before entering details
Social engineeringStaff training; privacy settings; never share passwords

There is something to try for this step in the IGCSE library.

7.9 Writing and amending algorithms

Be precise, and amend with care

An algorithm must say exactly what to do. 'More than 50' is `> 50`. '50 or more' is `>= 50`. These give different results for 50.

Set every total, counter, highest and lowest to a start value before the loop. Use meaningful names like `PassCount`, not `x`, and `//` comments.

An amend question asks you to change a given algorithm. Find the line that controls the behaviour and change only that line.

Example: to make the bubble sort give descending order (largest first), change `>` to `<` in the comparison.

Words in the questionPseudocode
over 18 / more than 18`Age > 18`
18 or over / at least 18`Age >= 18`
under 18 / less than 18`Age < 18`
between 1 and 21 inclusive`Days >= 1 AND Days <= 21`
not equal to -1`Value <> -1`
e.g.Example
7, 3, 9, 2, 5 sorted with the amended line: Output: 9, 7, 5, 3, 2
// Original: sorts into ascending order (smallest first)
IF Numbers[Index] > Numbers[Index + 1]

// Amended: sorts into descending order (largest first)
IF Numbers[Index] < Numbers[Index + 1]
numbers = [7, 3, 9, 2, 5]
top = 5
swap = True
while swap == True and top > 1:
    swap = False
    for index in range(top - 1):
        # amended: < instead of > gives descending order
        if numbers[index] < numbers[index + 1]:
            temp = numbers[index]
            numbers[index] = numbers[index + 1]
            numbers[index + 1] = temp
            swap = True
    top = top - 1
print(numbers)
?Why?

Rewriting the whole algorithm wastes time and can add new errors. The examiner is looking for the one or two key changes.

!Watch out

`Days >= 1 AND <= 21` is wrong. Write the variable on both sides: `Days >= 1 AND Days <= 21`.

The 15-mark scenario question: plan first

The last question on Paper 2 is a scenario worth 15 marks. Allow about 30 minutes. You may answer in pseudocode, Python, Visual Basic or Java.

Read the scenario twice. Underline every task. Make a numbered checklist and tick each item as you code it.

Sample scenario: a teacher records three tests for each of 30 students. Each test is out of 50. Names are already in `StudentName[1:30]`.

e.g.Example
Tasks in the sample scenario: 1. Input three marks per student and store them in StudentMark[1:30, 1:3]. 2. Validate each mark: 0 to 50. 3. Calculate and store each student's total in StudentTotal[1:30]. 4. Calculate each student's average, rounded to 1 decimal place. 5. Output each name with total and average. 6. Count and output the students with a total of 120 or more (a merit). 7. Output the class average total and the name of the student with the highest total. All inputs and outputs need suitable messages.
?Why?

Marks are given for meeting each requirement. A checklist stops you forgetting one, which is the most common way to lose marks here.

Model answer in pseudocode and Python

The model answer uses two nested `FOR` loops: one for students, one for tests. It reuses validation, totalling, counting, maximum and average.

Read the comments. They say what each part does, which also earns marks.

Python lists start at index 0, so the Python loops use `range(30)` and `range(3)`.

The first Python line is a stand-in for the names, so the program can run. In the exam you do not write it, because the names are already stored.

e.g.Example
If one student scores 45, 40 and 38: Total = 45 + 40 + 38 = 123. Average = 123 ÷ 3 = 41.0 123 >= 120, so MeritCount goes up by 1. If 123 is more than TopTotal, TopTotal becomes 123 and TopStudent becomes this student's index. Python sample run: Enter mark for test 1 for Student 1: 55 Error: a mark must be from 0 to 50. Enter it again: 31
// StudentName[1:30] already holds the 30 names
DECLARE StudentName : ARRAY[1:30] OF STRING
DECLARE StudentMark : ARRAY[1:30, 1:3] OF INTEGER
DECLARE StudentTotal : ARRAY[1:30] OF INTEGER
DECLARE Student : INTEGER
DECLARE Test : INTEGER
DECLARE Mark : INTEGER
DECLARE Total : INTEGER
DECLARE Average : REAL
DECLARE ClassTotal : INTEGER
DECLARE MeritCount : INTEGER
DECLARE TopTotal : INTEGER
DECLARE TopStudent : INTEGER

// set the class totals and counters to their start values
ClassTotal ← 0
MeritCount ← 0
TopTotal ← -1
TopStudent ← 1

FOR Student ← 1 TO 30
  Total ← 0
  FOR Test ← 1 TO 3
    // input one mark and validate it with a range check (0 to 50)
    OUTPUT "Enter mark for test ", Test, " for ", StudentName[Student]
    INPUT Mark
    WHILE Mark < 0 OR Mark > 50 DO
      OUTPUT "Error: a mark must be from 0 to 50. Enter it again"
      INPUT Mark
    ENDWHILE
    // store the valid mark and add it to this student's total
    StudentMark[Student, Test] ← Mark
    Total ← Total + Mark
  NEXT Test
  // store the total, work out the average and output the results
  StudentTotal[Student] ← Total
  Average ← ROUND(Total / 3, 1)
  OUTPUT StudentName[Student], " Total: ", Total, " Average: ", Average
  ClassTotal ← ClassTotal + Total
  // a total of 120 or more earns a merit
  IF Total >= 120
    THEN
      MeritCount ← MeritCount + 1
  ENDIF
  // remember the highest total so far and whose it is
  IF Total > TopTotal
    THEN
      TopTotal ← Total
      TopStudent ← Student
  ENDIF
NEXT Student

// whole-class results
OUTPUT "Class average total: ", ROUND(ClassTotal / 30, 1)
OUTPUT "Number of merits: ", MeritCount
OUTPUT "Highest total: ", StudentName[TopStudent], " with ", TopTotal
# The question says the names are already stored.
# This line is a stand-in so the program can run.
student_name = ["Student " + str(n) for n in range(1, 31)]
student_mark = [[0, 0, 0] for row in range(30)]
student_total = [0] * 30

# set the class totals and counters to their start values
class_total = 0
merit_count = 0
top_total = -1
top_student = 0

for student in range(30):
    total = 0
    for test in range(3):
        # input one mark and validate it with a range check (0 to 50)
        mark = int(input("Enter mark for test " + str(test + 1) + " for " + student_name[student] + ": "))
        while mark < 0 or mark > 50:
            mark = int(input("Error: a mark must be from 0 to 50. Enter it again: "))
        # store the valid mark and add it to this student's total
        student_mark[student][test] = mark
        total = total + mark
    # store the total, work out the average and output the results
    student_total[student] = total
    average = round(total / 3, 1)
    print(student_name[student], "Total:", total, "Average:", average)
    class_total = class_total + total
    # a total of 120 or more earns a merit
    if total >= 120:
        merit_count = merit_count + 1
    # remember the highest total so far and whose it is
    if total > top_total:
        top_total = total
        top_student = student

# whole-class results
print("Class average total:", round(class_total / 30, 1))
print("Number of merits:", merit_count)
print("Highest total:", student_name[top_student], "with", top_total)
?Why?

The Python version was run with 90 test marks, including invalid ones, to check it works. In Python, `round(total / 3, 1)` keeps one decimal place; `//` would cut off the decimals.

!Watch out

Store values in the arrays the question names. Calculating the total but not storing it in StudentTotal loses marks.

How the 15 marks are awarded

Recent mark schemes use levels, not one mark per line. AO2 (applying techniques and data structures) gives up to 9 marks. AO3 (comments, identifiers, logic and accuracy) gives up to 6 marks.

The examiner reads the whole answer and picks the band that fits best. Minor syntax errors are ignored if the logic is clear.

BandAO2: techniques and data structures (9)AO3: comments, names, accuracy (6)
Top7–9: all tasks covered with the right techniques; arrays store all the data5–6: fully commented, meaningful names, logical and accurate, meets all requirements
Middle4–6: some techniques suit the problem; some data stored correctly3–4: some comments, most names sensible, most requirements attempted
Low1–3: at least one technique used; some data stored, not well1–2: no useful comments, some sensible names, at least one requirement attempted
e.g.Example
The model answer reaches the top bands because it: - inputs with messages and validates every mark (input, iteration, selection) - stores marks in the 2D array and totals in StudentTotal (data structures) - uses totalling, counting, maximum, average and ROUND - outputs every result with a message - has a comment for every section and meaningful names like MeritCount
?Why?

Because marks come in bands, a working answer to every task beats a perfect answer to half of them. Attempt every requirement, even if one part is rough.

Study it

Open the study page and go one step at a time.

Check yourself

One question at a time. The reason shows after each answer.

Saved on this device.