InfyTQ Abstarct, final and Interfaces Quiz 1

Question 1

Time: 00:00:00
What do you mean by abstraction in Java?

The capability of a class in java to derive the characteristics or properties from another class is known as abstraction.

The capability of a class in java to derive the characteristics or properties from another class is known as abstraction.

Abstraction can be defined as the ability through which only the required details are displayed to the user, the non-essential details are not shown to the user.

Abstraction can be defined as the ability through which only the required details are displayed to the user, the non-essential details are not shown to the user.

Abstraction can be defined as the combining of code and data in a single unit.

Abstraction can be defined as the combining of code and data in a single unit.

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 2

Time: 00:00:00
Which of the following features allow the functionality of multiple inheritance in JAVA ?

Abstract class

Abstract class

Encapsulation

Encapsulation

Polymorphism

Polymorphism

Interface

Interface

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

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
Consider the following two statements:

  1. The final keyword restricts the user to perform any kind of changes in the component with which it is associated.

  2. The final keyword is applicable only to variables , methods and classes.


Which of the following statements are true?

Statement 1

Statement 1

Statement 2

Statement 2

Both 1 and 2 are true

Both 1 and 2 are true

Both 1 and 2 are false

Both 1 and 2 are false

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

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
The final keyword can be used with which of the following components in Java?

Variable

Variable

Method

Method

Classes

Classes

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 5

Time: 00:00:00
What is the difference between const and final keywords?

Both const and final keywords are used in java.

Both const and final keywords are used in java.

Only const keyword is allowed in java

Only const keyword is allowed in java

Only final keyword is allowed in java

Only final keyword is allowed in java

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 6

Time: 00:00:00
Java does not allow the user to create instances of?

Interfaces

Interfaces

Abstract Classes

Abstract Classes

Nested Classes

Nested Classes

Both A and B

Both A and B

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

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
How do you declare an abstract class?

An abstract class is declared using the abstract keyword

An abstract class is declared using the abstract keyword

An abstract class is declared using the final keyword

An abstract class is declared using the final keyword

An abstract class is declared using the virtual keyword

An abstract class is declared using the virtual keyword

An abstract class is declared using the static keyword

An abstract class is declared using the static keyword

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

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
What is the default access modifier for an interface?

public

public

private

private

protected

protected

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 9

Time: 00:00:00
What is the correct way of implementing an interface “animal” by the class “test” ?

class test extends animal {}

class test extends animal {}

class test defines animal {}

class test defines animal {}

class test implements animal {}

class test implements animal {}

Class test exports animal {}

Class test exports animal {}

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

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
What will be the output of the following program?

   interface product

    {

        void prod(int num);

    }

    class answer implements product

    {

        int x;

        public void prod(int num)

        {

            x = num * num;            

        }

    }

    class Test

    {

        public static void main(String args[])

        {

            answer obj= new answer;

            obj.x = 0;      

            obj.prod(4);

            System.out.println(obj.x);

        }

    }

zero

zero

4

4

16

16

compile Time error

compile Time error

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%