wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

APP R1

Total questions: 10

Worksheet time: 3mins

Name
Class
Date
1.

Find the output for the given java code snippet

a)

11

b)

12

c)

14

d)

15

2.

Find the Output for the above code

a)

10 20

b)

50 60

c)

50 20

d)

10 60

3.

Find the Output

a)

Mike

b)

John

c)

Compile Time Error

d)

Run Time Error

4.
a)

10

b)

10.5

c)

Compile-time error: incompatible types

d)

Runtime error: ClassCastException

5.

Find the Output

a)

55

b)

50

c)

60

d)

45

6.
a)

Prints: X is greater than 5

b)

No output

c)

Compile-time error: Misplaced semicolon

d)

Runtime error: NullPointerException

7.

What is the output of a switch statement when no break is used between cases?

a)

The output will be Tuesday only.

 

b)

The output will be Monday, Tuesday, and Wednesday.

c)

The output will be Tuesday and Wednesday.

d)

The code will fail to compile.

8.

Which of these types are passed by value in Java?

a)

Objects

b)

Primitive types

c)

Arrays

d)

All are passed by reference

9.

What will be printed?

int x = 3;

System.out.println(x << 2);

a)

12

b)

6

c)

1

d)

9

10.

What does this print?

System.out.println(10 + 20 + "30");

a)

Error

b)

3030

c)

102030

d)

3030.0