View the step-by-step solution to:

For the question one. check page 495 Review Questions 1. A way to discover which of two classes is the base class and which is the subclass is to ....

For the question one. check page 495

Review Questions

1. A way to discover which of two classes is the base class and which is the subclass is

to .

a. look at the class size

b. try saying the two class names together

c. use polymorphism

d. Both a and b are correct.



2. Employing inheritance reduces errors because .

a. the new classes have access to fewer data fields

b. the new classes have access to fewer methods

c. you can copy methods that you already created

d. many of the methods you need have already been used and tested

3. A base class can also be called a .

a. child class

b. subclass

c. derived class

d. superclass

4. Which of the following choices is the best example of a parent class/child class

relationship?

a. Rose/Flower

b. Present/Gift

c. Dog/Poodle

d. Sparrow/Bird

5. The Java keyword that creates inheritance is .

a. static

b. enlarge

c. extends

d. inherits


6. A class named Building has a public, nonstatic method named getFloors(). If

School is a child class of Building, and modelHigh is an object of type School, which

of the following statements is valid?

a. Building.getFloors();

b. School.getFloors();

c. modelHigh.getFloors();

d. All of the previous statements are valid.

7. Which of the following statements is true?

a. A child class inherits from a parent class.

b. A parent class inherits from a child class.

c. Both of the preceding statements are true.

d. Neither a nor b is true.

8. When a subclass method has the same name and argument types as a superclass

method, the subclass method the superclass method.

a. overrides

b. overuses

c. overloads

d. overcompensates

9. When you instantiate an object that is a member of a subclass, the

constructor executes first.

a. subclass

b. child class

c. extended class

d. parent class

10. The keyword super always refers to the of the class in which you

use it.

a. child class

b. derived class

c. subclass

d. parent class


11. If the only constructor in a superclass requires arguments, its

subclass .

a. must contain a constructor

b. must not contain a constructor

c. must contain a constructor that requires arguments

d. must not contain a constructor that requires arguments

12. If a superclass constructor requires arguments, any constructor of its subclasses must

call the superclass constructor .

a. as the first statement

b. as the last statement

c. at some time

d. multiple times if multiple arguments are involved


13. A child class Motorcycle extends a parent class Vehicle. Each class constructor

requires one String argument. The Motorcycle class constructor can call the

Vehicle class constructor with the statement .

a. Vehicle("Honda");

b. Motorcycle("Harley");

c. super("Suzuki");

d. none of the above

14. In Java, the concept of keeping data private is known as .

a. polymorphism

b. information hiding

c. data deception

d. concealing fields

15. If you create a data field or method that is , it can be used within its

own class or in any classes extended from that class.

a. public

b. protected

c. private

d. both a and b

16. Within a subclass, you cannot override methods.

a. public

b. private

c. static

d. constructor

17. You call a static method using .

a. the name of its class, a dot, and the method name

b. the name of the class's superclass, a dot, and the method name

c. the name of an object in the same class, a dot, and the method name

d. either a or b

18. You use a method access specifier when you create methods for

which you want to prevent overriding in extended classes.

a. public

b. protected

c. final

d. subclass


19. A compiler can decide to a final method—that is, determine the

code of the method call when the program is compiled.

a. duplicate

b. inline

c. redline

d. beeline

20. When a parent class contains a static method, child classes

override it.

a. frequently

b. seldom

c. must

d. cannot

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question