Question 8

OCR Computer Science June 2025 Computer systems (H446-01)A level16 marks

On the specification

(a)
1.3 Exchanging data
(b)
1.3 Exchanging data
(c)(i)
1.3 Exchanging data
(c)(ii)
1.3 Exchanging data
(d)
2.2 Problem solving and programming1.3 Exchanging data
Question text

8 Orla is developing a program that will allow candidates to complete quizzes for a range of subjects. Each quiz has three questions and each one is multiple choice with three possible answers. (a) Orla is considering using a flat file database to store data about candidates, and the subjects and quizzes they sit. Explain the limitations of using flat file databases. [4] (b) Due to the limitations of flat file databases, Orla decides to create a relational database containing these four tables: • TblCandidate – Stores data about the candidates • TblSubject – Stores data about the subject • TblQuiz – Stores the questions for each individual quiz and the answers • TblResponse – Stores the candidate’s responses for a given quiz. The fields in each table are shown here. PK indicates the primary keys and FK indicates the foreign keys that are used. TblCandidate TblSubject TblQuiz TblResponse CandidateID(PK) SubjectID(PK) QuizID(PK) ResponseID(PK) CandidateName SubjectName Q1Text Date eMail Description Q1Answer Q1Response PhoneNumber Q2Text Q2Response Q2Answer Q3Response Q3Text Score Q3Answer QuizID(FK) SubjectID(FK) CandidateID(FK) Complete an Entity Relationship Diagram (ERD) to show the relationships between these four tables. TblCandidate TblSubject TblResponse TblQuiz [3] (c) In order to determine what tables were required, Orla used database normalisation. (i) State two requirements for a database to be in Second Normal Form (2NF). 1 2 [2] (ii) State two requirements for a database to be in Third Normal Form (3NF). 1 2 [2] (d) Orla wants a web based version of the quiz. She develops a function called checkAnswers to calculate the score of each quiz on the client side using JavaScript. Next to each candidate answer is an empty HTML element. When the user presses submit, the function, checkAnswers, will check if each answer is correct. If so, it will add the word "Correct" into the empty HTML element. The function, checkAnswers takes three parameters: • responses – an array of the IDs of the HTML elements that contains the user’s responses. • feedbacks – an array of the IDs of the HTML elements that the text "Correct" is to be written to if the candidate gets the question right. The array will be the same length as responses. • answers – an array of the correct answer for each of the questions. The array will be the same length as responses. The function returns the final score out of three for the quiz. It loops through each question to calculate if the candidate got it correct and processes it appropriately if they did. Complete the function checkAnswers, using pseudocode or program code. function checkAnswers(responses, feedbacks, ) { var = 0; for(var qCount = 0; qCount < responses.length; qCount++) { response = document.getElementById(responses[qCount]).innerHTML; answer = answers[ ]; feedbackElement = document.getElementById(feedbacks[qCount]); if (response == answer) { score = feedbackElement.innerHTML = "Correct"; } } score; } [5]