Skip to content

← Final exam model papers

Final Exam Model Paper 1

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.

Sita shares 7 laddus equally between her 2 cousins, and works out each one’s share in Python:

share = 7 / 2

What type is the value in share?

Pick an answer to see why.

b.

Hari climbs a temple’s 365 steps, and rests after every 100 steps, and at the top. What does this program print?

steps = 365rests = 0while steps > 0:    steps = steps - 100    rests = rests + 1print(rests)

Pick an answer to see why.

c.

A school keeps its 1,200 students’ names in a list, in the order they joined the school. The office needs to find one student’s name, just once. What is the best plan?

Pick an answer to see why.

d.

Which HTML element makes a link to another page?

Pick an answer to see why.

e.

A ward office’s logo is a few flat colors and simple shapes. On its website it must look sharp on a small phone and on a big screen. Which format should the logo be saved in?

Pick an answer to see why.

f.

Kamala measured the light level in her room with a micro:bit: about 180 by day, 60 at dusk and 8 at night. Her night light must come on only when the room is really dark. Which condition should switch it on?

Pick an answer to see why.

g.

Bikash keeps his band’s songs on his laptop, on an external disk in his desk drawer, and on a pen drive in the same drawer. Which part of the 3-2-1 rule does his plan miss?

Pick an answer to see why.

h.

A bus company’s poster has two bars: last year’s fare, Rs 1,000, and this year’s, Rs 1,050. The chart’s axis starts at Rs 990, so the second bar is six times as tall as the first. A rival company says, “Their fares went up six times!” Which judgment is right?

Pick an answer to see why.

i.

How does a chatbot write its answer?

Pick an answer to see why.

j.

Why can a chatbot give a wrong answer that sounds completely sure?

Pick an answer to see why.

Section B

8 × 1 = 8

2. Write very short answers to the following questions.

a.

Which Python operator gives the remainder of a division?

Answer

%, the remainder: 17 % 5 is 2.

Marking scheme
  • % (the remainder operator).
b.

What does a function give back to its call if it has no return?

Answer

None: Python’s value for “nothing”.

Marking scheme
  • None.
c.

Why should you not open, edit and save the same JPEG photo again and again?

Answer

JPEG compression is lossy: each save squeezes the photo again and throws away a little more detail, so after many saves it is spoiled. Edit from the original, and save one JPEG at the end.

Marking scheme
  • Each save compresses it again (lossy) and loses more detail.
d.

Why is a micro:bit’s program usually written inside while True:?

Answer

So that it keeps going for as long as the board is on, checking its inputs again and again and reacting to them. Without the loop, the program would check once and stop.

Marking scheme
  • It repeats forever, so the board keeps checking its inputs and reacting (instead of running once and stopping).
e.

Write one line of HTML that shows the photo team.jpg, of your school’s football team holding the district cup, with suitable alt text.

Answer
<img src="team.jpg" alt="Our school football team holding the district cup">
Marking scheme
  • An <img> with src="team.jpg" and alt text that says what the photo shows.
f.

A photo of 3,000 × 2,000 pixels is resized to 1,500 pixels wide, keeping its shape. How many pixels high is it now?

Answer

The width is halved (3,000 ÷ 1,500 = 2), so the height is halved too: 2,000 ÷ 2 = 1,000 pixels.

Marking scheme
  • 1,000 pixels.
g.

This program should count down the people still to be served tea, but it never stops. Which line is wrong, and what should it be?

cups = 10while cups > 0:    print("Tea still to serve:", cups)    cups = cups + 1
Answer

Line 4 makes cups grow, so cups > 0 never becomes False. It should be cups = cups - 1.

Marking scheme
  • Line 4; it should be cups = cups - 1.
h.

A shop needs to add 13% VAT to every bill. Should it use a chatbot or an ordinary program? Give one reason.

Answer

An ordinary program. It gives the exact answer every time (a chatbot predicts likely words and can get arithmetic wrong); anyone can check its steps; and it runs on the shop’s computer without the internet, using far less electricity.

Marking scheme
  • An ordinary program, with a reason: exact every time, can be checked, or cheaper and works offline.

Section C

8 × 2 = 16

Write short answers to the following questions.

3.
[2]

Rita wrote this program for her family’s momo shop and typed 150 for the price.

price = input("Price of one plate of momo: ")plates = 3print("Total: Rs", price * plates)

It printed Total: Rs 150150150.

  • i.Why did it print this instead of 450?
  • ii.Rewrite line 1 so that the program prints Total: Rs 450.
Answer
  • i.input() always gives a string, so price holds the text "150", not a number. A string times a number repeats the string: "150" * 3 is "150150150".
  • ii.Convert the text to a number:
price = int(input("Price of one plate of momo: "))plates = 3print("Total: Rs", price * plates)

Output

Price of one plate of momo: 150Total: Rs 450
Marking scheme
  • i. input() gives a string, and a string times 3 repeats it.
  • ii. price = int(input("Price of one plate of momo: ")) (or float(…)).
4.
[2]

135 students of a school are going on a trip to Chitwan, and each bus holds 40.

students = 135buses = students // 40left = students % 40print(buses, "full buses and", left, "students left over")
  • i.Write the output of the program.
  • ii.How many buses must the school book? Give a reason.
Answer

i. 135 // 40 is 3 (40 goes into 135 three whole times) and 135 % 40 is 15 (135 − 120):

Output

3 full buses and 15 students left over

ii. 4 buses: three full ones, and one more for the 15 students left over.

Marking scheme
  • i. 3 full buses and 15 students left over.
  • ii. 4, because 15 students are left over after 3 full buses.
5.
[2]

A kite shop’s program, before Dashain:

def kite_bill(kites, price):    total = kites * price    if kites >= 5:        total = total - 100    return total ram = kite_bill(3, 120)sita = kite_bill(5, 120)print(ram, sita)
  • i.Write the output.
  • ii.Pemba adds the line print(total) at the end of the program. What happens, and why?
Answer

i. Ram’s 3 kites cost 3 × 120 = 360. Sita’s 5 cost 5 × 120 = 600, and 5 or more get Rs 100 off: 500.

Output

360 500

ii. It stops with NameError: name 'total' is not defined. total belongs to the function: it is made when kite_bill is called and gone when it ends, so the main program can’t see it. Only the returned value comes out of the function.

Marking scheme
  • i. 360 500.
  • ii. A NameError, because total is the function’s own variable and doesn’t exist outside it.
6.
[2]

Land in Nepal’s hills is measured in ropani, and 1 ropani is 16 aana. Write a function to_aana(ropani) that returns the number of aana in a field, and use it to print how many aana a 3-ropani field and a 5-ropani field have together.

Answer
def to_aana(ropani):    return ropani * 16 print(to_aana(3) + to_aana(5))

Output

128
Marking scheme
  • A function to_aana with the parameter ropani that returns ropani * 16.
  • A line that calls it for 3 and 5 and prints the sum of the returned values (128).
7.
[2]

A scholarship form asks Nisha for a photo of 600 × 800 pixels, under 300 KB.

  • i.What is the photo’s raw size in KB, at 3 bytes a pixel? (1 KB = 1,024 bytes.)
  • ii.Will she have to push the JPEG quality down a lot to fit? Give a reason.
Answer
  • i.600 × 800 = 480,000 pixels; × 3 bytes = 1,440,000 bytes; ÷ 1,024 ≈ 1,406 KB.
  • ii.No. It must be squeezed only about 1,406 ÷ 300 ≈ 4.7 times, and a JPEG at good quality (about 80) usually squeezes a photo 10 times or more. It will fit without lowering the quality much.
Marking scheme
  • i. About 1,406 KB (480,000 pixels × 3 = 1,440,000 bytes).
  • ii. No: it needs squeezing only about 5 times, and a good-quality JPEG squeezes 10 times or more.
8.
[2]

A school library has a micro:bit that shows a sad face when the room gets too noisy.

  • i.Name its input and its output.
  • ii.Write, in words, the rule its program follows.
Answer
  • i.Input: the microphone (the sound level around the board). Output: the LED display (the face).
  • ii.Again and again: if the sound level is above a threshold (chosen by measuring the library when it is quiet and when it is noisy), show the sad face; else clear the display.
Marking scheme
  • i. Input the microphone (sound level), output the LED display.
  • ii. If the sound level is above a threshold, show the sad face, otherwise not, checked again and again.
9.
[2]

What is metadata? Write any two pieces of metadata a phone saves with a photo.

Answer

Metadata is data about data: not the content itself, but facts about it, such as who, when, where and on which device. A photo’s metadata (its EXIF) includes any two of: the date and time it was taken, the place (latitude and longitude), the phone’s model, the camera’s settings.

Marking scheme
  • Metadata is data about data (when, where, who, which device), not the content.
  • Any two of a photo’s: date and time, place (coordinates), phone model, camera settings.
10.
[2]

For an essay on Gai Jatra, Arjun asked a chatbot to write the whole essay and handed it in as his own. Asmita asked a chatbot to suggest questions to ask her grandmother about the festival, then wrote the essay herself, and added a note saying how she used the chatbot. Judge what each of them did, with a reason.

Answer

Arjun cheated: he handed in the chatbot’s work as his own, which is plagiarism, like copying a friend’s answers; and he learned nothing. Asmita used AI honestly, if her teacher allows it: she used it to help her think, did the work herself, and said how she used it in an AI-use note.

Marking scheme
  • Arjun: cheating, because he handed in AI’s work as his own.
  • Asmita: honest use, because she did the work herself and wrote an AI-use note (within her teacher’s rules).

Section D

4 × 4 = 16

Write long answers to the following questions.

11.
[4]

The scorer at a school cricket match wants a program for each over (6 balls). It must ask for the runs scored off each ball, add them up, count the boundaries (balls that scored 4 or 6), and at the end print the runs and the boundaries, and “Maiden over!” if no runs were scored.

  • i.Write the program. (3)
  • ii.Which of your variables is a counter, and which is a running total? (1)
Answer

i.

total = 0boundaries = 0for ball in range(1, 7):    runs = int(input(f"Runs off ball {ball}: "))    total = total + runs    if runs == 4 or runs == 6:        boundaries = boundaries + 1print("Runs in the over:", total)print("Boundaries:", boundaries)if total == 0:    print("Maiden over!")

For the balls 1, 4, 0, 6, 0, 2:

Output

Runs off ball 1: 1Runs off ball 2: 4Runs off ball 3: 0Runs off ball 4: 6Runs off ball 5: 0Runs off ball 6: 2Runs in the over: 13Boundaries: 2

ii. boundaries is a counter (it goes up by 1 for each boundary); total is a running total (each ball’s runs are added to it). Both start at 0 before the loop.

Marking scheme
  • i. A loop that runs 6 times, asking for each ball’s runs with int(input(…)).
  • i. A running total that starts at 0 before the loop and adds each ball’s runs, printed after the loop.
  • i. A counter of boundaries with a correct condition (runs == 4 or runs == 6), and “Maiden over!” printed only when the total is 0.
  • ii. The boundaries variable is the counter and the total is the running total.
12.
[4]

A school library numbers its books in the order they are bought. These are the numbers of the 11 books on its science shelf, sorted:

Position 0 1 2 3 4 5 6 7 8 9 10
Book number 104 117 125 138 142 156 163 171 189 194 205
  • i.Search for book 194 with a binary search, using middle = (low + high) // 2. Show low, high, middle and the number there at each look. (2)
  • ii.How many comparisons did it make? How many would a linear search from position 0 have made? (1)
  • iii.Search for book 130, which isn’t on the shelf. After how many comparisons does the search stop, and why? (1)
Answer

i.

Look low high middle Number there Compared with 194
1 0 10 5 156 smaller: low = 6
2 6 10 8 189 smaller: low = 9
3 9 10 9 194 equal: found at position 9
  • ii.3 comparisons. A linear search would compare positions 0 to 9: 10 comparisons.
  • iii.Look 1: middle 5, 156, bigger than 130, so high = 4. Look 2: middle 2, 125, smaller, so low = 3. Look 3: middle 3, 138, bigger, so high = 2. Now low (3) is past high (2): nothing is left, and the search stops after 3 comparisons, sure that 130 isn’t there.
Marking scheme
  • i. Looks 1 and 2 correct: middle 5 (156, low = 6), then middle 8 (189, low = 9).
  • i. Look 3 correct: middle 9, 194 found at position 9.
  • ii. 3 comparisons for binary search, 10 for linear search.
  • iii. 3 comparisons, because low (3) goes past high (2) and nothing is left to search.
13.
[4]

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

index.html

<!DOCTYPE html><html lang="ne">  <head>    <meta charset="utf-8">    <title>Gai Jatra</title>    <link rel="stylesheet" href="style.css">  </head>  <body>    <h1>Gai Jatra</h1>    <p>A festival of the Kathmandu Valley that remembers the people who died in the past year.</p>    <h3>What you will see</h3>    <ul>      <li>Children dressed as cows</li>      <li>Songs, jokes and plays</li>    </ul>    <img src="gai-jatra.jpg">  </body></html>

style.css

h1 {  color: #b22222;}
  • i.How does a browser show the lines from <ul> to </ul>? (1)
  • ii.In the CSS rule, name the selector, the property and the value, and say what the rule does. (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 bulleted list of two items, one under the other, each with a dot in front: <ul> is an unordered list and each <li> a list item.
  • ii.Selector h1, property color, value #b22222 (a dark red in hex): it makes the page’s main heading dark red.
  • iii.Any two:
  • The photo has no alt text, so a blind visitor’s screen reader can’t say what it shows. Add alt="…" describing it, such as alt="Children dressed as cows walking in a Gai Jatra procession".
  • The headings skip a level, from <h1> to <h3>, so the page’s outline seems to have a part missing. Make it <h2>.
  • The page says lang="ne", but its text is in English, so a screen reader reads it in a Nepali voice. Make it lang="en".
Marking scheme
  • i. A bulleted (unordered) list of the two items.
  • ii. Selector h1, property color, value #b22222: it colors the main heading dark red.
  • iii. One problem with its fix: no alt text (add alt), the h1 to h3 jump (use h2), or lang="ne" on English text (use lang="en").
  • iii. A second, different problem with its fix.
14.
[4]

Read the given passage and answer the questions that follow.

Dipesh left his phone on a microbus in Kathmandu. The phone had his mobile banking app, his email and his photos. That evening, he borrowed his sister’s phone to deal with it.

  • i.Why should he first call his own number? (1)
  • ii.What can he do with “find my device”, signed in to his account? (1)
  • iii.Why should he ask his phone company to block his SIM? (1)
  • iv.What number from the phone’s box should he give the police when he reports it? (1)
Answer
  • i.In case it is just lost nearby and someone kind answers it, or the microbus driver finds it.
  • ii.Find where the phone is on a map, lock it with a message and a number to call, or, if he is sure it won’t come back, erase it.
  • iii.So that nobody can use his number to receive his codes (bank and login codes sent by SMS); the company can give him a new SIM with the same number.
  • iv.Its IMEI number, which identifies that phone.
Marking scheme
  • i. It may be nearby, and someone may answer it.
  • ii. Find it on a map, lock it with a message, or erase it.
  • iii. So that nobody can receive his codes on his number.
  • iv. The IMEI number.

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]

The picnic bus. Your school’s picnic bus to Nagarkot has 40 seats, and it picks students up at stops on the way. Write a program that:

  • asks at each stop how many students get on, and then prints the seats left;
  • if more students want to get on than there are seats left, prints how many must wait for the next bus, and lets on only as many as there are seats;
  • stops asking when the bus is full, and prints after how many stops it was full.

Run it in front of the teacher with 12, 15, 9 and 7 students at the four stops.

# The picnic bus: write your program hereseats = 40
Answer
seats = 40stop = 0while seats > 0:    stop = stop + 1    getting_on = int(input(f"Stop {stop}: how many students get on? "))    if getting_on > seats:        print(getting_on - seats, "must wait for the next bus.")        getting_on = seats    seats = seats - getting_on    print("Seats left:", seats)print("The bus is full after", stop, "stops.")

Output

Stop 1: how many students get on? 12Seats left: 28Stop 2: how many students get on? 15Seats left: 13Stop 3: how many students get on? 9Seats left: 4Stop 4: how many students get on? 73 must wait for the next bus.Seats left: 0The bus is full after 4 stops.

A while loop fits, because nobody knows in advance how many stops it will take. Other wordings of the messages are fine.

Marking scheme
  • Sets the seats (40) and a stop counter before the loop.
  • A while loop that repeats while seats are left.
  • Asks at each stop with input(), converted with int().
  • An if that finds when more students want to get on than there are seats.
  • In that case, prints how many must wait, and lets on only the seats left.
  • Takes the students who got on from the seats, and prints the seats left after each stop.
  • Prints the number of stops once, after the loop.
  • Runs it in front of the teacher with 12, 15, 9, 7 and gets the right output.
P2.
[4]

The museum ticket. This program should tell a visitor which ticket to buy: a child ticket (Rs 50) for anyone under 12, and a full ticket (Rs 100) for everyone else. Run it, and type 9 for the age.

age = input("How old are you? ")if age < 12:    print("Child ticket: Rs 50")else:    print("Full ticket: Rs 100")
  • i.Write the kind of error and the line Python names.
  • ii.Say why it happens.
  • iii.Fix the program.
  • iv.Test it with the ages 9, 12 and 30: write what each should print first, then run it.
Answer

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

Error message

Traceback (most recent call last):  File "main.py", line 2, in <module>    if age < 12:       ^^^^^^^^TypeError: '<' not supported between instances of 'str' and 'int'

input() always gives a string, so age holds the text "9", and Python can’t compare text with the number 12.

iii. Convert the age to a number on line 1:

age = int(input("How old are you? "))if age < 12:    print("Child ticket: Rs 50")else:    print("Full ticket: Rs 100")

Output

How old are you? 9Child ticket: Rs 50

iv.

Age Should print Kind of test
9 Child ticket: Rs 50 ordinary
12 Full ticket: Rs 100 (12 is not under 12) edge
30 Full ticket: Rs 100 ordinary
Marking scheme
  • Names the TypeError and line 2.
  • Explains that input() gives a string, which can’t be compared with a number.
  • Fixes it with int(input(…)), and it runs.
  • Writes the expected results for 9, 12 and 30 first, and the program gives them (12 gets a full ticket).
P3.
[7]

A page for visitors to Bhaktapur. Make a small web page with:

  • a title, and a main heading;
  • a sentence or two about Bhaktapur;
  • a list of three things a visitor can see or do there;
  • the photo nyatapola.jpg, of the Nyatapola temple, 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 for visitors

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.

nyatapola.jpg: Göran Höglund (Kartläsarn), CC BY 2.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 Bhaktapur</title>    <link rel="stylesheet" href="style.css">  </head>  <body>    <h1>Visit Bhaktapur</h1>    <p>Bhaktapur is an old Newar city in the Kathmandu Valley, full of temples, courtyards and potters at work.</p>    <h2>Things to do</h2>    <ul>      <li>Climb the steps of the Nyatapola temple</li>      <li>Watch potters at work in Pottery Square</li>      <li>Taste juju dhau, the king of curds</li>    </ul>    <img src="nyatapola.jpg" alt="The five-roofed Nyatapola temple on its high stepped base, against a blue sky">  </body></html>

style.css

body {  font-family: sans-serif;} h1 {  color: #8b1a1a;} 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 Bhaktapur.
  • A list (<ul> or <ol>) with three <li> items, opened and closed correctly.
  • The photo shown with <img src="nyatapola.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 picnic bus program, what is the job of seats? What would happen if you left out the line that takes the students from it? (2)
  • ii.In the museum ticket, why did Python give a TypeError and not a SyntaxError? (2)
  • iii.Who is helped by the alt text on your page, and how? (2)
Answer
  • i.seats holds the number of seats left: it starts at 40 and goes down at each stop, and the loop’s condition checks it. Without seats = seats - getting_on it never goes down, so seats > 0 stays True and the loop never ends: an infinite loop, asking at stop after stop.
  • ii.The program is written correctly, so Python could read it and start running it (a SyntaxError would have stopped it before anything ran). The error came only while it ran, at line 2, when it tried to compare a string with a number: a value of the wrong type.
  • iii.A blind or partly sighted visitor using a screen reader hears the alt text read out in place of the photo; it also shows when the photo doesn’t load (a slow connection), and helps search engines know what the photo is.
Marking scheme
  • i. seats holds the seats left and decides when the loop ends.
  • i. Without the subtraction, the loop never ends (an infinite loop).
  • ii. The program could be read, so it was not a syntax error.
  • ii. The error came while running, comparing a string with a number (the wrong type).
  • iii. Blind or partly sighted visitors, with a screen reader.
  • iii. It reads the alt text out in place of the photo (or shows it when the photo doesn’t load).

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