Documente Academic
Documente Profesional
Documente Cultură
Teachers and candidates should read this material prior to the June 2019 examination for 9608 Paper 2.
Reminders
• there will be questions on the examination paper which do not relate to this pre-release material.
• you must choose a high-level programming language from this list:
Note: A mark of zero will be awarded if a programming language other than those listed is used.
• structured English
• pseudocode
• program code
Some tasks may need one or more of the built-in functions or operators listed in the Appendix at the
end of this document.
Declaration of variables
The syllabus document shows the syntax expected for a declaration statement in pseudocode.
If Python is the chosen language, each variable’s identifier (name) and its intended data type must be
documented using a comment statement.
TASK 1 – Arrays
Introduction
Candidates should be able to write programs to process array data both in pseudocode and in their
chosen programming language. It is suggested that each task is planned using pseudocode before
writing it in program code.
TASK 1.1
A 1D array of STRING data type will be used to store the name of each student in a class together with
their email address as follows:
<StudentName>'#'<EmailAddress>
"Eric Smythe#eric@email.com"
TASK 1.2
Consider what happens when a student leaves the class and their data item is deleted from the array.
Decide on a way of identifying unused array elements and only output elements that contain student
details. Modify your program to include this.
TASK 1.3
Extend your program so that after assigning values to the array, the program will prompt the user to
input a name, and then search the array to find that name and output the corresponding email address.
TASK 1.4
TASK 1.5
Convert your design to use a 2D array and add additional pieces of information for each student.
For example:
TASK 1.6
Do
'2 - User Prompts
Dim name As String
Dim email As String
'6 - Output
Console.WriteLine("Student Name#Email Address")
Console.WriteLine("--------------------------")
For i = 0 to 29
Console.WriteLine(clsRecords(i))
Next
1
Task 1.2
Task 1.3
2
Task 1.4
Task 1.4 Searching a record by inputting full or part of the name and
'
'display the records
'If no records found, flag not be set to True and will remain False.
'This will indicate no record is found in the array.
If flag = False
Console.WriteLine("No Record found!")
End If
3
Task 1.5 and Task 1.6 - Repeating Tasks 1.1 - 1.4 using 2D array
Task 1.1
'4 and 5 - Writing all of the details to the empty blocks of array
'nexetRecord - Acts as a pointer for accessing next row. Each row is responsible to
'hold details of a student
'cond - Gives choice to the user whether to continue or quit
Dim nextRecord As Integer
Dim cond As String
Do
'2 - User prompts
Dim name As String
Dim email As String
Dim dob As String
Dim studentID As String
'3 - All the details of a student are getting added in each of the blocks
'of the inner array
Name of the student is stored in the first block of the row
'
clsRecords(nextRecord, 0) = name
4
'Email address of the student is stored in the second block
clsRecords(nextRecord, 1) = email
'Date of birth of the student is stored in the third block
clsRecords(nextRecord, 2) = dob
'StudentID of the student is stored in the fourth block
clsRecords(nextRecord, 3) = studentID
'Pointer is updated to move to the next row
nextRecord = nextRecord + 1
'6 - Output
Console.Writeline("Student Name#Email Address#Date of Birth#Student ID")
Console.Writeline("---------------------------------------------------")
Task 1.2
For row = 0 t o 29
For col = 0 to 3
To prevent printing empty slots in the console. Each elements or cells
'
'are checked if the slot is empty.
If clsRecords(row, col) <> "---" Then
Console.Write(clsRecords(row, col) & " #")
'After record of a student is displayed, flag is set to true
flag = True
End If
5
Next
'flag = True represents the record of a student is detected and will only
'allow moving to the next line after record of a student is displayed.
'After moving to next line, flag is then again set to False so that if row of
'are not detected, flag will remain False, and we then do not move to the next
'line.
If flag = True Then
Console.Writeline()
flag = False
End If
ext
N
Task 1.3
'Column headers
Console.Writeline("StudentName#EmailAddress#DateofBirth#StudentID")
Console.Writeline("----------------------------------------------")
Dim row1, col1 As Integer
Dim flag1 As Boolean = False
6
nd If
E
Next
If flag1 = True Then
Console.Writeline()
flag1 = False
End if
ext
N
Task 1.4
Dim cond1 As String
Do
im name1 As String
D
Console.Writeline("Enter name: ")
name1 = Console.Readline()
'Column headers
Console.Writeline("StudentName#EmailAddress#DateofBirth#StudentID")
Console.Writeline("----------------------------------------------")
Dim row1, col1 As Integer
Dim flag1 As Boolean = False
7
Next