Question 1 of 25
Hints left: 3
Q1
What will be the output of the following Java code snippet? public class AddDemo { public static void main(String args[]) { BigDecimal b = new BigDecimal("23.43"); BigDecimal br = new BigDecimal("24"); BigDecimal bres = b.add(new BigDecimal("450.23")); System.out.println("Add: "+bres); MathContext mc = new MathContext(2, RoundingMode.DOWN); BigDecimal bdecMath = b.add(new BigDecimal("450.23"), mc); System.out.println("Add using MathContext: "+bdecMath); } }
Q2
What will be the output of the following Java code? class average { public static void main(String args[]) { double num[] = {5.5, 10.1, 11, 12.8, 56.9, 2.5}; double result; result = 0; for (int i = 0; i < 6; ++i) result = result + num[i]; System.out.print(result/6); } }
Q3
What will be the output of the following Java program? class variable_scope { public static void main(String args[]) { int x; x = 5; { int y = 6; System.out.print(x + " " + y); } System.out.println(x + " " + y); } }
Q4
Which of the following is not provided by BigDecimal?
Q5
Which class is a library of functions to perform arithmetic operations of BigInteger and BigDecimal?
Q6
Which of these is necessary condition for automatic type conversion in Java?
Q7
What is Truncation in Java?
Q8
Literals in java must be appended by which of these?
Q10
What will be the output of the following Java program? class mainclass { public static void main(String args[]) { char a = 'A'; a++; System.out.print((int)a); } }
Q11
What will be the output of the following Java program? class c { public void main( String[] args ) { System.out.println( "Hello" + args[0] ); } }
Q12
What will be the output of the following Java code snippet? class A { } enum Enums extends A { ABC, BCD, CDE, DEF; }
Q13
How to convert Date object to String?
Q14
What will be the output of the following Java program? class mainclass { public static void main(String args[]) { boolean var1 = true; boolean var2 = false; if (var1) System.out.println(var1); else System.out.println(var2); } }
Q15
What will be the output of the following Java code? class asciicodes { public static void main(String args[]) { char var1 = 'A'; char var2 = 'a'; System.out.println((int)var1 + " " + (int)var2); } }
Q16
Can we create an instance of Enum outside of Enum itself?
Q17
Which of these coding types is used for data type characters in Java?
Q18
What is the order of variables in Enum?
Q19
What will be the output of the following Java program? class array_output { public static void main(String args[]) { char array_variable [] = new char[10]; for (int i = 0; i < 10; ++i) { array_variable[i] = 'i'; System.out.print(array_variable[i] + "" ); i++; } } }
Q20
What will be the output of the following Java program? class array_output { public static void main(String args[]) { int array_variable [] = new int[10]; for (int i = 0; i < 10; ++i) { array_variable[i] = i/2; array_variable[i]++; System.out.print(array_variable[i] + " "); i++; } } }
Q21
How to identify if a timezone is eligible for DayLight Saving?
Q22
Which of these occupy first 0 to 127 in Unicode character set used for characters in Java?
Q23
What does LocalTime represent?
Q24
Which of these is long data type literal?
Q25
What will be the output of the following Java code? enum Season { WINTER, SPRING, SUMMER, FALL }; System.out.println(Season.WINTER.ordinal());