CSCI 2010 - Quiz 1 2026.
Only one constructor may be defined per class. False
What is a method? A member of a class that defines an operation on an object.
A classed called Printer has a method called printPage(4);
printDocument. This calls a void method in the Printer
class called printPage that takes an integer
representing the page number as an argument. How
should printDocument call printPage with an argument
of 4?
Given a class called Rectangle with a constructor that Rectangle rect = new Rectangle(8.2, 3.5);
takes two doubles as arguments representing the
dimensions, which of the following is the correct way
to invoke that constructor?
3/21/2026, 8:55:01 PM 3/21/2026, 8:55:03 PM 3/21/2026, 8:54:57 PM
, CSCI 2010 - Quiz 1 2026.
Consider the following code: emp1 refers to the object with the name Anna Karenina. emp2 refers to the
same object.
Employee emp1 = new Employee();
emp1.setName("Anna Karenina");
Employee emp2 = new Employee();
emp2.setName("David Copperfield"):
emp2 = emp1;
Which of the following best describes the contents of
the two variables emp1 and emp2 after this code has
executed?
Given the following method header: public double computeArea(double length)
public double computeArea(double length, double
width)
Which of the following would be a legal overloaded
method in the same class?
3/21/2026, 8:55:01 PM 3/21/2026, 8:55:03 PM 3/21/2026, 8:54:57 PM
, CSCI 2010 - Quiz 1 2026.
When calling a method from another method in the True
same class, the form methodName() is equivalent to
this.methodName().
Regular methods may be overloaded, but a False
constructor may not be overloaded.
All methods must return a value. False
What is the difference between a static variable and A static variable is shared by all objects of a class. Every object has its own
an instance variable? version of an instance variable.
What is decompostion? A design strategy that breaks a task down into several subtasks.
What is the difference between an accessor method An accessor method returns data contained in an instance variable. A mutator
(or getter) and a mutator method (or setter)? method modifies data contained in an instance variable.
3/21/2026, 8:55:01 PM 3/21/2026, 8:55:03 PM 3/21/2026, 8:54:57 PM
, CSCI 2010 - Quiz 3 2026.
How is the inheritance relationship represented in a By an arrow pointing from the derived class to the base class.
UML diagram?
Assume that Mammal is a subclass of Animal and Dog dog = animal;
is a subclass of Mammal.
Given the following declarations:
Animal animal;
Mammal mammal;
Dog dog;
Which of the following statements is not legal?
3/21/2026, 8:55:01 PM 3/21/2026, 8:55:03 PM 3/21/2026, 8:54:57 PM
Only one constructor may be defined per class. False
What is a method? A member of a class that defines an operation on an object.
A classed called Printer has a method called printPage(4);
printDocument. This calls a void method in the Printer
class called printPage that takes an integer
representing the page number as an argument. How
should printDocument call printPage with an argument
of 4?
Given a class called Rectangle with a constructor that Rectangle rect = new Rectangle(8.2, 3.5);
takes two doubles as arguments representing the
dimensions, which of the following is the correct way
to invoke that constructor?
3/21/2026, 8:55:01 PM 3/21/2026, 8:55:03 PM 3/21/2026, 8:54:57 PM
, CSCI 2010 - Quiz 1 2026.
Consider the following code: emp1 refers to the object with the name Anna Karenina. emp2 refers to the
same object.
Employee emp1 = new Employee();
emp1.setName("Anna Karenina");
Employee emp2 = new Employee();
emp2.setName("David Copperfield"):
emp2 = emp1;
Which of the following best describes the contents of
the two variables emp1 and emp2 after this code has
executed?
Given the following method header: public double computeArea(double length)
public double computeArea(double length, double
width)
Which of the following would be a legal overloaded
method in the same class?
3/21/2026, 8:55:01 PM 3/21/2026, 8:55:03 PM 3/21/2026, 8:54:57 PM
, CSCI 2010 - Quiz 1 2026.
When calling a method from another method in the True
same class, the form methodName() is equivalent to
this.methodName().
Regular methods may be overloaded, but a False
constructor may not be overloaded.
All methods must return a value. False
What is the difference between a static variable and A static variable is shared by all objects of a class. Every object has its own
an instance variable? version of an instance variable.
What is decompostion? A design strategy that breaks a task down into several subtasks.
What is the difference between an accessor method An accessor method returns data contained in an instance variable. A mutator
(or getter) and a mutator method (or setter)? method modifies data contained in an instance variable.
3/21/2026, 8:55:01 PM 3/21/2026, 8:55:03 PM 3/21/2026, 8:54:57 PM
, CSCI 2010 - Quiz 3 2026.
How is the inheritance relationship represented in a By an arrow pointing from the derived class to the base class.
UML diagram?
Assume that Mammal is a subclass of Animal and Dog dog = animal;
is a subclass of Mammal.
Given the following declarations:
Animal animal;
Mammal mammal;
Dog dog;
Which of the following statements is not legal?
3/21/2026, 8:55:01 PM 3/21/2026, 8:55:03 PM 3/21/2026, 8:54:57 PM