Search Header Logo

OPP Revision Unit I & II

Authored by Vidhi Pitroda

Information Technology (IT)

University

Used 1+ times

OPP Revision Unit I & II
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

35 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the main purpose of an abstract class in Java?

To provide a complete implementation

To provide partial implementation

To define a contract for subclasses

To allow instantiation of objects

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to declare an abstract method?

abstract

final

static

void

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? class A { void display() { System.out.println("Hello"); } } A a = new A(); a.display();

Hello

Error

Hello World

Nothing

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is true about interfaces in Java?

Interfaces can be instantiated

Interfaces can have constructors

Interfaces can contain instance fields

Interfaces can extend multiple other interfaces

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the 'super' keyword in Java?

To define a new class

To access private members of a class

To call a method from the parent class

To create a new instance of a class

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will happen if a subclass does not implement all abstract methods of its superclass?

The superclass will be ignored

The subclass will compile successfully

The subclass must also be declared abstract

The program will run with errors

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements about packages is true?

Packages are not necessary in Java

Packages cannot be nested

Packages help avoid naming conflicts

Packages can only contain classes

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?