Given the array of integers ‘array’ shown below: What is

Q5062

PYQ UGC NET 2017

Given the array of integers ‘array’ shown below:

What is the output of the following JAVA statements?

int[] p = new int[10];
int[] q = new int[10];
for (int k = 0; k < 10; k++)
    p[k] = array[k];
q = p;
p[4] = 20;
System.out.println(array[4] + ":" + q[4]);
  1. A.

    20 : 20

  2. B.

    18 : 18

  3. C.

    18 : 20

  4. D.

    20 : 18

Attempted by 166 students.

Sign up free to check your answer

Sign up free

Explore the full course: Mppsc Assistant Professor Computer Science Paper 2

Loading lesson…