Question 1 of 25
Hints left: 3
Q1
Which data type value is returned by all transcendental math functions?
Q2
What is the output for the below code? public class Test{ public static void main(String[] args){ byte b = 6; b+=8; System.out.println(b); b = b+7; System.out.println(b); } }
Q3
What will be the output of the following Java code snippet? double a = 0.02; double b = 0.03; double c = b - a; System.out.println(c); BigDecimal _a = new BigDecimal("0.02"); BigDecimal _b = new BigDecimal("0.03"); BigDecimal _c = b.subtract(_a); System.out.println(_c);
Q4
What will be output of following program? public class Test{ public static void main(String[] args){ byte b=127; b++; b++; System.out.println(b); } }
Q5
How to convert a String to a Date object?
Q6
What will be the output of the following Java code? class increment { public static void main(String args[]) { int g = 3; System.out.print(++g * 8); } }
Q7
What is the range of short data type in Java?
Q8
What is the output for the below code? public class Test{ public static void main(String[] args){ int i = 010; int j = 07; System.out.println(i); System.out.println(j); } }
Q9
What is the output for the below code? public class Test{ int _$; int $7; int do; public static void main(String argv[]){ Test test = new Test(); test.$7=7; test.do=9; System.out.println(test.$7); System.out.println(test.do); System.out.println(test._$); } }
Q10
What will be the output of the following Java program? class dynamic_initialization { public static void main(String args[]) { double a, b; a = 3.0; b = 4.0; double c = Math.sqrt(a * a + b * b); System.out.println(c); } }
Q11
What is the prototype of the default constructor of this Java class? public class prototype { }
Q12
Which of the following is the advantage of BigDecimal over double?
Q13
Are enums are type-safe?
Q14
Which of these can not be used for a variable name in Java?
Q15
Determine output: public class Test{ int a = 10; public void method(int a){ a += 1; System.out.println(++a); } public static void main(String args[]){ Test t = new Test(); t.method(3); } }
Q16
Which of these can be returned by the operator &?
Q17
Which of these values can a boolean variable contain?
Q18
Is SimpleDateFormat thread safe?
Q19
Which of the below data type doesn't support overloaded methods for +,-,* and /?
Q20
What is BigDecimal.ONE?
Q21
What will be the output for the below code? public class Test{ int i=8; int j=9; public static void main(String[] args){ add(); } public static void add(){ int k = i+j; System.out.println(k); } }
Q22
What will be the output for the below code? public class Test{ public static void main(String[] args){ byte i = 128; System.out.println(i); } }
Q23
What will be the error in the following Java code? byte b = 50; b = b * 50;
Q24
If an expression contains double, int, float, long, then the whole expression will be promoted into which of these data types?
Q25
Which class does all the Enums extend?