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