Question 1
3 marksDid your answer earn the marks?
20 original exam-style questions - 11 pages of questions with a full mark scheme - free printable PDF.
total <- 0 count <- 0 FOR i <- 1 TO 5 total <- total + n[i] count <- count + 1 NEXT i a <- total / count OUTPUT a
total <- 0
count <- 0
numbers <- [12, 7, 25, 3, 18]
FOR i <- 0 TO 4
IF numbers[i] > 10 THEN
total <- total + numbers[i]
count <- count + 1
ENDIF
NEXT i
OUTPUT total
OUTPUT countcount <- 0
REPEAT
INPUT mark
count <- count + 1
IF mark < 0 OR mark > 100 THEN
OUTPUT "Invalid, try again"
ENDIF
UNTIL mark >= 0 AND mark <= 100
OUTPUT "Valid mark entered after ", count, " attempt(s)"REPEAT
INPUT number
IF number < 1 OR number > 10 THEN
OUTPUT "Invalid, please try again"
ENDIF
UNTIL number >= 1 AND number <= 10
OUTPUT numbertotal <- 0
count <- 0
INPUT score
WHILE score <> -1
IF score >= 0 AND score <= 100 THEN
total <- total + score
count <- count + 1
ENDIF
INPUT score
ENDWHILE
average <- total / count
OUTPUT averageThis checks your answers in your browser, stores nothing on a server and needs no account.