Arrays


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Row


  1. Which of these is an incorrect Statement?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Array can be initialized using both new and comma separated expressions surrounded by curly braces example : int arr[5] = new int[5]; and int arr[] = { 0, 1, 2, 3, 4};



  1. What will this code print?

    public class array
    {
    public static void main(String args[])
    {
    int arr[] = new int [7];
    System.out.print(arr);
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    If we trying to print any reference variable internally, toString() will be called which is implemented to return the String in following form:
    [I@2a139a55


  1. Which of these is an incorrect array declaration?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Operator new must be succeeded by array type and array size.



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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Operator new allocates block of memory specified by the size of array, and gives the reference of memory allocated to the array variable.