Question: QUESTION 1 Object are just memory addresses and can be assigned to one another without regard to type. True False 2 points QUESTION 2 If
QUESTION 1
Object are just memory addresses and can be assigned to one another without regard to type.
True
False
2 points
QUESTION 2
If class D is derived from class B, we speak of D as the derived class and B as the base class.
True
False
2 points
QUESTION 3
A programmer must have the source code for packages to extend them, even using inheritance.
True
False
2 points
QUESTION 4
In Java, virtual functions definitions are implemented with a table look up that is done at run time from a base class object.
True
False
2 points
QUESTION 5
One can use the this object to access variables from the object that the method is a member of.
True
False
2 points
QUESTION 6
No objects can be defined of abstract base class type since it is an incomplete definition.
True
False
2 points
QUESTION 7
If B is a public base class of D, then Ds members cannot invoke public members functions of B.
True
False
3 points
QUESTION 8
If a class is named myClass, what must the constructor be named?
| Any name the programmer wishes except the name of the class | ||
| None of the above | ||
| myClass() | ||
| private myClass() | ||
| public myClass() |
4 points
QUESTION 9
The first and last indexes in an array named ar are:
| 0 and ar.length | ||
| 1 and ar.length | ||
| 0 and ar.length - 1 | ||
| 1 and ar.length - 1 |
4 points
QUESTION 10
Suppose class Child is derived from class Parent that was in turn derived from class GrandParent. When we declare an object of class Child, three constructors are called: i) Child, ii) Parent, iii )GrandParent.. What is the order?
| GrandParent, Child, Parent | ||
| GrandParent, Parent, Child | ||
| Parent, GrandParent, Child | ||
| Child, Parent, GrandParent | ||
| GrandParent, Child, Parent |
4 points
QUESTION 11
Template classes such as ArrayLists may be used to make available a very large collection of _____.
| basic data types | ||
| files | ||
| none of the above. | ||
| programs | ||
| objects |
4 points
QUESTION 12
How many times is the following code invoked by the call call_me(4)?
public void call_me(int i){
if (i < 8){
System.out.print(i + " ");
call_me(i--);
}
}
| 1 | ||
| 2 | ||
| 8 | ||
| 128 | ||
| The int would be underflowed | ||
| This is would cause an infinite loop |
4 points
QUESTION 13
The ability to reuse objects already defined, with modification appropriate to the new purpose, is referred to as
| Information hiding | ||
| Overloading | ||
| Redefinition | ||
| Inheritance |
3 points
QUESTION 14
Consider the class inheritance.
class B{ private int b; B(){} B(int b){} public void f(){} public void g(){} } class D extends B{ public double d; D(int b, double d); public void h(); }
Which of the following functions can be invoked by an object of class D?
| f() | ||
| g() | ||
| h() | ||
| All of the above. | ||
| None of the above |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
