Question: Question F The List method add() depends on the specific representation (instance variables and structure) of each particular list implementation. Where does it make the

Question F

The List method add() depends on the specific representation (instance variables and structure) of each particular list implementation. Where does it make the most sense for the add() method to be implemented?

In a concrete super class, like Object

In a concrete class, like ArrayList or LinkedList

In an abstract class, like AbstractList or AbstractCollection

In an interface, like List or Collection

Question I

Which of the following statements is correct about inheritance and interfaces?

A class can extend at most one class and can implement multiple interfaces.

A class can extend multiple classes and can implement at most one interface.

A class can extend multiple classes and can implement multiple interfaces.

A class can extend at most one class and can implement at most one interface.

Question J

Which of the following is true about interface types and abstract classes?

An interface type cannot have constants whereas an abstract class can.

An interface can provide method implementation whereas an abstract class cannot.

An interface type cannot have instance variables whereas an abstract class can.

An interface type cannot be instantiated whereas an abstract class can.

Question K

Which of the following statements about an interface is true?

An interface has neither methods nor instance variables.

An interface has methods but no instance variables.

An interface has methods and instance variables.

An interface has both public and private methods.

Question L

Using the given definition of the Measurable interface:

public interface Measurable { double getMeasure(); }

Consider the following code snippet, assuming that BankAccount has a getBalance() method and implements the Measurable interface by providing an implementation for the getMeasure method:

Measurable m = new BankAccount(); System.out.println(m.getBalance());

Which of the following statements is true?

The code does not compile because you cannot assign a BankAccount object to a variable of type Measurable.

The code compiles but generates an exception at run time because a Measurable object reference does not have a getBalance method.

The code does not compile because a variable of type Measurable does not have a getBalance method.

The code executes, displaying the balance of the bank account.

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!