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 1)

Q 1.
What is the range of short data type in Java?

Q 2.
An expression involving byte, int, and literal numbers is promoted to which of these?

Q 3.
Which data type value is returned by all transcendental math functions?

Q 4.
What will be the output of the following Java statement?
 class output
    {
        public static void main(String args[])
        {
            double a, b, c;
            a = 3.0 / 0;
            b = 0 / 4.0;
            c = 0 / 0.0;
            System.out.println(a);
            System.out.println(b);
            System.out.println(c);
        }
    }

Q 5.
What will be the output of the following Java code?
class area 
    { 
        public static void main(String args[])
        { 
            double r, pi, a;
            r = 9.8;
            pi = 3.14;
            a = pi * r * r;
            System.out.println(a);
        } 
    }

Q 6.
What is the numerical range of a char data type in Java?

Q 7.
Which of these values can a boolean variable contain?

Q 8.
Which one is a valid declaration of a boolean?

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

Q 10.
What will be the output of the following Java code?
class booloperators {
    public static void main(String args[]) {
        boolean var1 = true;
        boolean var2 = false;
        System.out.println((var1 & var2));
    }
}

Q 11.
What is the order of variables in Enum?

Q 12.
What will be the output of the following Java code?
enum Season {
    WINTER,
    SPRING,
    SUMMER,
    FALL
};
System.out.println(Season.WINTER.ordinal());

Q 13.
What will be the output of the following Java code snippet?
class A {}
enum Enums extends A {
    ABC,
    BCD,
    CDE,
    DEF;
}

Q 14.
What will be the output of the following Java code snippet?
enum Enums {
    A,
    B,
    C;private Enums() {
        System.out.println(10);
    }
}
public class MainClass {
    public static void main(String[] args) {
        Enum en = Enums.B;
    }
}

Q 15.
Which class does all the Enums extend?


Time: