Question 1 of 25
Hints left: 3
Q1
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); } }
Q2
Is SimpleDateFormat thread safe?
Q3
How to convert a String to a Date object?
Q4
Which data type value is returned by all transcendental math functions?
Q5
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); } }
Q6
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._$); } }
Q7
What is BigDecimal.ONE?
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 will be the error in the following Java code? byte b = 50; b = b * 50;
Q10
Which of these can not be used for a variable name in Java?
Q11
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); } }
Q12
Which of the below data type doesn't support overloaded methods for +,-,* and /?
Q13
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); } }
Q14
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); } }
Q15
Which of these can be returned by the operator &?
Q16
What is the range of short data type in Java?
Q17
Are enums are type-safe?
Q18
Which class does all the Enums extend?
Q19
What is the prototype of the default constructor of this Java class? public class prototype { }
Q20
Which of these values can a boolean variable contain?
Q21
Which of the following is the advantage of BigDecimal over double?
Q22
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);
Q23
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); } }
Q24
If an expression contains double, int, float, long, then the whole expression will be promoted into which of these data types?
Q25
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); } }