WorksheetsJava Unit 1
Total questions: 10
Worksheet time: 5mins
How many bits is the long data type in Java?
16
32
64
128
What is the size of an integer in Java Programming?
1 byte
2 bytes
4 bytes
8 bytes
Which of the following is the smallest primitive data type in Java?
short
int
long
byte
What is the default value of a char in Java?
0
'\0'
' '
null
Which of the following is not a primitive data type in Java?
void
float
char
short
What is the output of the expression true || false?
true
false
null
0
Which loop construct in Java is best suited when the number of iterations is known?
while
Do... while
for
for each
Which loop construct guarantees that the loop body is executed at least once?
while
Do... while
for
All of the options
Which statement is used to exit a loop prematurely?
exit
continue
break
return
What is the purpose of the continue statement in a loop?
To exit the loop immediately
To skip the current iteration and move to the next iteration
To terminate the program
To execute a specific block of code
