Note AcademyNote Academy

Computer Science (AS & A Level) · Oct / Nov 2022 · Paper 23 · Question 7

9618

As printed in the paper

The question as text

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 "" 4 60 "Type mismatch in assignment" ... 500 999 <Undefined> Note: • There are less than 500 error codes so corresponding elements in both arrays may be unused. Unused elements in ErrCode have the value 999. These will occur at the end of the array. 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. • Some error numbers are undefined. In these instances, the ErrCode array will contain a valid error number but the corresponding ErrText element will contain an empty string. The teacher has defined one program module as follows: Module Description OutputRange() • Prompts for input of two error numbers • Outputs a list of error numbers between the two numbers input (inclusive) together with the corresponding error description • Outputs a warning message when the error description is missing as for error number 50 in the example • Outputs a suitable header and a final count of error numbers found Output based on the example array data above: List of error numbers from 1 to 60 10 : Invalid identifier name 20 : Bracket mismatch 50 : Error Text Missing 60 : Type mismatch in assignment 4 error numbers output

Read automatically from the paper; the printed page above is exact.

Show the answer and mark scheme
  • 7(a)[8]

  • 7(b)(i)[6]

  • 7(b)(ii)[3]

Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.