wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

OOP II LAB QUIZ

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.
Which of the following concepts of OOPS means exposing only necessary information to client?
a)
Encapsulation
b)
Abstraction
c)
Data hiding
d)
Data binding
2.
What is the difference between a class and an object?
a)
A class is a blueprint to make an object
b)
An object is a blueprint to make a class
c)
A blueprint is an object to make a class
d)
Blueprint class is an object make a
3.
These have identitystate, and behavior.
a)
class
b)
object
c)
method
d)
void
4.
The wrapping up of data and functions into a single unit is called
a)
overloading
b)
class
c)
object
d)
encapsulation 
5.
The process by which objects of one class acquire the properties of objects of another class is known as
a)
Polymorphism
b)
Inheritance
c)
Data Hiding
d)
None of the above.
6.

A single object can also be referred to as an...

a)

Object

b)

Singular Object

c)

Instance

d)

Singular

7.

How many lines will this code print?

x = 10

while x > 0:

print(x)

x = x - 3

a)

5

b)

2

c)

3

d)

4

8.

Real-world objects contain ___ and ___.

a)

state

b)

behavior

c)

attributes

d)

methods

9.

A software object's state is stored in ___.

a)

encapsulation

b)

inheritance

c)

polymorphism

d)

fields

10.

Refers to the bundling of data, along with the methods that operate on that data, into a single unit.

a)

Inheritance

b)

Polymorphism

c)

Abstraction

d)

Encapsulation

11.

What are/is the reasons why we use object-oriented programming?

a)

Scalability

b)

Lower cost of development

c)

Security and Reliability

d)

All of the Above

12.

Is it true that the polymorphism offers a lot of flexibility in OOPs?

a)

Yes

b)

No

13.

Inheritance can use the concept of ___________ relationship.

a)

has-a

b)

is-a

c)

one-to-one

d)

one-to-many

14.

An abstract method is a method ____________

a)

with a return statement

b)

which cannot be overridden

c)

with a return statement and can be overridden

d)

with no definition

15.

In the JAVA programming language, the concept of keeping data private is known as __________.

a)

polymorphism

b)

information hiding

c)

static binding

d)

inheritance

16.

Choose the FALSE statement about abstract class

a)

It is a superclass with generic behaviour

b)

Definition of abstract method is implemented in subclass

c)

Subclasses must implement all the abstract methods in the superclass

d)

Abstract class must have more than one abstract method

17.

_______________ is a key concept, enabling an object of a subclass to be treated like an object of its superclass.

a)

Classes and subclasses

b)

Data abstraction

c)

Static polymorphism

d)

Information hiding

18.

Which of the following is true about method overloading?

a)

It allows a method to have different return types

b)

It is not possible in Java

c)

It involves creating multiple methods with the same name but different parameters

d)

It can only be done in abstract classes

19.

What is the program that allows Java to run on any computer?

a)

Java Virtual Machine

b)

Java Compiler

c)

Windows OS

d)

Linux

20.
In the statement 
 Bank tom = new Bank(5000.0);
Which is the class?
a)
Bank
b)
tom
c)
new
d)
5000.0
21.
How many objects can be made from a class?  
a)
None, you make classes from objects
b)
one
c)
As many as you want
d)
All of the above
22.

Classes in Java are:

a)

Abstract data types, used as a template of objects

b)

Where students learn

c)

Dungeons and Dragons Character types

d)

None of these

23.

<class name><Object name>=new <class name>();

This is syntax of creating ______.

a)

class

b)

object

c)

method

d)

function

24.

Predict the output of following Java program?

class Test {

int i;

}

class Main {

public static void main(String args[]) {

Test t;

System.out.println(t.i);

}

a)

0

b)

garbage value

c)

Compiler Error

d)

Run Time Error

25.

Predict the output of following Java program

class Test

{ int i;

}

class Main

{ public static void main(String args[])

{ Test t = new Test();

System.out.println(t.i);

} }

a)

Garbage Value

b)

0

c)

Compiler Error

d)

Runtime error