1 CSE 1030 Introduction to Computer Science II Sample Test 3 1 The classes A , B and C are related as follows. A B C 1 How are these two relations reFected in the implementation of class A ? 2 Consider the classes Named and Contact , the code of which can be found at the end of the test. Consider the following snippet of client code. String name = "Franck"; String address = "franck@cse.yorku.ca"; Contact contact = new Contact(name, address); Draw the memory diagram corresponding to the execution having reached the end of the third line of the above client code. 3 Implement the method sumOfSquares of the class MyMath . ±or a given integer n , with n ≥ 1, this method returns the integer n s i =1 i 2 = 1 + 4 + ··· + ( n-1) 2 + n 2 . Only recursive solutions will receive marks.

This preview
has intentionally blurred sections.
Sign up to view the full version.