Documente Academic
Documente Profesional
Documente Cultură
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)
1. What does it mean to inherit a class?
Mark for
Review
(1) Points
The subclass (or child class) gains access to any non-private methods and
variables of the superclass (or parent class). (*)
The access specifier has been set to private.
A way of organizing the hierarchy of classes.
Extending a method from a superclass.
Mark for
Review
(1) Points
3. What is a UML?
Mark for
Review
(1) Points
Mark for
Review
(1) Points
new
public
extends (*)
this
Mark for
Review
(1) Points
A class that inherits methods and fields from a more general class.
The most specific class of a hierarchy system of classes.
A class that passes down its methods to more specialized classes. (*)
A keyword that allows or restricts access to data and methods.
Mark for
Review
(1) Points
A class that inherits methods and fields from a more general class. (*)
A keyword that allows or restricts access to data and methods.
A class that passes down its methods to more specialized classes.
The most general class of a hierarchy system.
7. Methods are generally declared as public so other classes may use them. True or
false?
Mark for
Review
(1) Points
True (*)
False
8. Which of the following correctly describes the use of the keyword super?
Mark for
Review
(1) Points
9. Which of the following is the proper way to set the public variable length of the
super class equal to 5 from inside the subclass?
Mark for
Review
(1) Points
super.length() = 5
super.length(5)
super.length = 5 (*)
super(length = 5)
10What is a hierarchy?
.
Mark for
Review
(1) Points
Mark for
Review
(1) Points
Anywhere inside the subclass.
Inside the main method of the subclass.
The last line in the constructor of the subclass.
The first line of the constructor in the subclass. (*)
The super constructor does not need to be called inside the subclass.
12It is possible to extend a class that already exists in Java, such as the Applet class.
. True or false?
Mark for
Review
(1) Points
True (*)
False
13Consider creating a class Square that extends the Rectangle class provided below.
. Knowing that a square always has the same width and length, which of the
following best represents a constructor for the Square class?
Mark for
Review
(1) Points
(*)
None of the above.