Question 1 of 25
Hints left: 3
Q1
All the variables of interface should be?
Q2
What will be the output of the following Java statement? class output { public static void main(String args[]) { double a, b,c; a = 3.0/0; b = 0/4.0; c=0/0.0; System.out.println(a); System.out.println(b); System.out.println(c); } }
Q3
Which of the following are legal lines of Java code? 1. int w = (int)888.8; 2. byte x = (byte)100L; 3. long y = (byte)100; 4. byte z = (byte)100L;
Q4
What will be the output of the following Java code snippet? enum Levels { private TOP, public MEDIUM, protected BOTTOM; }
Q5
If we try to add Enum constants to a TreeSet, what sorting order will it use?
Q6
Which of these literals can be contained in float data type variable?
Q7
What will be the output of the following Java program, if we run as "java main_arguments 1 2 3"? class main_arguments { public static void main(String [] args) { String [][] argument = new String[2][2]; int x; argument[0] = args; x = argument[0].length; for (int y = 0; y < x; y++) System.out.print(" " + argument[0][y]); } }
Q8
What will be the output of the following Java code? class area { public static void main(String args[]) { double r, pi, a; r = 9.8; pi = 3.14; a = pi * r * r; System.out.println(a); } }
Q9
What is the range of byte data type in Java?
Q10
What is the numerical range of a char data type in Java?
Q11
What is the base of BigDecimal data type?
Q12
What is the replacement of joda time library in java 8?
Q13
Literal can be of which of these data types?
Q14
How is Date stored in database?
Q15
What will be the output of the following Java code? class conversion { public static void main(String args[]) { double a = 295.04; int b = 300; byte c = (byte) a; byte d = (byte) b; System.out.println(c + " " + d); } }
Q16
What will be the output of the following Java code? class A { final public int calculate(int a, int b) { return 1; } } class B extends A { public int calculate(int a, int b) { return 2; } } public class output { public static void main(String args[]) { B object = new B(); System.out.print("b is " + b.calculate(0, 1)); } }
Q17
Which one is a valid declaration of a boolean?
Q18
Which method returns the elements of Enum class?
Q19
What will be the output of the following Java code? class char_increment { public static void main(String args[]) { char c1 = 'D'; char c2 = 84; c2++; c1++; System.out.println(c1 + " " + c2); } }
Q20
How to get difference between two dates?
Q21
What will be the output of the following Java code? class booloperators { public static void main(String args[]) { boolean var1 = true; boolean var2 = false; System.out.println((var1 & var2)); } }
Q22
BigDecimal is a part of which package?
Q23
An expression involving byte, int, and literal numbers is promoted to which of these?
Q24
What will be the output of the following Java program, Command line execution is done as - "java Output command Line 10 A b 4 N"? class Output { public static void main(String args[]) { System.out.print((int)args[2] * 2); } }
Q25
How to format date from one form to another?