0% found this document useful (0 votes)
18 views4 pages

8.2 Arrays Model Answers

The document outlines a grading system for students, detailing the requirements for calculating total and average marks, as well as assigning grades based on performance. It specifies the necessary programming techniques and data structures needed to implement the system, including loops for iteration and output. Additionally, it provides example pseudocode to illustrate the implementation of these requirements.

Uploaded by

pomidorovoo946
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views4 pages

8.2 Arrays Model Answers

The document outlines a grading system for students, detailing the requirements for calculating total and average marks, as well as assigning grades based on performance. It specifies the necessary programming techniques and data structures needed to implement the system, including loops for iteration and output. Additionally, it provides example pseudocode to illustrate the implementation of these requirements.

Uploaded by

pomidorovoo946
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Model Answers: Medium

i) Many correct answers, they must be meaningful. This is an example only; [1 mark]

StudentNames[1:30]

ii) Many correct answers, they must be meaningful. This is an example only.
StudentMarksTest1[1:30]
StudentMarksTest2[1:30]
StudentMarksTest3[1:30] (1 mark)
StudentTotalScore[1:30] (1 mark)

[Total: 3 marks]

One mark per mark point (Max 3)

MP1 Correct loop, including counter if not a FOR loop


MP2 Correct output of Score[ ]
MP3 Correct output of Grade[ ]
MP4 Suitable messages/text in output for both arrays

[Total: 3 marks]

Example answers
Count ← 0
REPEAT
PRINT "Student: ", Count, " Mark: ", Score[Count], " Grade:
",Grade[Count]
Count ← Count + 1
UNTIL Count = 30

Count ← 0
WHILE Count < 30 DO
PRINT "Student: ", Count, " Mark: ", Score[Count], " Grade:
",Grade[Count]
Count ← Count + 1
ENDWHILE

FOR Count ← 0 TO 29
PRINT "Student: ", Count, " Mark: ", Score[Count], " Grade: ",
Grade[Count]
NEXT
3

 appropriate loop controls


 read from array
 output from array (the last two points can be in one statement, see example)

Note: reading and the output MUST be within the same loop.

For example:

Count ← 0
WHILE Count < 50 DO
OUTPUT Name[Count]
Count ← Count + 1
ENDWHILE

[Total: 3 marks]

Read the whole answer, award a mark from both of the following tables and add up the total.

Marks are available for:

 AO2 (maximum 9 marks)


 AO3 (maximum 6 marks).

The techniques and the data structures required are listed below. The requirements may be met
using a suitable built-in function from the programming language used (e.g. Python, VB.NET or
Java).

Techniques required:

R1 Calculate total mark for each student (iteration and totalling).


R2 Calculate average mark for each student rounded to the nearest whole number.
R3 Selection of grade for each student (selection).
Output for each student name, total mark, average mark, grade awarded (output with
R4
appropriate messages).
R5 Calculate, store and output the number of distinctions, merits, passes and fails for the
whole class (iteration, counting and output with appropriate messages).

Data structures required:

The names underlined must be used as provided in the scenario.


Arrays or lists StudentName, StudentMark,
(TotalMark and AverageMark may be seen but no requirement to store)

Variables ClassSize, SubjectNo, SubjectCounter, StudentCounter


DistinctionNo, MeritNo, PassNo, FailNo could be an array or
list

Constants Distinction, Merit, Pass could be variables

Example 15 mark answer in pseudocode.

// meaningful identifier names and appropriate data structures


(variables, constants and the
// given arrays) to store all the data required
DECLARE TotalMark : ARRAY[1:50] OF INTEGER
DECLARE AverageMark : ARRAY[1:50] OF INTEGER
DECLARE SubjectCounter : INTEGER
DECLARE StudentCounter : INTEGER
DECLARE DistinctionNo : INTEGER
DECLARE MeritNo : INTEGER
DECLARE PassNo : INTEGER
DECLARE FailNo : INTEGER

CONSTANT Distinction = 70
CONSTANT Merit = 55
CONSTANT Pass = 40

// initialisation processes for this scenario, initialising the


running totals used for
// grades and combined totals
DistinctionNo ← 0
MeritNo ← 0
PassNo ← 0
FailNo ← 0

FOR StudentCounter ← 1 to ClassSize


TotalMark[StudentCounter] ← 0
NEXT StudentCounter

// programming techniques of iteration, selection, totalling,


counting and output are used

FOR StudentCounter ← 1 to ClassSize


FOR SubjectCounter ← 1 to SubjectNo
TotalMark[StudentCounter] ← TotalMark[StudentCounter] +
StudentMark[StudentCounter,
SubjectCounter]
NEXT SubjectCounter
AverageMark[StudentCounter] ← INT((TotalMark[StudentCounter] /
SubjectNo) + 0.5)
OUTPUT "Name ", StudentName[StudentCounter]
OUTPUT "Combined total mark ", TotalMark[StudentCounter]
OUTPUT "Average mark ", AverageMark[StudentCounter]
IF AverageMark[StudentCounter] >= Distinction
THEN
DistinctionNo ← DistinctionNo + 1
OUTPUT "Grade Distinction"
ELSE
IF AverageMark[StudentCounter] >= Merit
THEN
MeritNo ← MeritNo + 1
OUTPUT "Grade Merit"
ELSE
IF AverageMark[StudentCounter] >= Pass
THEN
PassNo ← PassNo + 1
OUTPUT "Grade Pass"
ELSE
FailNo ← FailNo + 1
OUTPUT "Grade Fail"
ENDIF
ENDIF
ENDIF
NEXT StudentCounter

OUTPUT "Number of Distinctions ", DistinctionNo


OUTPUT "Number of Merits ", MeritNo
OUTPUT "Number of Passes ", PassNo
OUTPUT "Number of Fails ", FailNo

[Total: 15 marks]

You might also like