-
What is the maximum length of a Java identifier?
a) 32
b) 128
c) No fixed length is specified
-
What will be the output of the following Java code snippet?
int var = 10;
System.out.println(var.getClass());
var = "hello";
System.out.println(var.getClass());
a) String and int
b) int and String
c) int and int
-
Which of the following types of loop are not supported in Java?
a) for
b) while
c) do-while
-
Which of the following blocks will always be executed whether an exception is encountered or not in a Java program?
a) try
b) catch
c) finally
-
What is the keyword used in Java to raise an exception?
a) throw
b) try
c) goto
-
Which of the following packages needs to be imported to handle date-time computations in Java?
a) java.util.date
b) java.util
c) java.time
-
In which language is Java written?
a) C++
b) Java
c) C
-
What will be the output of the following Java code?
int[] a = {1, 2, 3};
int[] b = a;
b[0] = 5;
System.out.println(Arrays.toString(a));
a) [1, 2, 3]
b) [5, 2, 3]
c) [1, 2, 3, 5]