Question
Q 13 Which of the following is the syntax to invoke the parent's constructor? this.ConstructorName(...); none of these is correct ConstructorName(...); new ConstructorName(...); super.ConstructorName(...); this(...);
Q 13
Which of the following is the syntax to invoke the parent's constructor?
| this.ConstructorName(...); |
| none of these is correct |
| ConstructorName(...); |
| new ConstructorName(...); |
| super.ConstructorName(...); |
| this(...); |
| super(...); |
Q 14
In a child class constructor, if you do not explicitly call a parent constructor, then no parent constructor is ever called.
| True |
| False |
Q 15
When you overload a method, the type, order, and number of parameters must exactly match the original method.
| True |
| False |
Q 16
When you override a method, the type, order, and number of parameters must exactly match the original method.
| True |
| False |
Q 17
The equals method inherited from Object determines:
| whether two variable references have the same values for their instance data variables. |
| whether two variable references have the same type. |
| whether two variable references refer to the same memory location (meaning they are aliases). |
| none of these is correct |
Q 18
Declaring a method final means that
| it cannot be accessed from outside its class. |
| it cannot be accessed through an invoking object. |
| it cannot be overridden. |
| it cannot be overloaded. |
Q 19
Consider the classes below, declared in the same package.
public class A { private int a; public A() { a = 7; } } public class B extends A { private int b; public B() { b = 8; } }
Select whether each of the following is true or false.
A variable of type B can be treated as a reference of type A. (B is an A.)
[ Choose ]truefalse
A reference of type A can be treated as a reference of type B. (A is a B.)
[ Choose ]truefalse
a is an instance variable
[ Choose ]truefalse
b is an instance variable.
[ Choose ]truefalse
A variable of type A has two int characteristics as its instance data.
[ Choose ]truefalse
A variable of type B has two int characteristics as its instance data.
[ Choose ]truefalse
After the constructor for class B executes, the variable a will have the value 7.
[ Choose ]truefalse
After the constructor for class B executes, b will have the value 8.
[ Choose ]truefalse
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