Login or Create an Account to view the mark scheme, comment, and add to a test
(a).
Two parallel arrays contain the names and telephone numbers of up to 200 people. Both arrays are of type String and unordered. New names are added to the end of the array. The last valid name in the array is followed by the end-of-data marker "XXXX". | [0] | [1] | [2] | [3] | ... | [65] | [66] | ... |[199] names | "Ally" | "Gioia" | "Alan" | "Jordan" | ... | "Max" | "XXXX" | ... | - phone |"123456" | "654321" | "002233" | "334422" | ... | "554433" | - | ... | - (a) State the number of names stored in the above array. [1 mark] (b) Construct a method, findName() , which takes a String parameter representing the phone number and returns the name of the corresponding person, or "XXXX" if the number is not present. [5 marks] (c) Without constructing an algorithm, outline the steps that should be taken to bubble sort the data in order of name. [5 marks] (d) State two reasons why the telephone numbers are stored as String data and not int values. [2 marks] (e) Describe another data structure that could have been used in place of two parallel arrays. [2 marks]
[10]

Extended Response10 MarksShared
2 Uses23 Views1 Like