Instruction

  • This test contains a total of 15 questions.
  • Do not switch the tab or open a new window, otherwise, the test will be submitted automatically.
  • Test time is 10 minutes.

Java Beginner (Level 3)

Q 1.
Can we create an instance of Enum outside of Enum itself?

Q 2.
If we try to add Enum constants to a TreeSet, what sorting order will it use?

Q 3.
Which of the following is the advantage of BigDecimal over double?

Q 4.
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);

Q 5.
Which class is a library of functions to perform arithmetic operations of BigInteger and BigDecimal?

Q 6.
How to convert Date object to String?

Q 7.
How to identify if a timezone is eligible for DayLight Saving?

Q 8.
How to get UTC time?

Q 9.
Which of these can be returned by the operator &?

Q 10.
Which of these can not be used for a variable name in Java?

Q 11.
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++;
            }
        }
    }

Q 12.
Which of these is necessary condition for automatic type conversion in Java?

Q 13.
What is the prototype of the default constructor of this Java class?
public class prototype { }

Q 14.
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);
    }
}

Q 15.
Which of these is an incorrect array declaration?


Time: