wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Data Types

Total questions: 10

Worksheet time: 4mins

Name
Class
Date
1.

int x = 10;

System.out.println(x / 3);

a)

3

b)

3.33

c)

3.0

d)

Compilation error

2.

double y = 10 / 3;

System.out.println(y);

a)

3.33

b)

3

c)

3.0

d)

Compilation error

3.

char letter = 'A' + 1;

System.out.println(letter);

a)

A

b)

B

c)

66

d)

Compilation error

4.

boolean result = (5 > 3) && (2 < 1);

System.out.println(result);

a)

true

b)

false

c)

Runtime error

d)

Compilation error

5.

float f = 5.5;

System.out.println(f);

a)

5.5

b)

5

c)

Runtime error

d)

Compilation error

6.

System.out.println("10" + 5);

a)

105

b)

15

c)

10 + 5

d)

Compilation error

7.

long l = 1000 * 1000 * 1000 * 1000;

System.out.println(l);

a)

1 000 000 000 000

b)

Overflow, incorrect result

c)

Runtime error

d)

Compilation error

8.

Output:

25.0

a)

System.out.println(5 * 5 );

b)

System.out.println(5 * 5.0);

c)

System.out.println((int) (5 * 5.0));

d)

System.out.println((double) 5 * 5);

9.

Output:

3.14159

a)

System.out.println(3.14159);

b)

System.out.println("%.5f", 3.14159);

c)

System.out.println((double) 3.14159);

d)

System.out.println("3.14159");

10.

Output:

"Java 101"

a)

System.out.println("Java " + 101);

b)

System.out.println("Java " + "101");

c)

System.out.println(101 + " Java");