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 Intermediate (Level 1)

Q 1.
How to format date from one form to another?

Q 2.
How to convert a String to a Date object?

Q 3.
Which of these is long data type literal?

Q 4.
What will be the output of the following Java program?
 class variable_scope
    { 
        public static void main(String args[]) 
        { 
            int x;
            x = 5;
            {
                int y = 6;
                System.out.print(x + " " + y); 
            } 
            System.out.println(x + " " + y);
        } 
    }

Q 5.
Which of these operators is used to allocate memory to array variable in Java?

Q 6.
Which of these is necessary to specify at time of array initialization?

Q 7.
What will be the output of the following Java code?
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;
            System.out.print(array_variable[i] + " ");
            i++;
        }
    }
}

Q 8.
What is the type of variable ‘b’ and ‘d’ in the following Java snippet?
int a[], b; 
int []c, d;

Q 9.
How to copy contents of array?

Q 10.
Where is an array stored in memory?

Q 11.
Which of these statements are incorrect?

Q 12.
What will be the output of the following Java program?
class leftshift_operator
    { 
        public static void main(String args[])
        {
            byte x = 64;
            int i;
            byte y;
            i = x << 2;
            y = (byte)(x << 2);
            System.out.print(i + " " + y);
        } 
    }

Q 13.
What will be the output of the following Java code?
class ternary_operator {
    public static void main(String args[]) {
        int x = 3;
        int y = ~x;
        int z;
        z = x > y ? x : y;
        System.out.print(z);
    }
}

Q 14.
Which of the below is invalid identifier with the main method?

Q 15.
How can we identify whether a compilation unit is class or interface from a .class file?


Time: