Section 1 (Answer all questions in this section) 1. Why would a programmer use polymorphism rather than sticking to a standard array? Mark for Review (1) Points Because arrays only work using the same object type and polymorphism provides a way around this. (*) Because it is easier to add or remove objects using polymorphism even when all of the objects are of the same type. Because arrays are more complex and polymorphism simplifies them by restricting them to only contain the same type objects. A programmer wouldn't use polymorphism over a standard array. Correct Correct 2. If Sandal extends Shoe, it is possible to declare an object such that Sandal s = new Shoe(); Mark for Review (1) Points True False (*) Correct Correct 3. It is possible to override methods such as equals() and toString() in a subclass of Object to fit the needs of the objects of the subclass. True or false?
Section 1 (Answer all questions in this section) 1. Why would a programmer use polymorphism rather than sticking to a standard array? Mark for Review (1) Points Because arrays only work using the same object type and polymorphism provides a way around this. (*) Because it is easier to add or remove objects using polymorphism even when all of the objects are of the same type. Because arrays are more complex and polymorphism simplifies them by restricting them to only contain the same type objects. A programmer wouldn't use polymorphism over a standard array. Correct Correct 2. If Sandal extends Shoe, it is possible to declare an object such that Sandal s = new Shoe(); Mark for Review (1) Points True False (*) Correct Correct 3. It is possible to override methods such as equals() and toString() in a subclass of Object to fit the needs of the objects of the subclass. True or false?
Static
variable
s can't
use
which of
the
following
modifier
s?
Public
Protected
Friendly (*)
Default
Private
Correct
2. You can assign new values to static variables by prefacing them
with the this keyword and a dot or period. True or false?
Mark for
Review
(1) Points
True (*)
False
Correct
3. You can create static class methods inside any Java class. True or
false?
Mark for
Review
(1) Points
True (*)
False
Correct
4. Which of the following statements about static methods is true?
Mark for
Review
(1) Points
Correct
5. You can return an instance of a private class through a static
method of a different class. True or false?
Mark for
Review
(1) Points
True
False (*)
Correct
6. You can create static classes as independent classes. True or false?
Mark for
Review
(1) Points
True
False (*)
Correct
7. You can use an inner static class to return an instance of its outer
class container. True or false?
Mark for
Review
(1) Points
True (*)
False
Correct
8. A linear recursive method can call how many copies of itself?
Mark for
Review
(1) Points
1 (*)
2 or more
None
Correct
9. Which case does a recursive method call last?
Mark for
Review
(1) Points
Recursive Case
Convergence Case
Basic Case
Base Case (*)
None of the above
Correct
10. A non-linear recursive method can call how many copies of itself?
Mark for
Review
(1) Points
1
2 or more (*)
None
Correct
11. A non-linear recursive method is less expensive than a linear
recursive method. True or false?
Mark for
Review
(1) Points
True
False (*)
Incorrect. Refer to Section 7 Lesson 3.