Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Java OOP

Total questions: 10

Worksheet time: 7mins

Name
Class
Date
1.

What is the keyword used to inherit a class in Java?

a)

implement

b)

inherit

c)

extends

d)

interface

2.

Which access modifier restricts access to a class member to within its own package?

a)

private

b)

protected

c)

public

d)

default

3.

Which of the following best describes encapsulation in Java?

a)

Creating multiple methods with the same name but different parameters

b)

Inheriting properties and behaviors from another class

c)

Hiding the implementation details of a class and only providing access through public methods

d)

Grouping related data and methods into a single unit

4.

What is the purpose of the "this" keyword in Java?

a)

Refers to the current instance of the class

b)

Refers to the superclass of the class

c)

Refers to the subclass of the class

d)

Refers to the parent class of the class

5.

Which keyword is used to prevent a method from being overridden in a subclass?

a)

final

b)

abstract

c)

private

d)

static

6.

What is the process of defining a method in a subclass with the same name and parameters as a method in the superclass called?

a)

Overloading

b)

Overriding

c)

Extending

d)

Implementing

7.

Which keyword is used to indicate that a method has no return value in Java?

a)

void

b)

null

c)

empty

d)

return

8.

Which of the following best describes polymorphism in Java?

a)

Ability to take multiple forms

b)

Hiding the implementation details of a class

c)

Grouping related data and methods into a single unit

d)

Inheriting properties and behaviors from another class

9.

What is the purpose of abstraction in Java?

a)

The purpose of abstraction is to hide the implementation details of complex systems and allow the use of simplified and generalized concepts.

b)

Creating multiple methods with the same name but different parameters

c)

Grouping related data and methods into a single unit

d)

Inheriting properties and behaviors from another class

10.

What are the four main principles of Object-Oriented Programming (OOP) in Java?

a)

Abstraction, Encapsulation, Inheritance, Composition

b)

Encapsulation, Inheritance, Polymorphism, Abstraction

c)

Encapsulation, Modularity, Polymorphism, Inheritance

d)

Inheritance, Encapsulation, Polymorphism, Modularity