Signup/Sign In

Basics of Core Java

This Test will cover the basic concepts of Core Java, including basic syntax, Operators, Variables, control statements, JVM, Java Array etc.
Q. Which of the following is a legal identifier in java ?
Q. Which of these is NOT a valid keyword or reserved word in Java ?
Q. Which is the legal range of values for a short ?

Q. Which of the following Array declaration statement is illegal ?
Q. What will happen if you try to compile and run the following code ?

    public class Test 
    { 
        public static void main(String argv[])
        { 
          int[] arr = new int[]{1,2,3};
          System.out.println(arr[1]); 
        } 
    }
    
Q. In the given Array declaration, which expression returns the output as 5 ?
int [] arr = { 23, 5, 78, 34, 2};
Q. What will be the output upon the execution of the following code ?

    public class Test
    {
      public static void main(String[] args)
      {
        int j = 5;
        for (int i = 0; i< j; i++)
        {
          if ( i <= j-- )
            System.out.print(  (i*j)  + " ");
        }
      }
    }
    

Q. Which declaration of the main() method is valid ?
Q. Is 3 * 4 equivalent to 3 << 2 ?
Q. Which one of the following is invalid declaration of a char ?
Q. What will be the output of the following code ?

    public class Test {
      public static void main(String[] args)
      {
        double d = 100.04;  
        float f = d;	
        System.out.println("Float value "+f);
      }
    }
    
Q. Is it possible in Java to create arrays of length zero ?
Q. Which operator will always evaluate all the Operands?

Related Tests: