wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Object-Oriented Programming Quiz

Total questions: 40

Worksheet time: 20mins

Name
Class
Date
1.

Which of the following is not a characteristic of Object-Oriented Programming?

a)

Encapsulation

b)

Polymorphism

c)

Compilation

d)

Inheritance

2.

In OOP, an object is best described as:

a)

A function inside a program

b)

A variable holding primitive data only

c)

An instance of a class

d)

A block of memory allocated at compile time

3.

Which advantage of OOP allows code to be reused across multiple programs?

a)

Abstraction

b)

Inheritance

c)

Encapsulation

d)

Polymorphism

4.

Which term refers to bundling data and the methods that operate on that data into a single unit?

a)

Abstraction

b)

Encapsulation

c)

Inheritance

d)

Overloading

5.

Which of the following is true about OOP?

a)

It only works in compiled languages.

b)

It increases code reusability and maintainability.

c)

It eliminates the need for algorithms.

d)

It is not used in large-scale systems.

6.

Which principle allows one class to acquire properties and behaviors from another?

a)

Inheritance

b)

Abstraction

c)

Encapsulation

d)

Aggregation

7.

Which of these is a disadvantage of OOP?

a)

Higher memory usage

b)

Easier debugging

c)

Better code modularity

d)

More natural mapping to real-world problems

8.

Which is not an OOP language?

a)

Java

b)

C++

c)

Python

d)

C

9.

UML stands for:

a)

Unified Modeling Language

b)

Universal Machine Language

c)

Unified Method Logic

d)

User Model Layout

10.

In UML, which diagram is used to show interactions between objects?

a)

Class Diagram

b)

Sequence Diagram

c)

State Diagram

d)

Use Case Diagram

11.

A UML class diagram displays:

a)

The steps of a program

b)

The attributes and methods of classes and their relationships

c)

The runtime flow of messages

d)

The end-user interface

12.

Which UML diagram represents system behavior from the user’s point of view?

a)

Use Case Diagram

b)

Class Diagram

c)

Activity Diagram

d)

Sequence Diagram

13.

In a UML class diagram, a + symbol before a method name means:

a)

Protected

b)

Private

c)

Public

d)

Package-private

14.

Which UML relationship indicates that one class is part of another?

a)

Association

b)

Aggregation

c)

Composition

d)

Generalization

15.

Which diagram best models the workflow of a process?

a)

Sequence Diagram

b)

Activity Diagram

c)

State Diagram

d)

Class Diagram

16.

In UML, generalization is used to represent:

a)

Data hiding

b)

Inheritance hierarchy

c)

Multiple classes interacting

d)

User interface design

17.

Polymorphism in OOP allows:

a)

Multiple methods with the same name but different implementations

b)

A single object to have multiple instances

c)

Classes to inherit multiple parents

d)

Objects to encapsulate data

18.

Which type of polymorphism occurs at compile time?

a)

Runtime polymorphism

b)

Method overriding

c)

Method overloading

d)

Dynamic dispatch

19.

Method overriding is an example of:

a)

Compile-time polymorphism

b)

Runtime polymorphism

c)

Multiple inheritance

d)

Encapsulation

20.

Which keyword in Java is used to achieve runtime polymorphism?

a)

static

b)

final

c)

super

d)

override

21.

Which of these is not an example of polymorphism?

a)

Function overloading

b)

Method overriding

c)

Operator overloading

d)

Data hiding

22.

In Java, operator overloading:

a)

Is supported for all operators

b)

Is not supported for user-defined operators

c)

Only works for arithmetic operators

d)

Can be applied to new operators

23.

Which statement is true?

a)

Overloading changes method signatures; overriding changes method bodies.

b)

Overloading is runtime; overriding is compile-time.

c)

Overloading requires inheritance.

d)

Overriding requires different method names.

24.

Polymorphism helps in:

a)

Reducing memory usage

b)

Writing generic and reusable code

c)

Removing inheritance

d)

Improving compilation speed

25.

Encapsulation primarily achieves:

a)

Code duplication

b)

Data hiding

c)

Inheritance

d)

Multiple instantiation

26.

Which access modifier allows class members to be accessed only within the same class?

a)

public

b)

protected

c)

private

d)

default

27.

A getter method is used to:

a)

Retrieve the value of a private variable

b)

Set the value of a private variable

c)

Delete a variable

d)

Create a variable

28.

A setter method should generally:

a)

Return a boolean

b)

Take no parameters

c)

Validate the input before setting the variable

d)

Only work with static variables

29.

In OOP, encapsulation:

a)

Prevents inheritance

b)

Separates interface from implementation

c)

Always makes variables public

d)

Requires UML diagrams

30.

Which statement is correct?

a)

Encapsulation means hiding methods only.

b)

Encapsulation can be achieved using access modifiers.

c)

Encapsulation is the same as polymorphism.

d)

Encapsulation is only used in Java.

31.

Which type of inheritance is not supported directly in Java?

a)

Single

b)

Multilevel

c)

Multiple (using classes)

d)

Hierarchical

32.

Which keyword is used in Java to inherit a class?

a)

extends

b)

implements

c)

inherits

d)

super

33.

Which type of inheritance involves one superclass and multiple subclasses?

a)

Multiple

b)

Multilevel

c)

Hierarchical

d)

Hybrid

34.

What is inherited when a subclass extends a superclass?

a)

Constructors and private fields

b)

Public and protected members

c)

Only static methods

d)

Only public fields

35.

Which statement is correct about method overriding?

a)

Access level can be more restrictive in subclass.

b)

Return type must be exactly the same or covariant.

c)

Method name must be different.

d)

It happens at compile time.

36.

Abstraction in OOP refers to:

a)

Hiding the implementation details and showing only the functionality

b)

Hiding data members from other classes

c)

Using multiple classes together

d)

Reusing code across projects

37.

In Java, which keyword is used to declare an abstract class?

a)

interface

b)

abstract

c)

virtual

d)

final

38.

Which of these statements is true about abstract methods?

a)

They must have a body.

b)

They can be declared in abstract or concrete classes.

c)

They are implemented in the subclass.

d)

They cannot be overridden.

39.

Which of these can achieve 100% abstraction in Java?

a)

Abstract class

b)

Interface

c)

Concrete class

d)

Static class

40.

Which of the following is a benefit of abstraction?

a)

Improved performance

b)

Reduced execution time

c)

Easier maintenance and scalability

d)

Automatic memory management