Submitted by c-admin on Wed, 05/29/2019 - 00:40
Which of the following statements are true?
Select 2 options
A. The extends keyword is used to specify inheritance.
B. subclass of a non-abstract class cannot be declared abstract.
C. subclass of an abstract class can be declared abstract.
D. subclass of a final class cannot be abstract.
E. A class, in which all the members are declared private, cannot be declared public.
Submitted by c-admin on Wed, 05/29/2019 - 00:30
What should be inserted in the code given below at line marked //10:
class MyClass{
}
class MyComparable implements Comparable<MyClass>{
public int compareTo( *INSERT CODE HERE* x ){ //10
return 0;
}
}
Select 1 option
A. Object
B. MyClass
C. Object<MyClass>
D. Comparable<MyClass>
E. Comparable
Submitted by c-admin on Wed, 05/29/2019 - 00:27
Consider this code:
interface X1{ }
interface X2{ }
class A { }
class B extends A implements X1{ }
class C extends B implements X2{
D d = new D();
}
class D { }
Which of the following statements are true?
Select 3 options
A. D is-a B.
B. B has-a D.
C. C is-a A
D. C is-a X1
E. C is-a X2
Submitted by c-admin on Wed, 05/29/2019 - 00:22
Which of these statements about interfaces are true?
Select 3 options
A. Interfaces permit multiple implementation inheritance.
B. Unlike a class, an interface can extend from multiple interfaces.
C. Members of an interface are never static.
D. Members of an interface may be static.
E. Interfaces cannot be final.
Submitted by c-admin on Wed, 05/29/2019 - 00:19
Given:
interface Worker {
void performWork();
} class FastWorker implements Worker {
public void performWork(){ }
}
You are creating a class that follows "program to an interface" principle. Which of the following line of code will you most likely be using?
Select 1 option
A. public FastWorker getWorker(){ return new Worker(); }
B. public FastWorker getWorker(){ return new FastWorker(); }
C. public Worker getWorker(){ return new FastWorker(); }
D. public Worker getWorker(){ return new Worker(); }
Pages