Arrays


  1. How to copy contents of array?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Arrays class contains various methods for manipulating arrays (such as sorting and searching). Array is not a valid class.


  1. Where is array stored in memory?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Array is stored in heap space.Whenever an object is created, it’s always stored in the Heap space and stack memory contains the reference to it.



  1. Can you make an array volatile?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    You can only make variable pointing to array volatile. If array is changed by replacing individual elements then guarantee provided by volatile variable will not be held.


  1. What is the output of this program?

    public class arr_output
    {
    public static void main(String args[])
    {
    int arr_var[][] = {{ 1, 2, 3, 4}, { 4 , 5, 6, 7}, { 7, 8, 9, 10}};
    int sum = 0;
    for (int i = 0; i < 3; ++i)
    {
    for (int j = 0; j < 3 ; ++j)
    {
    sum = sum + arr_var[i][j];
    }
    }
    System.out.print(sum / 2);
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    None
    Output: 22



  1. How to sort an array?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Arrays class contains various methods for manipulating arrays (such as sorting and searching). Array is not a valid class.