Question 3(c) 2021 · May-June · Paper 42 · 5 marks
Reveal official mark-scheme answer
Official answer for Question 3
Part (c)
Question 1
mark per bullet
Question 5
- Instance of QuizClass …
- … with no parameters with identifier FirstQuiz
- Instance of QuestionClass …
- … with correct parameters and identifier Question1
- Question added to FirstQuiz using function AddQuestion
Show text version of question
Question 3
Part (c)
Question 3
Ejaz is creating a program that will allow the user to create quizzes. He is using object-oriented
programming (OOP).
There are two classes: QuestionClass and QuizClass.
The class attributes and methods are in the following tables. All attributes are declared as private.
QuestionClass
Question : STRING // stores the question
Answer : STRING // stores the correct answer
Difficulty : INTEGER // stores the difficulty as an integer // from 0(easy) to 10(hard) Constructor(QuestionP, AnswerP, // creates an instance of QuestionClass DifficultyP) // sets the attributes to the parameter // values
GetQuestion() // returns the question
GetDifficulty() // returns the difficulty level
GetAnswer() // returns the answer
QuizClass
// stores maximum 20 questions of Questions : ARRAY[0:19] OF QuestionClass // type QuestionClass
// stores the number of questions NumberOfQuestions : INTEGER // in this quiz // creates an instance of Constructor() // QuizClass // initialises NumberOfQuestions // to 0
// adds the parameter question to AddQuestion() // the array // increments NumberOfQuestions
// returns the next question to be GetQuestion() // asked
// takes an answer as a parameter CheckAnswer() // and returns TRUE if correct
Question 9
Part (c)
The first quiz is created with the identifier FirstQuiz.
The first question in this quiz is: “What is 100 / 5 ?”.
The answer is “20” and the difficulty level is 1.
Write program code to:
- declare an instance of QuizClass with the identifier FirstQuiz
- declare an instance of QuestionClass with the identifier Question1
- add Question1 to the array in FirstQuiz using AddQuestion().
Programming language .................................................................
Program code
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Question 11
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
Why this question appears here
98% assigned-topic match · Further programming › Programming paradigms
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9608_s21_qp_42.pdf
