Question 1
8 marksDid your answer earn the marks?
12 original exam-style questions - 7 pages of questions with a full mark scheme - free printable PDF.
studentName <- name
examScore <- score
endnewreturn examScore endgetScoreendclass
shapes <- new Array(3)
shapes[0] <- new Circle("red", 3)
shapes[1] <- new Rectangle("blue", 4, 5)
shapes[2] <- new Circle("green", 2)
total <- 0
FOR i <- 0 TO 2
total <- total + shapes[i].area()ENDFOROUTPUT total
studentName <- name
examScore <- score
endnewendclassstudent1.examScore <- 150
library <- new Array(3)
library[0] <- new Book("Harbour Lights", "Amara Osei")
library[1] <- new EBook("The Long Tide", "Fatima Chowdhury", 4)
library[2] <- new PrintBook("Northbound", "Callum Ferguson", "F-12")
FOR i <- 0 TO 2
OUTPUT library[i].getDetails()ENDFOR accountNumber <- accNum
balance <- openingBalance
endnew IF amount > 0 THEN
balance <- balance + amount
ENDIF
enddepositreturn balance endgetBalanceendclass
IF balance >= amount THEN
balance <- balance - amount
return TRUE
ELSE
return FALSE
ENDIFendwithdrawcolour <- col endnew
return colour endgetColour
return 0 endareaendclass
radius <- rad endnew
return pi * radius ^ 2 endareaendclass
width <- w
height <- h
endnewreturn width * height endareaendclass
| i | shapes[i].area() | total |
|---|---|---|
| 0 | 28.27 | 28.27 |
| 1 | 20.00 | 48.27 |
| 2 | 12.57 | 60.84 |
studentName <- name
examScore <- score
endnewreturn examScore endgetExamScore
IF newScore >= 0 AND newScore <= 100 THEN
examScore <- newScore
ENDIF
endsetExamScoreendclass title <- t
author <- a
endnewreturn title + " by " + author endgetDetailsendclass
fileSizeMB <- size endnew
details <- super.getDetails()
return details + " (ebook, " + fileSizeMB + "MB)"
endgetDetailsendclassshelfCode <- code endnew
details <- super.getDetails()
return details + " [Shelf: " + shelfCode + "]"
endgetDetailsendclassThis checks your answers in your browser, stores nothing on a server and needs no account.