wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Java Questions & Answers

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Which of these selection statements test only for equality?

a)

if

b)

switch

c)

if & switch

d)

none of the above mentioned

2.

Which of these are selection statements in Java?

a)

if()

b)

for()

c)

continue

d)

break

3.

Which of this statement is incorrect?

a)

switch statement is more efficient than a set of nested ifs

b)

two case constants in the same switch can have identical values

c)

switch statement can only test for equality, whereas if statement can evaluate any type of boolean expression

d)

it is possible to create a nested switch statements

4.

What will be the output of the following Java program?

a)

1

b)

2

c)

3

d)

4

5.

Which of the following is not a valid jump statement?

a)

break

b)

goto

c)

continue

d)

return

6.

The while loop repeats a set of code while the condition is not met?

a)

True

b)

False

7.

What is it called if an object has its own lifecycle and there is no owner?

a)

Aggregation

b)

Composition

c)

Encapsulation

d)

Association

8.

Method overriding is combination of inheritance and polymorphism?

a)

True

b)

False

9.

Which statement is true about java?

a)

Platform independent programming language

b)

Platform dependent programming language

c)

Code dependent programming language

d)

Sequence dependent programming language

10.

What is the extension of java code files?

a)

.class

b)

.java

c)

.txt

d)

.js