Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

oops and inheritance

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What is the default value of Boolean variable?

a)

TRUE

b)

FALSE

c)

NULL

d)

NOT DEFINED

2.

Default value of static integer variable of a class in java is

(a)  

3.

Java is short of Javascript.

a)

TRUE

b)

FALSE

4.

Which feature JAVA does not support?

a)

Polymorphism

b)

Inheritance

c)

Pointer

d)

Portable

5.

Which method can used to find the length of string?

a)

stringlength()

b)

length()

c)

getLength()

d)

getSize()

6.

How to create anonymous Objects

a)

new Class_name().method_name();

b)

Obj=new Class_name().method_name();

c)

Class_name obj=new Class_name().method_name();

d)

new Class_name().objname

7.

How to create nested class object for the following code______


Ex:

class A

{

Class B//nested class

{

}

}

a)

A r=new A();

A.B c=new A.B();

b)

A r=new A();

A.B c=r.new A.B();

c)

A r=new A();

B c=new A.B();

d)

A r=new A();

B c=new B();

8.

A java program allows any number of public classes with in a single program

a)

True

b)

False

9.

What is garbage Collection

a)

It is the process of collecting unused memory

b)

It is used to create class in dynamic memory

c)

It is a type of static memory

d)

None of these

10.

Static blocks are executed after main() function execution..

a)

True

b)

False

11.

Which of the following is not a feature of static method

a)

Static methods access only other static methods

b)

Static methods must allow static variables.

c)

A static method can access with class name

d)

A static method calls non-static methods.

12.

What is the feature of static variable in JAVA

a)

All objects share the memory of static variables

b)

We can access static variables directly with class name

c)

we can access static variables directly without class and object(separate classes)

d)

static variables are constants in java

13.

What is class in OOP_______________

a)

It is a collection of objects of similar type

b)

It is used to write object code

c)

It is a collection of structures.

d)

It is a blue print of object

14.

Which of the following is not a feature of OOP in C++?

a)

Encapsulation

b)

Abstraction

c)

Inheritance

d)

Compilation

15.

Which of the following syntax is used to create Object in Java

a)

Class_name obj_name=new Class_name();

b)

Class_name Obj_name=new Class_name;

c)

Obj_name=new Class_name();

d)

class_name=new Object_name();