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