wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Java_MCQ_3

Total questions: 15

Worksheet time: 14mins

Name
Class
Date
1.

Which of this statement is incorrect?

a)

All object of a class are allotted memory for the all the variables defined in the class

b)

If a function is defined public it can be accessed by object of other class by inheritation

c)

main() method must be made public

d)

All object of a class are allotted memory for the methods defined in the class

2.

What will be the output of the following Java code?

a)

0 0

b)

5 6

c)

6 5

d)

5 5

3.

What is the output of the following Java code?

a)

5

b)

0

c)

Garbage Value

d)

-1

4.

What is the output of the following Java code?

a)

5

b)

0

c)

Garbage Value

d)

-1

5.

When does Exceptions in Java arises in code sequence?

a)

Run Time

b)

Compilation Time

c)

Can Occur Any Time

d)

None of the mentioned

6.

What is the output of the following Java code?

a)

Garbage value

b)

7 5

c)

5 7

d)

5

7.

What will be the output of the following Java program?

a)

Hello

b)

World

c)

HelloWorld

d)

Hello World

8.

Which of these is not a correct statement?

a)

Every class containing abstract method must be declared abstract

b)

Abstract class defines only the structure of the class not its implementation

c)

Abstract class can be initiated by new operator

d)

Abstract class can be inherited

9.

Which of these packages contains abstract keyword?

a)

java.lang

b)

java.util

d)

java.system

10.

What is the output of the following Java code?

a)

8

b)

10

c)

0

d)

Compilation Error

11.

What will be the output of the following Java code?

a)

1 2

b)

2 1

c)

Runtime Error

d)

Compilation Error

12.

What will be the output of the following Java program?


a)

0

b)

1

c)

2

d)

Compilation Error

13.

All classes in Java are inherited from which class?

a)

java.lang.class

b)

java.class.inherited

c)

java.class.object

d)

java.lang.Object

14.

When does method overloading is determined?

a)

At run time

b)

At compile time

c)

At coding time

d)

At execution time

15.

What will be the output of the following Java program?


a)

0

b)

2

c)

4

d)

None of the mentioned