Chapter 10 - Multiple Choice Flashcards

1
Q
  1. The extends keyword applies to

❑ a class inheriting from another class.

❑ a variable.

❑ a method.

❑ an expression.

A

a class inheriting from another class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  1. A Java class can inherit from two or more classes.

❑ true

❑ false

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  1. In Java, multiple inheritance is implemented using the concept of

❑ an interface.

❑ an abstract class.

❑ a private class.

A

an interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
  1. Which of the following is inherited by a subclass?

❑ all instance variables and methods

❑ public instance variables and methods only

❑ protected instance variables and methods only

❑ protected and public instance variables and methods

A

protected and public instance variables and methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  1. What Java keyword is used in a class header when a class is defined as inheriting from an interface?

❑ inherits

❑ includes

❑ extends

❑ implements

A

implements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
  1. A Java class can implement one or more interfaces.

❑ true

❑ false

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
  1. How do you instantiate an object from an abstract class?

❑ With any constructor.

❑ With the default constructor only.

❑ You cannot instantiate an object from an abstract class.

A

You cannot instantiate an object from an abstract class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
  1. When a class overrides a method, what object reference is used to call the method inherited from the superclass?

❑ inherited

❑ super

❑ class

❑ methodName

A

super

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
  1. Where should the following statement be located in the body of a subclass constructor?

super( );
❑ It should be the last statement.

❑ It should be the first statement.

❑ It can be anywhere.

A

It should be the first statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
  1. If a class contains an abstract method, then

❑ the class must be declared abstract.

❑ the class is not abstract.

❑ the class may or may not be abstract.

❑ all of the above

A

the class must be declared abstract.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
  1. What can you tell about the following method?

public void myMethod( )
{
}
❑ This method is abstract.

❑ This method is not abstract.

A

This method is not abstract.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly