Java From Beginner To Advanced

0% completed

Previous
Next
Quiz
Question 1
Which of the following is a valid variable declaration in Java?
A
int 1number;
B
double _salary;
C
char first-name;
D
boolean isValid!;
Question 2
What is the default value of a boolean variable in Java?
A
false
B
true
C
0
D
null
Question 3
What will be the output of the following Java code?
int a = 5;
double b = a;
System.out.println(b);
A
5
B
5.00
C
5.0
D
Error
Question 4
What will be the output of the following Java code?
int x = 10;
int y = 3;
double result = x / y;
System.out.println(result);
A
3.333333
B
3.3333333333333335
C
Error
D
3.0
Question 5
What is the size of a long data type in Java?
A
16 bits
B
32 bits
C
64 bits
D
8 bits

.....

.....

.....

Like the course? Get enrolled and start learning!
Previous
Next