Question 1 of 25
Hints left: 3
Q1
Literal can be of which of these data types?
Q2
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;
Q3
Which one is a valid declaration of a boolean?
Q4
An expression involving byte, int, and literal numbers is promoted to which of these?
Q5
Which of these literals can be contained in float data type variable?
Q6
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)); } }
Q7
How to format date from one form to another?
Q8
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); } }
Q9
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]); } }
Q10
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); } }
Q11
What will be the output of the following Java code snippet? enum Levels { private TOP, public MEDIUM, protected BOTTOM; }
Q12
Which method returns the elements of Enum class?
Q13
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); } }
Q14
How is Date stored in database?
Q15
How to get difference between two dates?
Q16
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)); } }
Q17
What is the replacement of joda time library in java 8?
Q18
All the variables of interface should be?
Q19
What is the base of BigDecimal data type?
Q20
What is the numerical range of a char data type in Java?
Q21
What is the range of byte data type in Java?
Q22
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); } }
Q23
If we try to add Enum constants to a TreeSet, what sorting order will it use?
Q24
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); } }
Q25
BigDecimal is a part of which package?