A pseudocode algorithm finds a customer account record in a random file and outputs it. The records are stored using the user-defined data type TAccount. TYPE TAccount DECLARE AccountNumber : INTEGER DECLARE LastName : STRING DECLARE FirstName : STRING DECLARE Address : STRING DECLARE ContactNumber : STRING ENDTYPE
- (a)Complete the file handling pseudocode. The function Hash() takes the customer account number as a parameter, calculates and returns the hash value. DECLARE Customer : TAccount DECLARE Location : INTEGER DECLARE AccountFile : STRING - "AccountRecords.dat" AccountFile OUTPUT "Please enter an account number" INPUT Customer.AccountNumber Location ← Hash ( .) SEEK , Location AccountFile, OUTPUT Customer // output customer record CLOSEFILE AccountFile[5]
- (b)Define the term exception handling.[1]
- (c)State two possible causes of an exception.[2]
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2023). The mark or mark type is shown in brackets.
- [1] One mark for each correctly completed line (Max 5)
- [1] One mark for correct definition (Exception handling is the process of) responding to an unexpected event when the program is running so it does not halt unexpectedly
- [1] One mark per mark point (Max 2), for example: Programming errors
- [1] User errors
- [1] Hardware failure
- [1] Runtime errors
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →