InfyTQ Abstarct, final and Interfaces Quiz 2

Question 1

Time: 00:00:00
What are the contents of an Interface?

static, final variables and method declaration

static, final variables and method declaration

non-static variables and method definition

non-static variables and method definition

method name and method definition

method name and method definition

non-abstract methods

non-abstract methods

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Which of the following statements is false with respect to abstract classes and methods?

An abstract class is declared using the abstract keyword

An abstract class is declared using the abstract keyword

An abstract method is declared without the implementation.

An abstract method is declared without the implementation.

An abstract class should contain only abstract methods.

An abstract class should contain only abstract methods.

An abstract class cannot be instantiated.

An abstract class cannot be instantiated.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
An abstract class can:

Have class members such as private and protected.

Have class members such as private and protected.

Implement multiple java interfaces.

Implement multiple java interfaces.

Contain non-final,static and non-static variables.

Contain non-final,static and non-static variables.

All of the above

All of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
What is the correct way of declaring an abstract class in java?

abstract Myclass { //methods and variables }

abstract Myclass { //methods and variables }

abstract Myclass [ //methods and variables ]

abstract Myclass [ //methods and variables ]

abstract class Myclass { //methods and variables }

abstract class Myclass { //methods and variables }

abstract class Myclass [ //methods and variables]

abstract class Myclass [ //methods and variables]

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
Method signatures that do not provide method definitions and are declared as abstract are known as?

abstract methods

abstract methods

virtual methods

virtual methods

abstract interface

abstract interface

virtual interface

virtual interface

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
Which of the following packages in Java contain the abstract keyword?

java.util

java.util

java.io

java.io

java.abstract

java.abstract

java.lang

java.lang

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
Consider the following 2 statements:

  1. Abstract class defines only the structure of the class not its implementation.

  2. Abstract classes cannot be inherited.


Which of the above statements are true?

Statement 1 is true, statement 2 is false.

Statement 1 is true, statement 2 is false.

Statement 1 is false, statement 2 is true.

Statement 1 is false, statement 2 is true.

Statement 1 is false, statement 2 is false

Statement 1 is false, statement 2 is false

Statement 1 is true, statement 2 is true

Statement 1 is true, statement 2 is true

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
Which of the following lines in the abstract class will produce a compilation error?

 

abstract class Example

{

abstract void fun1();   //Line 1

public int fun2() { //contents of the function }   //Line 2

private abstract boolean fun3();   //Line 3

}

Line 1

Line 1

Line 2

Line 2

Line 3

Line 3

There is no error in the given abstract class.

There is no error in the given abstract class.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
Which of the following statements is false with respect to “final” keyword in java?

The class declared as final cannot be extended

The class declared as final cannot be extended

The value of a variable declared as final cannot be changed once initialized.

The value of a variable declared as final cannot be changed once initialized.

A constructor can be declared as final

A constructor can be declared as final

None of the above.

None of the above.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
Which of the following statements is correct about a class and an interface?

An interface can extend multiple interfaces

An interface can extend multiple interfaces

A class can implement multiple interfaces.

A class can implement multiple interfaces.

Multiple inheritance can be achieved using interfaces.

Multiple inheritance can be achieved using interfaces.

All of the above

All of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/0

Accuracy

0%