wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Mock-Up Academy OOP Online Test

Total questions: 10

Worksheet time: 20mins

Name
Class
Date
1.

⁠Which of the following code snippets demonstrates the concept of Object-Oriented Programming (OOP)?

a)

b)

c)

d)

2.

Which of the following code snippets best demonstrates the concept of encapsulation?

a)

b)

c)

d)

3.

Given the following code, what will be the output?

a)

b)

c)

d)

4.

What does OOP stand for?

a)

Organization Oriented Programming

b)

Operation Oriented Programming

c)

Object Oriented Programming

d)

Objective Oriented Programming

5.

What is inheritance in OOP?

a)

Creating an object from a class

b)

Using the same method in different ways

c)

Hiding implementation details

d)

Inheriting attributes and methods from another class

6.

What is a method called that is the same but behaves differently in different classes?

a)

Encapsulation

b)

Abstraction

c)

Polymorphism

d)

Inheritance

7.

What is an abstract method in OOP?

a)

Method that has a complete implementation

b)

Method that does not have a name

c)

Method that only has a declaration without implementation

d)

Method that cannot be used in any class

8.

Which of the following is true about encapsulation?

a)

Hiding implementation details and providing a public interface

b)
  1. Allowing one class to inherit attributes and methods from another class

c)

Allowing the same method to be used in different ways

d)

Simplifying complexity by showing only essential details

9.

Consider the following pseudocode involving an abstract class:

a)

The program will create an instance of Shape successfully.

b)

The program will call the area() method of the Shape class.

c)

The program will automatically create an instance of a default subclass.

d)

The program will throw an error because Shape is abstract and cannot be instantiated.

10.

⁠Which of the following statements about the child class in the code below is correct?

a)

The Child class inherits the greet() method from Parent but does not override it.

b)

The Child class does not inherit anything from Parent because it defines its own greet() method.

c)

The Child class overrides the greet() method of Parent, so calling c.greet() prints "Hello from Child".

d)

The Parent class is the child of the Child class.