Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Java Unit 1

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

How many bits is the long data type in Java?

a)

16

b)

32

c)

64

d)

128

2.

What is the size of an integer in Java Programming?

a)

1 byte

b)

2 bytes

c)

4 bytes

d)

8 bytes

3.

Which of the following is the smallest primitive data type in Java?

a)

short

b)

int

c)

long

d)

byte

4.

What is the default value of a char in Java?

a)

0

b)

'\0'

c)

' '

d)

null

5.

Which of the following is not a primitive data type in Java?

a)

void

b)

float

c)

char

d)

short

6.

What is the output of the expression true || false?

a)

true

b)

false

c)

null

d)

0

7.

Which loop construct in Java is best suited when the number of iterations is known?

a)

while

b)

Do... while

c)

for

d)

for each

8.


Which loop construct guarantees that the loop body is executed at least once?


a)

while

b)

Do... while

c)

for

d)

All of the options

9.

Which statement is used to exit a loop prematurely?

a)

exit

b)

continue

c)

break

d)

return

10.

What is the purpose of the continue statement in a loop?

a)

To exit the loop immediately

b)

To skip the current iteration and move to the next iteration

c)

To terminate the program

d)

To execute a specific block of code