Question 1 of 25
Hints left: 3
Q1
What is the purpose of the "switch" statement in Java?
Q2
Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?
Q3
What is the output of the following code snippet? int j = 0; while (j < 5) { System.out.print(j + " "); j += 2; }
Q4
In Java, which statement is used to exit a loop prematurely?
Q5
Which method can be defined only once in a program?
Q6
Which of the following is true about the "do-while" loop in Java?
Q7
When Overloading does not occur?
Q8
How to get prints of shared object memory maps or heap memory maps for a given process?
Q9
What will be the output of the following Java program? class recursion { int fact(int n) { int result; if (n == 1) return 1; result = fact(n - 1) * n; return result; } } class Output { public static void main(String args[]) { recursion obj = new recursion() ; System.out.print(obj.fact(1)); } }
Q10
What will be the output of the following Java program? class area { int width; int length; int volume; area() { width=5; length=6; } void volume() { volume = width*length*height; } } class cons_method { public static void main(String args[]) { area obj = new area(); obj.volume(); System.out.println(obj.volume); } }
Q11
What is the default case in a "switch" statement used for?
Q12
In Java, what does the "continue" statement do?
Q13
Which of these is not a correct statement?
Q14
Which of the following is a method having same name as that of its class?
Q15
Which of these data types is used by operating system to manage the Recursion in Java?
Q16
What happens to the thread when garbage collection kicks off?
Q17
What is the extension of java code files?
Q18
In Java, which loop is suitable when you want to execute a block of code a specific number of times?
Q19
What is the purpose of the "if" statement in Java?
Q20
In Java, what does the "default" keyword refer to in a "switch" statement?
Q21
In Java, what does the "break" statement do in a loop?
Q22
Which of the following is not a valid comparison operator in Java?
Q23
What is the purpose of the "for-each" loop in Java?
Q24
What is the result of the following code snippet? int i = 1; while (i <= 5) { System.out.print(i + " "); i++; }
Q25
What is the output of the following code snippet? int x = 5; if (x > 3) { System.out.println("Hello"); }