Ready to test your Knowledge?
Try out our new practice tests completely free!
exam preparation banner icon

Quiz 10: Interfaces

arrow
search
arrow
____ methods must be implemented when using an interface.
unlocked
(Multiple Choice)

Answer:

A

arrow
Consider the following code snippet: public class Inventory implements Measurable { ) . . Double getMeasure(); { Return onHandCount; } } The compiler complains that the getMeasure method has a weaker access level than the Measurable interface. Why?
unlocked
(Multiple Choice)

Answer:

B

arrow
Which of the following statements about interfaces is NOT true?
unlocked
(Multiple Choice)

Answer:

C

arrow
Which of the following statements about a Java interface is NOT true?
(Multiple Choice)
arrow
Which of the following statements about an interface is true?
(Multiple Choice)
arrow
Consider the following code snippet. public interface Measurable { Double getMeasure(); } Public class Coin implements Measurable { Public double getMeasure() { Return value; } ).. } Public class DataSet { ).. Public void add() { ).. } } Public class BankAccount { ).. Public void add() { ).. } } Which of the following statements is correct?
(Multiple Choice)
arrow
Consider the following code snippet: public class Inventory implements Measurable { ) . . Double getMeasure(); { Return onHandCount; } } What is wrong with this code?
(Multiple Choice)
arrow
Consider the following code snippet: public class Inventory implements Measurable { ) . . Public double getMeasure(); { Return onHandCount; } } Why is it necessary to declare getMeasure as public ?
(Multiple Choice)
arrow
Which of the following statements about abstract methods is true?
(Multiple Choice)
arrow
Consider the following declarations: public interface Encryptable { Void encrypt(String key); } Public class SecretText implements Encryptable { Private String text; _____________________________ { // code to encrypt the text using encryption key goes here } } Which of the following method headers should be used to complete the SecretText class?
(Multiple Choice)
arrow
To use an interface, a class header should include which of the following?
(Multiple Choice)
arrow
____ can reduce the coupling between classes.
(Multiple Choice)
arrow
Which statement about methods in an interface is true?
(Multiple Choice)
arrow
Suppose you are writing an interface called Resizable, which includes one void method called resize. public interface Resizable { _________________________ } Which of the following can be used to complete the interface declaration correctly?
(Multiple Choice)
arrow
Which of the following statements about converting between types is true?
(Multiple Choice)
arrow
Which of the following statements about interfaces is true?
(Multiple Choice)
arrow
A method that has no implementation is called a/an ____ method.
(Multiple Choice)
arrow
Which of the following statements about interfaces is NOT true?
(Multiple Choice)
arrow
Consider the following code snippet: public interface Sizable { Int LARGE_CHANGE = 100; Int SMALL_CHANGE = 20; Void changeSize(); } Which of the following statements is true?
(Multiple Choice)
arrow
Which of the following is true regarding a class and interface types?
(Multiple Choice)
Showing 1 - 20 of 85
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Not Answered(0)
  • Short Answer(0)
  • True False(0)