Final Exam Model Paper 5
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 = 101. Choose the correct option for each of the following questions.
At a school fair in Bhojpur, a stall’s program works out a price of 7.9 rupees and then runs:
print(int(7.9))What does it print?
Pick an answer to see why.
The table tennis contest at the fair has a senior group for students aged 12 or more and in Grade 8 or above. What does this program print?
age = 13grade = 7if age >= 12 and grade >= 8: print("Senior group")else: print("Junior group")Pick an answer to see why.
Kiran sorts the 8 quiz scores of the fair with bubble sort, and makes 28 comparisons. Mina sorts the same 8 scores with insertion sort, and makes 15. Mina says, “My sort made fewer comparisons, so my sorted list is more correct than Kiran’s.” Which judgment is right?
Pick an answer to see why.
Which attribute of an <img> element gives the address of the picture to show?
Pick an answer to see why.
Students film a one-minute clip of the fair, with the sound of the crowd, to post on the school’s page. In which format should the finished clip be saved?
Pick an answer to see why.
A stall’s micro:bit runs this line. What does the display show?
display.show(Image("90009:09090:00900:09090:90009"))Pick an answer to see why.
Prakash’s folder for the fair’s poster has poster final.png, poster final 2.png and poster final REALLY.png. Why is this a problem, and what is better?
Pick an answer to see why.
The school publishes the results of its fair survey with the names removed, but each answer still shows the student’s grade, gender and date of birth. Which judgment is right?
Pick an answer to see why.
What is an AI-use note?
Pick an answer to see why.
Bishal asks a chatbot about a rule his school board changed last month. It answers confidently with the old rule. Why can this happen?
Pick an answer to see why.
Section B
8 × 1 = 82. Write very short answers to the following questions.
What is the string "", with nothing between its quotes, called?
Answer
The empty string: a string with no characters in it. It is still a string.
Marking scheme
- The empty string.
What is breaking a big problem into smaller parts, each of which can be solved on its own, called?
Answer
Decomposition: for the fair’s program, for example, one function for the stalls’ bills, one for the raffle and one for the scores.
Marking scheme
- Decomposition.
Kamala photographs the sel roti stall’s owner standing in front of a bright window, and his face comes out as a dark shape. Why, and what should she do?
Answer
The camera sets its brightness for the bright window, so the face, much darker than the window, comes out almost black. She should stand so the light falls on his face: the window behind her or to one side, not behind him.
Marking scheme
- The bright window behind him makes the face dark; put the light behind or beside the photographer, on his face.
Why should a student never connect a micro:bit project to the 230 V mains?
Answer
The board works on 3 to 5 volts. The mains, at 230 volts, can kill and start fires. Anything on the mains must use a relay module made for it, built and checked by an adult who knows electrical work.
Marking scheme
- 230 V mains can kill or start fires; the board and student-built wiring are for low voltage only.
Write the line, for the <head>, that connects a web page to its style sheet style.css.
Answer
<link rel="stylesheet" href="style.css">Marking scheme
<link rel="stylesheet" href="style.css">.
Raw, with no compression, a minute of 1080p video at 30 frames a second takes about 10.4 GB. About how much would a 30-second clip of the fair take, raw?
Answer
Half a minute: 10.4 ÷ 2 = about 5.2 GB. (A phone saves it far smaller, because one frame is usually almost the same as the one before.)
Marking scheme
- About 5.2 GB.
A stall started with 50 sel roti and sells them 3 at a time. This program never stops. Why, and what should the condition be?
pieces = 50while pieces != 0: pieces = pieces - 3 print("Left:", pieces)Answer
50 isn’t a multiple of 3, so pieces goes 47, 44 … 5, 2, −1, −4 … and is never exactly 0: pieces != 0 stays True forever. The condition should be while pieces > 0:.
Marking scheme
- pieces skips over 0 (2, then −1), so
!= 0is always true; usewhile pieces > 0:.
To choose a poster for the fair, Bina asks an image generator for 30 different versions. Was that a good choice? Give a reason.
Answer
Not a good choice. Every picture is made by computers in a data center, using electricity (often from coal and gas) and water to cool them, and a picture costs much more than a short text answer: 30 versions cost 30 times as much. A clear prompt and two or three versions, or the students’ own drawing, would do.
Marking scheme
- No, because each picture uses electricity and water in a data center, so 30 cost 30 times as much (a better prompt and a few versions would do).
Section C
8 × 2 = 16Write short answers to the following questions.
Bikram, in Khotang, starts a program for the fair:
stalls = int(input("How many stalls? ")print("Stalls:", stalls)Python stops with SyntaxError: '(' was never closed, before the question is even asked.
- i.Which bracket is missing, and where should it go?
- ii.In the fixed line,
int(input("How many stalls? ")), which of the two functions runs first, and what does each one do?
Answer
- i.Line 1 opens two brackets, after
intand afterinput, but closes only one. A second)is needed at the end of line 1:stalls = int(input("How many stalls? ")). - ii.The inner one,
input(), runs first: it asks the question and gives back what was typed, as a string, such as"12". Thenint()turns that string into the whole number 12, which is put into stalls.
Marking scheme
- i. The closing bracket of
int(is missing, at the end of line 1. - ii.
input()runs first and gives the typed text as a string;int()then turns it into a whole number.
At the fair’s raffle, every ticket with an even number wins a sel roti:
ticket = int(input("Ticket number: "))print(ticket % 2 == 0)- i.What does it print for ticket 47, and for ticket 128?
- ii.Next year, tickets whose number ends in 5 will win. Rewrite the second line for that rule.
Answer
i. 47 % 2 is 1, so 1 == 0 is False; 128 % 2 is 0, so it prints True:
Output
Ticket number: 47FalseOutput
Ticket number: 128Trueii. The last digit of a number is its remainder when divided by 10:
ticket = int(input("Ticket number: "))print(ticket % 10 == 5)Output
Ticket number: 235TrueMarking scheme
- i.
Falsefor 47 andTruefor 128. - ii.
print(ticket % 10 == 5).
A stall’s program shows a message for the sel roti left:
def stall_message(sold, made): if sold == made: return "Sold out!" return f"{made - sold} left" print(stall_message(40, 40))print(stall_message(25, 40))- i.Write the output.
- ii.In the first call, why isn’t “0 left” printed as well?
Answer
i.
Output
Sold out!15 leftii. return ends the function at once, giving back its value. In the first call, sold == made is true, so the function returns “Sold out!” from line 3, and line 4 never runs.
Marking scheme
- i.
Sold out!and15 left. - ii.
returnends the function at once, so line 4 isn’t reached.
In the fair’s football league, a team gets 3 points for a win and 1 for a draw. Write a function league_points(won, drawn) that returns a team’s points, and use it to print the points of Khotang House (4 wins, 2 draws) and Bhojpur House (3 wins, 5 draws).
Answer
def league_points(won, drawn): return won * 3 + drawn print("Khotang House:", league_points(4, 2))print("Bhojpur House:", league_points(3, 5))Output
Khotang House: 14Bhojpur House: 14Both teams have 14 points.
Marking scheme
- A function
league_pointswith two parameters that returnswon * 3 + drawn. - Two calls, (4, 2) and (3, 5), whose returned values are printed (14 and 14).
Students are making a video of the fair to post on the school’s page.
- i.They want a popular Nepali film song they found on YouTube as the background music. May they? What could they use instead?
- ii.They find a song licensed CC BY-ND. May it be the video’s soundtrack? Give a reason.
Answer
- i.No, not without the permission of whoever owns the song: being on YouTube doesn’t give anyone the right to use it, and a video posted online is shared with the whole world. They could use music licensed CC0, CC BY or CC BY-SA (credited), or music they make or record themselves.
- ii.No. ND means no changes, and putting music in time with moving pictures always counts as a changed version. A song under CC BY-ND may be shared as it is, but not used as a soundtrack.
Marking scheme
- i. No (no permission); use CC0, CC BY or CC BY-SA music with credit, or their own.
- ii. No, because ND forbids changes, and a soundtrack is a changed version.
A quiz buzzer at the fair is a micro:bit. Button A plays the note sa (C4) with music.pitch(262, 500). Button B should play the sa one octave higher.
- i.About what frequency should button B play? Give a reason.
- ii.What do the numbers 262 and 500 mean in
music.pitch(262, 500)?
Answer
- i.About 524 Hz (the note C5, more exactly 523 Hz): going up one octave doubles the frequency, 2 × 262.
- ii.262 is the frequency in hertz: the speaker moves back and forth 262 times a second. 500 is how long the note lasts, in milliseconds: half a second.
Marking scheme
- i. About 524 Hz (523), because an octave higher doubles the frequency.
- ii. 262 is the frequency in Hz (times a second), 500 the length in milliseconds.
For consent to be real, it must be informed, free, specific, and possible to take back. Explain any two of these.
Answer
Any two:
- Informed: you know what will be collected, what for, and who will get it.
- Free: you could have said no without being punished or shut out.
- Specific: it is for a stated purpose, not “any purpose”.
- Can be taken back: you can change your mind later and withdraw it.
Marking scheme
- One part explained (informed, free, specific, or can be taken back).
- A second, different part explained.
Asked for a program that prints the lowest day’s sales of the stall, a chatbot gives Sunita this:
sales = [450, 380, 520, 610, 300]best = 0for s in sales: if s > best: best = sprint("Lowest day:", best)Her friend says, “It ran without any error, so it must be right.” Judge this, and say how Sunita should check it.
Answer
Her friend is wrong. Running without an error says nothing about whether the answer is right: this program prints Lowest day: 610, which is the highest day. Sunita should work out the right answer herself first (300), then run the program and compare, and test it with other lists whose answers she knows. (The fix: start with best = sales[0] and keep a smaller value with if s < best.)
Marking scheme
- The friend is wrong: no error doesn’t mean a right answer (it prints 610, the highest).
- She should work out the answer first (300), run it and compare, with more test lists.
Section D
4 × 4 = 16Write long answers to the following questions.
At the fair’s ring-toss stall, each of 4 players gets 3 throws. 3 rings on the pegs wins a big prize, 2 a small prize. Write a program that asks “hit or miss?” for each throw of each player, prints each player’s prize, and at the end prints how many big prizes and how many small prizes were given.
- i.Write the program. (3)
- ii.Where must the line
hits = 0go, and why? (1)
Answer
i.
big = 0small = 0for player in range(1, 5): hits = 0 for throw in range(1, 4): result = input(f"Player {player}, throw {throw}: hit or miss? ") if result == "hit": hits = hits + 1 if hits == 3: print("Big prize!") big = big + 1 elif hits == 2: print("Small prize!") small = small + 1 else: print("Better luck next time!")print("Big prizes:", big)print("Small prizes:", small)For players who throw hit-hit-hit, hit-miss-hit, miss-miss-hit and hit-hit-hit:
Output
Player 1, throw 1: hit or miss? hitPlayer 1, throw 2: hit or miss? hitPlayer 1, throw 3: hit or miss? hitBig prize!Player 2, throw 1: hit or miss? hitPlayer 2, throw 2: hit or miss? missPlayer 2, throw 3: hit or miss? hitSmall prize!Player 3, throw 1: hit or miss? missPlayer 3, throw 2: hit or miss? missPlayer 3, throw 3: hit or miss? hitBetter luck next time!Player 4, throw 1: hit or miss? hitPlayer 4, throw 2: hit or miss? hitPlayer 4, throw 3: hit or miss? hitBig prize!Big prizes: 2Small prizes: 1ii. Inside the outer loop, before the inner one, so that each player starts from 0 hits. Before both loops, the hits of all the players would be added together; inside the inner loop, it would be set back to 0 at every throw.
Marking scheme
- i. A loop for the 4 players with a loop for the 3 throws inside it, asking with
input(). - i. Each player’s hits counted, and the prize chosen by
if/elif/elseon 3 and 2 hits. - i. Counters of big and small prizes, starting at 0 before the loops, printed once at the end.
- ii. Inside the players’ loop, before the throws’ loop, so each player starts at 0.
These are the numbers of 12 raffle tickets left unsold, in the order they were found:
| Position | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Ticket | 342 | 517 | 128 | 905 | 263 | 771 | 450 | 619 | 88 | 734 | 205 | 396 |
- i.Search for ticket 450 with linear search. Write each number it compares, and say where it is found and after how many comparisons. (2)
- ii.Search for ticket 300. After how many comparisons does it stop, and what does it report? (1)
- iii.Why can’t a binary search be used on this list as it is? (1)
Answer
- i.It compares the numbers from position 0: 342, 517, 128, 905, 263, 771, 450. It is found at position 6, after 7 comparisons.
- ii.300 isn’t in the list, so it compares all 12 numbers, reaches the end, and reports that it is not found.
- iii.Binary search works only on a sorted list: it throws away the half where the number can’t be, which is true only when the numbers are in order. This list is in the order the tickets were found, so binary search might wrongly say a ticket isn’t there.
Marking scheme
- i. The numbers compared in order, from 342 to 450.
- i. Found at position 6 after 7 comparisons.
- ii. 12 comparisons, and not found.
- iii. The list isn’t sorted, and binary search needs a sorted list.
Read the web page and its style sheet, and answer the questions that follow.
index.html
<!DOCTYPE html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>School Fair</title> <link rel="stylesheet" href="style.css"> </head> <body> <img src="school-logo.png" alt="logo"> <h1>Our School Fair</h1> <p class="when">Saturday, 10 a.m. to 4 p.m., in the school ground</p> <h2>Stalls</h2> <ul> <li>Sel roti and tea</li> <li>Ring toss</li> <li>Book swap</li> </ul> </body></html>style.css
.when { font-size: 11px;}- i.What would be better alt text for the school’s logo? (1)
- ii.Sanjay says
<p><b>Stalls</b></p>would look much the same as<h2>Stalls</h2>. Why is the<h2>better? (1) - iii.Why is its font size a problem, and how should it be fixed? (1)
- iv.Before putting the page online, the students want to know whether visitors can find when the fair is. How should they test it with a user? (1)
Answer
- i.The school’s name, for example
alt="Shree Bhojpur Secondary School": a logo’s alt text is the name it stands for, not the word “logo”. - ii.A heading says “a new part starts here”. Screen readers, search engines and browsers use the headings as the page’s outline: a blind visitor’s screen reader lists them, so they can jump straight to “Stalls”. Bold text in a paragraph only looks like a heading; to those programs it is an ordinary paragraph.
- iii.11 px is too small to read easily, especially on a phone; body text should be about 16 px.
- iv.Give a person who hasn’t seen the page a task (“Find out when the fair is”), watch quietly without helping, and note where they hesitate or get stuck; then improve the page and test again.
Marking scheme
- i. The school’s name (what the logo stands for).
- ii. Headings make the page’s outline, which screen readers (and search engines) use to jump to a part; bold text is not a heading to them.
- iii. 11 px is too small; use about 16 px.
- iv. Give a user the task, watch without helping, note where they struggle, and improve.
Read the given passage and answer the questions that follow.
Pemba’s grandmother in Dolakha has a new smartphone, and Pemba sets it up for her on the first evening. She wants to talk to her grandchildren and keep their photos.
- i.Why should Pemba install the updates first? (1)
- ii.Why must the phone have a screen lock? (1)
- iii.Why should he switch on two-step login for her account? (1)
- iv.Why should he switch on backup of photos and contacts? (1)
Answer
- i.Updates fix security holes and problems found since the phone was made, so the phone is safest before anything else is put on it.
- ii.A phone with no lock gives every app and every account to whoever picks it up.
- iii.With two-step login, her password alone isn’t enough to sign in: a code sent to her phone (or a tap on it) is needed too. So someone who guesses or steals her password still can’t get into her account.
- iv.So that her photos and contacts are kept in a second place: if the phone is lost, stolen or broken, they aren’t lost with it, and a new phone can be set up from the backup.
Marking scheme
- i. Updates fix security holes and problems.
- ii. Without a lock, anyone who picks it up can open every app and account.
- iii. A password alone is no longer enough: a code from her phone is needed too.
- iv. Her photos and contacts survive if the phone is lost or broken.
Practical exam
25 marksMarked 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.
A table tennis game. For a quick game at the fair, the first player to win 5 points wins. Write a program that:
- asks who won each point, A or B, and adds it to that player’s score;
- if anything else is typed, prints “Type A or B.” and doesn’t count it;
- prints the score after each point;
- stops when a player has 5 points, and prints who won.
Run it in front of the teacher with the points A, B, A, A, C, B, A, A.
# A table tennis game: write your program herea = 0b = 0Answer
a = 0b = 0while a < 5 and b < 5: point = input("Who won the point, A or B? ") if point == "A": a = a + 1 elif point == "B": b = b + 1 else: print("Type A or B.") print("Score:", a, "-", b)if a == 5: print("Player A wins the game!")else: print("Player B wins the game!")Output
Who won the point, A or B? AScore: 1 - 0Who won the point, A or B? BScore: 1 - 1Who won the point, A or B? AScore: 2 - 1Who won the point, A or B? AScore: 3 - 1Who won the point, A or B? CType A or B.Score: 3 - 1Who won the point, A or B? BScore: 3 - 2Who won the point, A or B? AScore: 4 - 2Who won the point, A or B? AScore: 5 - 2Player A wins the game!A while loop fits, because nobody knows how many points the game will take. Other wordings of the messages are fine.
Marking scheme
- Sets both scores to 0 before the loop.
- A
whileloop that goes on while both scores are under 5 (and). - Asks who won each point with
input(). - Adds 1 to the right player’s score with
if/elif. - Prints “Type A or B.” for anything else, without counting it.
- Prints the score after each point.
- Prints the winner once, after the loop, by checking which score is 5.
- Runs it in front of the teacher with A, B, A, A, C, B, A, A, and A wins 5–2.
What is left over? At the end of the fair, this program should say how many sel roti are left. Run it.
made = int(input("Sel roti made today: "))sold = int(input("Sel roti sold: ")) left = made - soldprint("Left over:", left)- i.Write the kind of error and the line Python names.
- ii.Say why it happens.
- iii.Fix the program.
- iv.Test it with 100 made and 85 sold, 60 made and 60 sold, and 50 made and 0 sold: write what each should print first, then run it.
Answer
i. and ii. An IndentationError, on line 3:
Error message
File "main.py", line 3 left = made - soldIndentationError: unexpected indentLine 3 starts with spaces, but it isn’t inside an if or a loop, so it shouldn’t be indented: in Python, spaces at the start of a line mean something. Python finds this before running anything, so no question was asked.
iii. Remove the spaces at the start of line 3:
made = int(input("Sel roti made today: "))sold = int(input("Sel roti sold: "))left = made - soldprint("Left over:", left)Output
Sel roti made today: 100Sel roti sold: 85Left over: 15iv.
| Made | Sold | Should print | Kind of test |
|---|---|---|---|
| 100 | 85 | Left over: 15 | ordinary |
| 60 | 60 | Left over: 0 | edge: all sold |
| 50 | 0 | Left over: 50 | edge: none sold |
Marking scheme
- Names the IndentationError and line 3.
- Explains that the line is indented though it isn’t inside a block, and that Python finds this before running.
- Fixes it by removing the spaces, and it runs.
- Writes the expected results for the three tests first, and the program gives them.
A page for the sel roti stall. Make a small web page for your class’s sel roti stall at the fair with:
- a title, and a main heading;
- a sentence or two about sel roti;
- a list of three things the stall sells, with their prices;
- the photo
sel-roti.jpg, of sel roti on a plate, 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.
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>Grade 8’s Sel Roti Stall</title> <link rel="stylesheet" href="style.css"> </head> <body> <h1>Grade 8’s Sel Roti Stall</h1> <p>Sel roti is a sweet, ring-shaped bread of rice flour, fried at home for Tihar. Ours is fried fresh at the fair.</p> <h2>What we sell</h2> <ul> <li>Sel roti: Rs 20 a piece</li> <li>Milk tea: Rs 25 a cup</li> <li>Aloo achar: Rs 30 a plate</li> </ul> <img src="sel-roti.jpg" alt="A stack of three golden-brown sel roti rings on a plate"> </body></html>style.css
body { font-family: sans-serif;} h1 { color: #8b4513;} 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 sel roti. - A list (
<ul>or<ol>) with three<li>items, opened and closed correctly. - The photo shown with
<img src="sel-roti.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.
Viva. The teacher asks each student about their own work, for example:
- i.In your table tennis program, why do you print the winner after the loop, not inside it? How does the program know who won? (2)
- ii.In Python, what do the spaces at the start of a line mean? Show a line in your table tennis program that must be indented, and say why. (2)
- iii.Your stall’s list has an item and its price on each line. When would a table (
<table>) be better than a list? (2)
Answer
- i.Inside the loop, the program would print a line after every point, while nobody has won yet. The loop ends only when a player has 5 points, so after it the game is over, and the winner is printed once. The program knows who won by checking which score is 5:
if a == 5, A won; otherwise B did. - ii.The spaces show which lines are inside a block: an
if, anelifor a loop. For example,a = a + 1is indented underif point == "A":, so it runs only when A won the point; and every line of the game is indented under thewhile, so it repeats for each point. - iii.When the information is in rows and columns, for example each item with its price and its size, or prices for a small and a big plate. A table’s heading cells (
<th>) also let a screen reader say which column a value is in, such as “Price: Rs 20”. For three items with one price each, a list is fine.
Marking scheme
- i. The game ends only when the loop ends, so the winner is printed once, after it (inside, it would print after every point).
- i. It checks which score is 5 (
if a == 5). - ii. The spaces show which lines are inside a block (
if,while). - ii. A correct example from the program, such as
a = a + 1underif point == "A":, with why. - iii. When the data is in rows and columns (several facts for each item).
- iii. Its heading cells let a screen reader say which column each value is in (or it is easier to compare).
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.
