Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
What is the output of the following code?
public class Test { public static void main(String args[]) { int x = 5; int y = 2; System.out.println(x / y); } }
2
2.5
None of the above
public class Test { public static void main(String args[]) { System.out.println("Hello" + " World"); }
Hello
World
Hello World
HelloWorld
myVariable
$variable
2variable
_variable
public class Test { public static void main(String args[]) { int x = 10; int y = 5; System.out.println(x > y); } }
1
0
public class Test { public static void main(String args[]) { int[] numbers = {1, 2, 3}; System.out.println(numbers[1]); } }
3
IndexOutOfBoundsException
public class Test { public static void main(String args[]) { for(int i = 0; i < 5; i++) { System.out.println(i); } } }
0 1 2 3 4
1 2 3 4 5
0 1 2 3 4 5
Infinite loop
public class Test { public static void main(String args[]) { String name = "Java"; for(int i = 0; i < name.length(); i++) { System.out.print(name.charAt(i) + " "); } } }
J a v a
Java
Jv
No output
try
catch
finally
handle
Implementing the Runnable interface
Extending the Thread class
Calling the start() method on a Thread object
Creating a new instance of the Thread class
if
while
switch
string