Question 1
10 marksDid your answer earn the marks?
14 original exam-style questions - 8 pages of questions with a full mark scheme - free printable PDF.
DECLARE scores : ARRAY[0:4] OF INTEGER
scores[0] <- 12
scores[1] <- 45
scores[2] <- 8
scores[3] <- 45
scores[4] <- 19
total <- 0
FOR i <- 0 TO 4
total <- total + scores[i]
NEXT i
average <- total / 5
OUTPUT average DECLARE studentID : INTEGER
DECLARE name : STRING
DECLARE grade : CHARENDTYPEDECLARE student1 : StudentRecord student1.studentID <- 10234 student1.name <- "Amara Okafor" student1.grade <- 'B'
DECLARE stack : ARRAY[0:9] OF INTEGER
DECLARE top : INTEGER
top <- -1
PROCEDURE Push(value : INTEGER)
top <- top + 1
stack[top] <- value
ENDPROCEDURE
FUNCTION Pop() RETURNS INTEGER
DECLARE value : INTEGER
value <- stack[top]
top <- top - 1
RETURN value
ENDFUNCTIONDECLARE cohort : ARRAY[0:29] OF StudentRecord cohort[4].grade <- 'A'
This checks your answers in your browser, stores nothing on a server and needs no account.