Question: 11. Abstract classes may not be: a) inherited b) accessed by derived-classes c) instantiated d) None of the above. 12. Which declaration declares abstract method

11. Abstract classes may not be:

a) inherited

b) accessed by derived-classes

c) instantiated

d) None of the above.

12. Which declaration declares abstract method method1 in abstract class Class1 (method1 returns an int and takes no arguments)?

a) public int method1();

b) public int abstract method1();

c) public abstract int method1();

d) public int nonfinal method1();

13.Which of the following statements about abstract base classes is true?

a) abstract base classes may contain data.

b) abstract base classes may not contain implementations of methods.

c) abstract base classes must declare all methods as abstract.

d) abstract base classes must declare all data members not given values as abstract.

14. Consider the abstract class below:

public abstract class Foo { private int a; public int b; public Foo( int aVal, int bVal ) { a = aVal; b = bVal; } // end Foo constructor public abstract int calculate(); } // end class Foo

Any concrete subclass that extends class Foo:

a) Must implement a method called calculate.

b) Will not be able to access the instance variable a.

c) Will not be able to instantiate an object of class Foo.

d) All of the above.

15. Assigning a derived class reference to a base class variable is safe:

a. because the derived class has an object of its base class.

b. because the derived class is an object of its base class.

c. only when the base class is abstract.

d. only when the base class is concrete.

16. By convention, the name for a Car interface is:

a) InterfaceCar

b) ICar

c) CarI

d) None of the above.

17. The purpose of an interface is to:

a) provide similar objects with the same functionality, even though each will implement the functionality differently

b) provide different types of objects with the comparable functionality, even though each will implement the functionality differently

c) provide default implementations of methods and properties

d) None of the above.

18. Which of the following characteristics could be used to create an interface for a file, a cat and a house?

a) door

b) tail

c) age

d) None of the above.

19. Which of the following does not complete the sentence correctly?

An interface .

a) forces classes that implement it to declare all the interface methods.

b) is used in place of an abstract class when there is no default implementation to

inherit.

c) cannot be instantiated.

d) can be instantiated.

20. Interfaces can have methods.

a) 0

b) 1

c) 2

d) any number of

21. Which is used to specify that a class will be implementing an interface?

a) using

b) :

c) implements

d) extends

22. A class that implements an interface but does not declare all of the interfaces methods must be declared:

a) public

b) interface

c) abstract

d) final

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!