QUESTION 1 Object are just memory addresses and can be assigned to one another w
ID: 3825723 • Letter: Q
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 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 D’s 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.
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
Any name the programmer wishes except the name of the class
None of the above
myClass()
private myClass()
public myClass()
Explanation / Answer
1) False. It is true that objects are just memory address. But they cannot be assigned with out regard to type.
2) True. As D is derived from B, D is the derived class and B is the base class.
3) False. The programmer can extend the class even without the knowlede of the source code of the package.
4) True. The table lookup happens at runtime.
5) True. this refers to the same object, so it can used to access methods of the same object.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.