Midterm Exam1

Midterm Exam1 - Midterm Exam #1 (100 Points Total) CS20,...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 Midterm Exam #1 (100 Points Total) CS20, Spring, 2004 1.(7 points) If a class implements the interface Comparable, describe the method(s) that need to be included? Be sure to incl u 2.(3 points) Give 3 examples of Comparable types. 3. You implemented class Student. What if you implemented class CollegeStudent, which extended class Student and added t h a)(2 points) What new methods would need to be defined? b) (1 point) Can you cast an object of class Student to be a CollegeStudent? c) (1 point) Can you cast an object of class CollegeStudent to be a Student? d) (2 points) What is the general rule? Background for problems 4-10. Assume an abstract data type for list, which includes the following methods. Positions are 0-b a 1. void add(int position, Object entry) 2. void addToFront( Object entry ) 3. void addToBack( Object entry ) 4. Object remove( givenPosition) 5. Object removeFromFront( ) 6. Object removeFromBack( ) 7. Object replace( givenPostion, newEntry) 7 4. (10 points)If myList is an empty list, what does it contain after the following statements execute?
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/08/2008 for the course CS 20 taught by Professor Agrawal during the Spring '08 term at UCSB.

Page1 / 4

Midterm Exam1 - Midterm Exam #1 (100 Points Total) CS20,...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online