The pseudocode algorithm below uses random file access to copy 50 records from a live file CurrentResults.dat to a stored file StoredResults.dat one record at a time. It uses the user-defined type StudentResult. TYPE StudentResult DECLARE LastName : STRING DECLARE FirstName : STRING DECLARE ExamGrade : STRING ENDTYPE If any grades are missing in CurrentResults.dat, the text "Missing grade" is added to the ExamGrade field in StoredResults.dat Complete this file handling pseudocode algorithm. DECLARE Grade : StudentResult DECLARE Position : INTEGER OPENFILE "StoredResults.dat" FOR RANDOM SEEK "CurrentResults.dat", Position GETRECORD "CurrentResults.dat", Grade IF Grade.ExamGrade = "" THEN ENDIF NEXT Position CLOSEFILE "CurrentResults.dat" CLOSEFILE "StoredResults.dat"
- The pseudocode algorithm below uses random file access to copy 50 records from a live file CurrentResults.dat to a stored file StoredResults.dat one record at a time. It uses the user-defined type StudentResult. TYPE StudentResult DECLARE LastName : STRING DECLARE FirstName : STRING DECLARE ExamGrade : STRING ENDTYPE If any grades are missing in CurrentResults.dat, the text "Missing grade" is added to the ExamGrade field in StoredResults.dat Complete this file handling pseudocode algorithm. DECLARE Grade : StudentResult DECLARE Position : INTEGER OPENFILE "StoredResults.dat" FOR RANDOM SEEK "CurrentResults.dat", Position GETRECORD "CurrentResults.dat", Grade IF Grade.ExamGrade = "" THEN ENDIF NEXT Position CLOSEFILE "CurrentResults.dat" CLOSEFILE "StoredResults.dat"[5]
Mark scheme
Marking points from the official mark scheme (May/June 2025). The mark or mark type is shown in brackets.
- DECLARE Grade : StudentResult
- DECLARE Position : INTEGER
- OPENFILE "CurrentResults.dat" FOR RANDOM
- OPENFILE "StoredResults.dat" FOR RANDOM
- FOR Position ← 1 TO 50
- SEEK "CurrentResults.dat", Position
- GETRECORD "CurrentResults.dat", Grade
- IF Grade.ExamGrade = "" THEN
- Grade.ExamGrade ← "Missing grade"
- ENDIF
- SEEK "StoredResults.dat", Position
- PUTRECORD "StoredResults.dat", Grade
- NEXT Position
- CLOSEFILE "CurrentResults.dat"
- CLOSEFILE "StoredResults.dat"
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 →