wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Java OOP

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Composition is a

a)

uses-a relationship

b)

has-a relationship

c)

is-a relationship

d)

none of the above

2.

What is not a Java primitive data type?

a)

float

b)

byte

c)

Boolean

d)

char

3.

Which is not a valid way to define an array?

a)

int[3] i = new int[];

b)

int[ ] i = {1,2,3};

c)

int[ ] i = new int[ ]{1, 2, 3};

d)

int[ ] i = new int[3];

4.

Select the access level/s of a private modifier.

a)

Class

b)

Package

c)

Subclass

d)

World

5.

It keeps the data and the code safe from external interference.

a)

Polymorphism

b)

ArrayList

c)

Autoboxing

d)

Encapsulation

6.

Which data type is not supported by ArrayList?

a)

Integer

b)

String

c)

double

d)

Boolean

7.

What is an instance of a class?

a)

Class

b)

Object

c)

Reference

d)

Primitive

8.

Autoboxing converts primitive to corresponding object wrapper class

a)

true

b)

false

9.

What is the default value of a primitive int data type?

a)

-1

b)

null

c)

0

d)

garbage data

10.

Consider the given code. What would be the display on the screen?

a)

Class A

b)

Class B

c)

Class C

d)

Compile error