Question
Question 1 Not yet answered Marked out of 1.00 Flag question Question text Which of the following would cause a syntax error? Select one: a.
Question 1
Not yet answered
Marked out of 1.00
Flag question
Question text
Which of the following would cause a syntax error?
Select one:
a. A sub class reference variable referencing an object of the sub class type
b. A sub class reference variable referencing an object of the type of the sub class's super class
c. A super class reference variable referencing an object of the super class type
d. A super class reference variable referencing an object of the type of one of its sub classes
e. If you think none of the above will cause a syntax error, select this option
Question 2
Not yet answered
Marked out of 1.00
Flag question
Question text
Which of the following is not true about a set of methods that are usefully polymorphic?
This question only considers inheritance-based polymorphism i.e. it does not consider Interfaces.
Select one:
a. They must have identical signatures and therefore belong to separate classes
b. Their classes share a common ancestor class from which they are ultimately inherited
c. Each should produce a specialised effect appropriate to their class and therefore different to each other
d. To be invoked polymorphically, an object of their class's type must be referenced by a variable of an ancestor's type common to all of them
e. If you think all of the above are true, select this option
Question 3
Not yet answered
Marked out of 1.00
Flag question
Question text
Of the three Rules presented in the pre-reading material which of the following make polymorphism possible in Java?
Select one:
a. Rule 1
b. Rule 2
c. Rule 3
d. Rule 1 and 2
e. Rule 2 and 3
f. Rule 1 and 3
g. Rule 1,2 and 3
Question 4
Not yet answered
Marked out of 1.00
Flag question
Question text
Of the three Rules presented in the pre-reading material which of the following create a situation where downcasting is necessary?
Select one:
a. Rule 1
b. Rule 2
c. Rule 3
d. Rule 1 and 2
e. Rule 2 and 3
f. Rule 1 and 3
g. Rule 1, 2 and 3
Question 5
Not yet answered
Marked out of 1.00
Flag question
Question text
Of the three Rules presented in the pre-reading material which of the following make upcasting possible?
Select one:
a. Rule 1
b. Rule 2
c. Rule 3
d. Rule 1 and 2
e. Rule 2 and 3
f. Rule 1 and 3
g. Rule 1,2 and 3
Question 6
Not yet answered
Marked out of 1.00
Flag question
Question text
We used an array of the Employee super class to demonstrate both inheritance-based and Interface-based polymorphism. Is an array an essential part of such demonstrations?
i.e. can you think of a scenario that demonstrates useful polymorphism but doesn't require an array?
Select one:
a. Yes but only for inheritance-based polymorphism
b. Yes but only for Interface-based polymorphism
c. Both cases require an array
d. Neither case requires an array
Question 7
Not yet answered
Marked out of 1.00
Flag question
Question text
Which of the following is false about the methods of an interface?
Select one:
a. They do not have a body
b. They are semantically the same as abstract methods
c. Except for the keywords "abstract" and "public" they are syntactically the same as abstract methods
d. They can have parameters
e. They must have a return type or void
f. Select this option if you think none of the above are false
Question 8
Not yet answered
Marked out of 1.00
Flag question
Question text
Which of the following is false with respect to downcasting.
Select one:
a. It can be done without declaring a new variable
b. It's necessary when you want to invoke a method available in the object's class but not in its reference variable's class
c. The downcast must always be to the object's class
d. You can only downcast between classes and/or interfaces connected in a class/Interface hierarchy
e. Select this option if you think none of the above are false
Question 9
Not yet answered
Marked out of 1.00
Flag question
Question text
Suppose an abstract class implements an Interface. Where must that interface's methods be implemented?
Select one:
a. In the abstract class
b. In all the abstract class's direct, non-abstract sub classes
c. In at least one of the abstract class's direct, non-abstract sub classes
d. In all of the abstract class's descendant, non-abstract classes
e. In at least one of the abstract class's descendant, non-abstract classes
Question 10
Not yet answered
Marked out of 1.00
Flag question
Question text
If I have a BasePlusCommissionEmployee object referenced by an Employee variable which of the following downcasts will allow me to retrieve the object's commission rate?
Select one:
a. No downcast, use the Employee reference
b. Downcast to CommissionEmployee
c. Downcast to BasePlusCommissionEmployee
d. Select this option if you think more than one of the above will allow the retrieval of the object's commission rate
e. Select this option if you think none of the above will allow the retrieval of the object's commission rate
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started