7 A teacher is designing a program to perform simple syntax checks on programs written by students. Two global 1D arrays are used to store the syntax error data. Both arrays contain 500 elements. • Array ErrCode contains integer values that represent an error number in the range 1 to 800. • Array ErrText contains string values that represent an error description. The following diagram shows an example of the arrays. Index ErrCode ErrText 1 10 "Invalid identifier name" 2 20 "Bracket mismatch" 3 50 "Undeclared variable" 4 60 "Type mismatch in assignment" ... 500 999 <Undefined> Note: • There may be less than 500 error numbers so corresponding elements in both arrays may be unused. Unused elements in ErrCode have the value 999. The value of unused elements in ErrText is undefined. • Values in the ErrCode array are stored in ascending order but not all values may be present, for example, there may be no error code 31. The teacher has defined two program modules as follows: Module Description OutputError() • takes two parameters as integers: o a line number in the student's program o an error number • searches for the error number in the ErrCode array: o if found, outputs the corresponding error description and the line number, for example: "Bracket mismatch on line 34" o if not found, outputs the line number and a warning, for example: "Unknown error on line 34" SortArrays() • sorts the arrays into ascending order of ErrCode
✓ Correct Answer
The correct answer is —. This question tests the candidate's understanding of algorithms within the Computer Sciencesyllabus. The examiner's mark scheme requires...
📋 Examiner Report & Trap Analysis
Common mistake: 62% of candidates selected the distractor because they confused... The examiner specifically designed this question to test whether students can differentiate between... To secure full marks, candidates must demonstrate...
Unlock the Examiner's Answer
Sign up for free to reveal the correct answer, the official mark scheme breakdown, and the examiner trap analysis for this question.
Sign Up Free to Unlock →Join thousands of Cambridge students already using Oracle Prep