Mark Allocation

Solutions to the practice exam are not publicly available. This document indicates how marks are awarded for the concepts in each of the questions. Mark Allocations are not shown for simple questions where the emphasis of the questions is abundantly clear.

Question 2

d)

Key points: calling the constructor of the superclass rather than try to access the private instance variables, initialization of all new instance variables in the subclass.

g)

Key point is to use the method from the superclass.

h)

Key points: looping to length of array, calling the overloaded method getStickerPrice() thereby making use of polymorphism, returning a method value, and realizing that you do not need an if statement to process the different vehicle types.

Question 3

 

4 marks were given for the correct data values (correctly processing the nested loops); the other 2 marks were given for correctly formatting the output on output lines (print vs. println)

Question 4

 

Song constructor initializes instance variables. 2 marks

 

CD Constructor, properly reading information from file. 3 marks

 

CD Constructor, create array of songs of proper size and instantiate each of the songs. 5 marks.

 

MusicCollection Constructor, for TextInput open and close. 2 marks

 

MusicCollection Constructor, looping until reach eofIsAvaiable(). 1 mark

 

MusicCollection Constructor, enlarging the array and checking size. 5 marks

 

MusicCollection Constructor, declare array and keep a count of number of entries. 4 marks

 

A completely acceptable alternate solution for the MusicCollection constructor involves reading from the file into an ArrayList, and then copying from the ArrayList to the array.

Question 5

b)

Reasonable instance variables (e.g. minutes and seconds as ints). 2 marks

 

At least two overloaded constructors. 2 marks

 

Some method for comparing two times, with appropriate signature. 2 marks

 

Method to add times together, with appropriate signature. 1 mark.

 

Any accessor or toString() method (basically, any other method). 1 mark

Question 6

 

Looping through CDs properly and within that, looping through the songs including proper array references, access to array elements, and proper bounds on loop structure. 7 marks

 

Determining if song is shorter – comparison test, accessing playing time. 3 marks

 

Creating second array, proper syntax, proper size of new array. 3 marks

 

Copying proper songs to the new array, and returning the array as method result. 4 marks

 

Use of stepwise refinement (helper methods) 3 marks.

Question 7

 

Creating of proper GUI source component with label. Proper syntax is important since constructor signature is provided. 2 marks

 

Adding component so that it is displayed. Syntax need not be exact. 2 marks

 

Instantiating listener object and attaching it to the source component. Syntax is important since method signature is provided. 3 marks

 

Creation of private inner class with proper method signature. Syntax is important since method signature is provided. 2 marks

 

Get string from proper source component. Syntax need not be exact. 2 marks

 

Call appropriate application method with proper parameters. 3 marks.