{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Exam1 - 1CSC216 Fall 2004 Exam 1 Student Name This exam is...

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

View Full Document Right Arrow Icon
]CSC216 Fall 2004 Exam 1 Student Name ____________________________________________________ This exam is closed book and closed notes. There are 105 points (5 points extra credit). You are not required to provide documentation for the code you write. Good luck! Part 1 Java Basics Circle the correct answer(s). (5 points) 1. Consider the following program fragment : Circle first = new Circle (4.); Circle second = first; Which of the following statements is/are true? A. The fragment creates one Circle with two references to it. B. There are two Circles: first and second. C. The second statement creates a copy of the Circle "first". D. A change to Circle "first" has no impact on Circle "second". (5 points) 2. Consider the following definitions: class Person { private String name; private int age; public int getAge () { return age; } } and class PersonList { private Person [] pList; //list of people private int count; //number of people in the list ...methods here } Assume that variable pList has been initialized with data for twenty people. Which of the following correctly tests whether the third person's age is greater than 10? A. pList[2].age > 10 B. Person[2].getAge() > 10 C. Person.pList[2].getAge() > 10 D. pList[2].getAge() > 10 1
Background image of page 1

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

View Full Document Right Arrow Icon
(10 points) 3. Assume a Department class manages an array of Product objects.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}