Skip to content

← Final exam model papers

Final Exam Model Paper 7

Theory paper: 50 marksTime: 2 hours

Practical exam: 25 marksTime: 1 hour 30 minutes

All questions are compulsory.

A full practice run of the Grade 8 final exam: the theory paper (50 marks, 2 hours) and, below it, the practical exam (25 marks, 1 hour 30 minutes, at a computer, marked by the school). In the theory paper, work out on paper what each program does, as in the exam hall: its programs have no Run button. In the practical exam, the programs run on this page.

A practice paper by Science Playground, made to its own course’s grid; not an official exam paper.

Write your answers on paper first. Then open each answer and its marking scheme, and give yourself one mark for each point you got. In multiple choice, your first choice counts.

Section A

10 × 1 = 10

1. Choose the correct option for each of the following questions.

a.

A bus company charges Rs 50 for each bag on the roof. The ticket seller’s program starts:

bags = input("How many bags? ")

Karuna types 2. What type is the value in bags?

Pick an answer to see why.

b.

On a smoky winter day in Birgunj, an air-quality monitor reads 160. What does this program print?

aqi = 160if aqi > 300:    print("Hazardous")elif aqi > 150:    print("Unhealthy")elif aqi > 100:    print("Unhealthy for some people")else:    print("Good")

Pick an answer to see why.

c.

Sapana’s binary search of 15 sorted bus numbers has the bug while low < high: instead of while low <= high:. She can run one test. Which one is most likely to show the bug?

Pick an answer to see why.

d.

Which element gives words emphasis, so that a browser usually shows them in italics?

Pick an answer to see why.

e.

A hotel in Lumbini wants a photo of the Maya Devi Temple from Wikimedia Commons for a paid advertisement in a magazine, cropped to fit the space. Under which license may it use the photo, with credit?

Pick an answer to see why.

f.

A micro:bit at a bus stop in Butwal lights a line of LEDs when the bus is near. It runs:

for y in range(5):    display.set_pixel(2, y, 9)

What does the display show?

Pick an answer to see why.

g.

Last month Bimal took a photo of his bus ticket from Butwal, to claim the fare back from his school. Now he can’t find it among 4,000 photos called names like IMG_4521.jpg. What is the quickest way to find it?

Pick an answer to see why.

h.

A hotel association shows a line chart of visitors to Lumbini over five years: they rose from 900 to 1,000 a day. The chart is drawn very tall and narrow, so the line looks like a cliff. A newspaper writes, “Visitors to Lumbini have shot up!” Which judgment is right?

Pick an answer to see why.

i.

In 2023, a judge in New York fined two lawyers and their firm US$5,000. What had they done?

Pick an answer to see why.

j.

Pictures made by image generators used to show hands with six fingers, and signboards with letters that spell nothing. Why?

Pick an answer to see why.

Section B

8 × 1 = 8

2. Write very short answers to the following questions.

a.

Which symbol starts a comment in Python?

Answer

#: Python ignores everything after it on that line, as in # work out the fare.

Marking scheme
  • #.
b.

Which keyword sends a value back from a function to the line that called it?

Answer

return, as in return total.

Marking scheme
  • return.
c.

Give one reason why a video shared online should have captions.

Answer

Any one: they help people who are deaf or hard of hearing; people watching with the sound off, in a noisy bus or a quiet room; and people who understand written words better than spoken ones.

Marking scheme
  • One correct reason (deaf viewers, sound off, or reading is easier).
d.

Why are Arduino projects usually built on a breadboard?

Answer

A breadboard’s holes are joined in rows underneath, so parts and wires can be pushed in, connected and moved without soldering: easy to try, change and take apart.

Marking scheme
  • Parts can be connected and moved without soldering.
e.

Write one CSS rule that puts the main heading of a health post’s page in the middle of its line.

Answer
h1 {  text-align: center;}
Marking scheme
  • h1 { text-align: center; }.
f.

Bimal films a 20-second clip of a peace walk in Lumbini on a phone that films 30 frames a second. How many frames (pictures) does the clip have?

Answer

30 frames a second × 20 seconds = 600 frames.

Marking scheme
g.

This program should add up the passengers who get on a bus at its 5 stops between Butwal and Bhairahawa. For 12, 3, 7, 0 and 5 passengers it prints Passengers: 5. Which line is wrong, and what should it be?

total = 0for stop in range(5):    getting_on = int(input("Passengers getting on: "))    total += 1print("Passengers:", total)
Answer

Line 4 adds 1 at each stop, so it counts the stops, not the passengers. It should add the number typed: total += getting_on (or total = total + getting_on). Then it prints Passengers: 27.

Marking scheme
  • Line 4, which should be total += getting_on.
h.

Sonam wants a chatbot to help with her math homework. One chatbot gives the full answers; another gives only hints and asks her to try each step. Which should she choose? Give one reason.

Answer

The one that gives only hints. The homework is practice for doing math herself: in a study in Türkiye, students who practiced with a chatbot that gave answers did 17% worse in the test without it than students who never had it, while a version that gave only hints did no harm.

Marking scheme
  • Hints, with a reason: she must learn to do it herself (answers leave students worse in a test without the chatbot).

Section C

8 × 2 = 16

Write short answers to the following questions.

3.
[2]

A health worker in Rupandehi counts the children vaccinated in the morning, then adds the 3 who came after lunch:

children = 14children + 3print("Children vaccinated:", children)

It printed Children vaccinated: 14.

  • i.Why didn’t the count go up to 17?
  • ii.Rewrite line 2 so that it does.
Answer
  • i.Line 2 works out 14 + 3, but doesn’t store the answer anywhere, so it is thrown away: children still holds 14. Only = changes what a variable holds.
  • ii.Store the answer back in the variable:
children = 14children = children + 3print("Children vaccinated:", children)

Output

Children vaccinated: 17
Marking scheme
  • i. Line 2 works out the sum but doesn’t store it, so children is unchanged.
  • ii. children = children + 3.
4.
[2]

In Jestha, the afternoon temperature in Lumbini often reaches 35 °C. A visitor from America wants it in degrees Fahrenheit.

c = 35f = c * 9 / 5 + 32print(c, "°C is", f, "°F")
  • i.Write the output of the program.
  • ii.Why does it print a decimal point in one number and not in the other?
Answer

i. 35 × 9 = 315, ÷ 5 = 63.0, + 32 = 95.0:

Output

35 °C is 95.0 °F

ii. c is the int 35, as it was written. But / always gives a float, even when the answer is whole, so f is the float 95.0.

Marking scheme
  • i. 35 °C is 95.0 °F.
  • ii. / always gives a float, while c is an int.
5.
[2]

A health post charges Rs 50 a visit, free for children under 5. Its program:

def fee(age):    if age < 5:        return 0    return 50 def family_fee(a, b, c):    return fee(a) + fee(b) + fee(c) print(family_fee(3, 35, 8))
  • i.Write the output.
  • ii.How does family_fee get its answer? Why is it better to write it this way than to copy the if three times?
Answer

i. fee(3) is 0, fee(35) is 50 and fee(8) is 50, so family_fee returns 0 + 50 + 50:

Output

100

ii. It calls fee once for each person and adds the three returned values. The rule for one person is written once, in one place: if the fee changes, only fee changes, and every program that uses it is right at once. It is also shorter and easier to read and test.

Marking scheme
  • i. 100.
  • ii. It calls fee for each person and adds the returned values; the rule is written once, so it is easier to change, read and test.
6.
[2]

A bus company in Rupandehi charges Rs 3 a kilometer, but never less than Rs 30. Write a function bus_fare(km) that returns the fare, and use it to print the fares for 6 km and for 40 km.

Answer
def bus_fare(km):    fare = km * 3    if fare < 30:        fare = 30    return fare print(bus_fare(6))print(bus_fare(40))

Output

30120
Marking scheme
  • A function bus_fare with the parameter km that returns 3 a kilometer, but 30 when that is less than 30.
  • Calls for 6 and 40 that print the returned fares (30 and 120).
7.
[2]

In a video about Lumbini, a guide says “Welcome to Lumbini, where the Buddha was born” from 5 to 9 seconds, and “This is the Maya Devi Temple” from 10 to 13 seconds. Write the SRT caption file for these two lines.

Answer

lumbini.srt

100:00:05,000 --> 00:00:09,000Welcome to Lumbini, where the Buddha was born. 200:00:10,000 --> 00:00:13,000This is the Maya Devi Temple.
Marking scheme
  • Each caption with its number, then its start and end times in the form 00:00:05,000 --> 00:00:09,000.
  • The words of each caption under its times, and an empty line between the two.
8.
[2]

A level crossing’s warning lamp is run by an Arduino:

Lamp.ino

void setup() {  pinMode(LED_BUILTIN, OUTPUT);} void loop() {  digitalWrite(LED_BUILTIN, HIGH);  delay(500);  digitalWrite(LED_BUILTIN, LOW);  delay(500);}
  • i.When does setup() run, and when does loop() run?
  • ii.In a micro:bit program written in Python, what does the same job as loop(), and what does the job of delay(500)?
Answer
  • i.setup() runs once, when the board starts (here it makes the lamp’s pin an output). loop() then runs again and again, forever, flashing the lamp.
  • ii.while True: does the job of loop(), and sleep(500) (wait 500 ms) does the job of delay(500).
Marking scheme
  • i. setup() once at the start; loop() again and again forever.
  • ii. while True: and sleep(500).
9.
[2]

Data about you is collected for three different reasons. Name them, with an example of each.

Answer
  • Needed for the job: a delivery needs your address.
  • Asked for by law: a bank must check who its customers are.
  • Extra: collected because it can earn money, mostly from advertising, such as what you watch and search for in a free app.
Marking scheme
  • Any two of the three reasons, each with an example.
  • The third reason, with an example.
10.
[2]

A big hotel in Lumbini wants an AI app to choose which job applicants it interviews. The app learned from the hotel’s past staff, who were nearly all men. Judge this plan.

Answer

It is unfair, and risky. An AI that learned from one-sided data repeats the unfairness in it: having seen nearly only men hired, it is likely to rank women lower, though they could do the job just as well, and nobody can easily see why it ranked anyone as it did. People should decide who is interviewed, by the job’s needs; if a tool helps sort applications, its results must be checked for unfairness.

Marking scheme
  • Unfair: it learned from one-sided data (mostly men) and will repeat that, ranking women lower.
  • People should decide, by the job’s needs, and check any tool’s results.

Section D

4 × 4 = 16

Write long answers to the following questions.

11.
[4]

At the Maya Devi Temple in Lumbini, a guard counts the tour groups that come in. He wants a program that asks for the number of visitors in each group, until he types 0 at closing time, and then prints how many groups came, how many visitors in all, the biggest group, and the average size of a group (only if at least one group came).

  • i.Write the program. (3)
  • ii.What does your program print if the guard types 0 for the very first group? Why does that matter for the average? (1)
Answer

i.

groups = 0visitors = 0biggest = 0size = int(input("Visitors in this group (0 to stop): "))while size != 0:    groups = groups + 1    visitors = visitors + size    if size > biggest:        biggest = size    size = int(input("Visitors in this group (0 to stop): "))print("Groups:", groups)print("Visitors:", visitors)if groups > 0:    print("Biggest group:", biggest)    print("Average group:", visitors / groups)

For groups of 12, 40, 5 and 23:

Output

Visitors in this group (0 to stop): 12Visitors in this group (0 to stop): 40Visitors in this group (0 to stop): 5Visitors in this group (0 to stop): 23Visitors in this group (0 to stop): 0Groups: 4Visitors: 80Biggest group: 40Average group: 20.0

ii. The loop never runs, so it prints Groups: 0 and Visitors: 0, and nothing more. Without the if groups > 0: check, it would work out 0 ÷ 0 for the average, which is impossible: Python would stop with an error.

Marking scheme
  • i. A while loop that asks for each group’s size with int(input(…)) and stops at 0.
  • i. A counter of groups and a running total of visitors, both starting at 0 before the loop.
  • i. The biggest so far, and the average (visitors ÷ groups) printed only when at least one group came.
  • ii. Groups 0 and visitors 0 only, because the average check stops a division by 0.
12.
[4]

A health post in Rupandehi weighed six newborn babies, in kilograms. The weights are in a list, positions 0 to 5:

Position 0 1 2 3 4 5
Weight (kg) 3.2 2.8 3.5 2.6 3.0 2.9
  • i.Write an algorithm in pseudocode that finds and outputs the lightest weight in the list weights. (2)
  • ii.Trace your algorithm on these weights: write the lightest so far after each comparison. (1)
  • iii.How many comparisons did it make? How many would it make for a list of n weights? (1)
Answer

i.

SET lightest TO weights[0]FOR i FROM 1 TO 5    IF weights[i] < lightest THEN        SET lightest TO weights[i]    END IFEND FOROUTPUT lightest

ii.

i weights[i] Smaller than lightest? lightest
(start) 3.2
1 2.8 yes 2.8
2 3.5 no 2.8
3 2.6 yes 2.6
4 3.0 no 2.6
5 2.9 no 2.6

It outputs 2.6.
iii. 5 comparisons, one for each weight after the first. For n weights, n − 1.

Marking scheme
  • i. Starts the lightest so far as the first weight, and a loop over the other positions (1 to 5).
  • i. An IF that changes the lightest only for a smaller weight, and outputs it after the loop.
  • ii. A correct trace ending at 2.6.
  • iii. 5 comparisons; n − 1 for n weights.
13.
[4]

Read the web page and its style sheet, and answer the questions that follow.

index.html

<!DOCTYPE html><html>  <head>    <meta charset="utf-8">    <meta name="viewport" content="width=device-width, initial-scale=1">    <title>Free Eye Camp</title>    <link rel="stylesheet" href="style.css">  </head>  <body>    <h1>Free Eye Camp in Lumbini</h1>    <p class="notice">Bring your citizenship card or birth certificate.</p>    <ol>      <li>Register at the gate</li>      <li>Have your eyes tested</li>      <li>Collect your glasses</li>    </ol>    <img src="eye-test.jpg" alt="image">  </body></html>

style.css

.notice {  background-color: #fff3cd;  font-size: 11px;}
  • i.How does a browser show the lines from <ol> to </ol>? (1)
  • ii.Why does the rule’s selector, .notice, start with a dot, and what does the rule do? (1)
  • iii.Write two things in this page that make it harder for some people to use, and how to fix each. (2)
Answer
  • i.As a numbered list of three steps, one under the other: 1. Register at the gate, 2. Have your eyes tested, 3. Collect your glasses. <ol> is an ordered list.
  • ii.A selector starting with a dot picks the elements with that class: here, the paragraph with class="notice". The rule gives it a pale yellow background and makes its text 11 pixels high.
  • iii.Any two:
  • The alt text “image” tells a blind visitor nothing. Say what the photo shows: alt="A doctor testing a girl’s eyes with a letter chart".
  • The notice’s text is 11 px, too small to read on a phone (and the people at an eye camp have weak eyes). Make it about 16 px, or delete the font-size.
  • <html> has no lang, so a screen reader may read the page in the wrong voice. Write <html lang="en">.
Marking scheme
  • i. A numbered (ordered) list of the three steps.
  • ii. The dot selects the class notice (the paragraph); it gets a pale yellow background and 11 px text.
  • iii. One problem with its fix: the alt text “image” (say what it shows), the 11 px text (about 16 px), or the missing lang (lang="en").
  • iii. A second, different problem with its fix.
14.
[4]

Read the given passage and answer the questions that follow.

Prakash, a tour guide in Lumbini, wants a translation app for his Japanese and Korean guests. In the app store he finds “Free Translator Pro”, from a developer he has never heard of. When he opens it, it asks to read his SMS messages, his contacts, and for the “accessibility” permission.

  • i.Before installing an app, what two things should he check in the store? (1)
  • ii.Why is it dangerous to let an app read his SMS messages? (1)
  • iii.What can an app with the accessibility permission do? (1)
  • iv.He pressed Allow for the SMS messages before he had read the request. Can he take that back, and where? (1)
Answer
  • i.Any two: who made it (the developer’s name under the app’s name); how many people use it, and the newest reviews, especially the low ones; what it asks for.
  • ii.His bank’s codes come by SMS: an app that reads them could use them to get into his bank account. Only the phone’s own messages app needs SMS.
  • iii.It can read the screen and tap for him: it is meant for apps that help people who can’t see or touch the screen, and harmful apps ask for it to control the phone.
  • iv.Yes, at any time: in the phone’s settings, under the app’s permissions, he can switch SMS off. Since a translator needs none of these, he should then uninstall it.
Marking scheme
  • i. Any two of: the developer, how many use it and its reviews, what it asks for.
  • ii. Bank codes come by SMS, so the app could steal them.
  • iii. Read the screen and tap for him (control the phone).
  • iv. Yes, in the phone’s settings (the app’s permissions).

Practical exam

25 marks

Marked by the school. Work alone at a computer, with no internet and no AI, in front of the teacher, for 1 hour 30 minutes. Write and run each program, show it working, and answer the teacher’s questions. On this page, press Edit on a program to type in it, and Run to run it.

P1.
[8]

Safe water. A health worker tests the water from the 5 taps of a village in Rupandehi. For each tap, she finds the number of E. coli germs in 100 ml of water: water that is safe to drink has none. Write a program that:

  • asks for the number of germs found at each of the 5 taps;
  • prints, for each tap, “Safe” if none were found, or else “Not safe: boil or filter before drinking”;
  • at the end, prints how many taps were not safe, or “All taps are safe” if none.

Run it in front of the teacher with 0, 3, 0, 12 and 0 germs.

# Safe water: write your program hereunsafe = 0
Answer
unsafe = 0for tap in range(1, 6):    germs = int(input(f"Germs in 100 ml at tap {tap}: "))    if germs == 0:        print("Safe")    else:        print("Not safe: boil or filter before drinking")        unsafe = unsafe + 1if unsafe == 0:    print("All taps are safe")else:    print("Taps not safe:", unsafe)

Output

Germs in 100 ml at tap 1: 0SafeGerms in 100 ml at tap 2: 3Not safe: boil or filter before drinkingGerms in 100 ml at tap 3: 0SafeGerms in 100 ml at tap 4: 12Not safe: boil or filter before drinkingGerms in 100 ml at tap 5: 0SafeTaps not safe: 2

A for loop fits, because the number of taps (5) is known in advance. Other wordings of the messages are fine.

Marking scheme
  • Sets a counter of unsafe taps to 0 before the loop.
  • A for loop that runs exactly 5 times (range(1, 6) or range(5)).
  • Asks for each tap’s germs with input(), converted with int().
  • An if that checks whether no germs were found.
  • Prints “Safe” or the warning for each tap, inside the loop.
  • Adds 1 to the counter only for an unsafe tap.
  • After the loop, prints the number of unsafe taps, or “All taps are safe” when there are none.
  • Runs it in front of the teacher with 0, 3, 0, 12, 0 and gets the right output.
P2.
[4]

The fever check. At a health camp, this program should say whether a patient has a fever: a temperature of 38 °C or more. Run it.

temp = float(input("Temperature in °C: "))if temp >= 38    print("Fever: see the health worker.")else:    print("No fever.")
  • i.Write the kind of error and the line Python names.
  • ii.Say why it happens.
  • iii.Fix the program.
  • iv.Test it with 37.2, 38 and 39.5: write what each should print first, then run it.
Answer

i. and ii. A SyntaxError, on line 2:

Error message

  File "main.py", line 2    if temp >= 38                 ^SyntaxError: expected ':'

An if line must end with a colon, :, which shows where the condition ends and the indented lines that belong to it begin. The caret ^ points just past the condition, where the colon is missing.

iii. Add the colon:

temp = float(input("Temperature in °C: "))if temp >= 38:    print("Fever: see the health worker.")else:    print("No fever.")

Output

Temperature in °C: 37.2No fever.

iv.

Temperature Should print Kind of test
37.2 No fever. ordinary
38 Fever: see the health worker. (38 counts as a fever) edge
39.5 Fever: see the health worker. ordinary
Marking scheme
  • Names the SyntaxError and line 2.
  • Explains that the if line must end with a colon.
  • Fixes it with the colon, and it runs.
  • Writes the expected results for 37.2, 38 and 39.5 first, and the program gives them (38 is a fever).
P3.
[7]

A page for pilgrims to Lumbini. Make a small web page with:

  • a title, and a main heading;
  • a sentence or two about Lumbini;
  • a list of three things a visitor can see there;
  • the photo lumbini.jpg, of the Maya Devi Temple and the Ashoka Pillar, with alt text;
  • at least one CSS rule in the style sheet that changes how the page looks.

Show it to the teacher, on a phone width as well.

Try it

A page about Lumbini

Your page, titled
  • Title

  • Language

  • Headings

  • Pictures

  • Contrast

  • Phone width

Change the code until every row has a ✓.

Your page is kept in this browser only. Nothing you type is sent anywhere.

lumbini.jpg: Shadow Ayush, CC BY-SA 4.0, via Wikimedia Commons

Answer

One good page (yours will be different):

index.html

<!DOCTYPE html><html lang="en">  <head>    <meta charset="utf-8">    <meta name="viewport" content="width=device-width, initial-scale=1">    <title>Visit Lumbini</title>    <link rel="stylesheet" href="style.css">  </head>  <body>    <h1>Visit Lumbini</h1>    <p>Lumbini, in Rupandehi district, is where the Buddha was born. Pilgrims come to it from all over the world.</p>    <h2>Things to see</h2>    <ul>      <li>The Maya Devi Temple</li>      <li>The Ashoka Pillar</li>      <li>The monasteries built by many countries</li>    </ul>    <img src="lumbini.jpg" alt="The white Maya Devi Temple with a golden spire, and the stone Ashoka Pillar standing in front of it">  </body></html>

style.css

body {  font-family: sans-serif;} h1,h2 {  color: #7a3b00;} img {  max-width: 100%;}

The max-width: 100% rule keeps the photo inside a phone’s screen.

Marking scheme
  • A <title> that says what the page is, with the skeleton (lang, head and body) kept correct.
  • One <h1> main heading at the top of the body.
  • A paragraph (<p>) about Lumbini.
  • A list (<ul> or <ol>) with three <li> items, opened and closed correctly.
  • The photo shown with <img src="lumbini.jpg">.
  • Alt text that says what the photo shows (not just “photo” or “image”).
  • A CSS rule with a selector and a declaration (property: value;) that changes how the page looks.
P4.
[6]

Viva. The teacher asks each student about their own work, for example:

  • i.In your safe-water program, what would it print for a tap where the health worker typed −2 by mistake? How could the program catch such a mistake? (2)
  • ii.In the fever check, will the program give the same answer when a nurse types 38 and when she types 38.0? Why? (2)
  • iii.Why did you use a list for the things to see, and not three separate paragraphs? (2)
Answer
  • i.−2 isn’t 0, so it goes to the else and prints “Not safe: boil or filter before drinking”, and counts the tap as unsafe, though no test can find fewer than 0 germs: a wrong input gives a wrong answer. The program could check for it first, for example if germs < 0: print("Typing mistake: type the number again."), and ask again (or not count that tap).
  • ii.Yes. float() turns both "38" and "38.0" into the same number, 38.0, and 38.0 >= 38 is True, so both print “Fever: see the health worker.”
  • iii.They are a list: several items of the same kind. <ul> and <li> tell the browser so, and it shows them as a bulleted list. Screen readers, search engines and phones use the HTML’s lists, so a blind visitor’s screen reader can tell them it is a list, whatever the CSS makes it look like.
Marking scheme
  • i. It prints “Not safe…” (and counts the tap), because −2 isn’t 0.
  • i. A check such as if germs < 0: that reports a typing mistake (and asks again).
  • ii. Yes, the same answer (fever).
  • ii. float() turns both into 38.0, which is >= 38.
  • iii. The three items are a list of things of the same kind.
  • iii. The browser shows them as a list, and screen readers (and search engines) know it is one.

Your score

0 / 50 theory

0 / 25 practical

34 questions not marked yet

Section A–Full marks 10
Section B–Full marks 8
Section C–Full marks 16
Section D–Full marks 16
Practical exam–Full marks 25

Marks lost, by unit

Mark a question to see your score here.

Score 0 of 0 0 of 34 marked Time left: 2:00:00