Given the array of integers ‘array’ shown below : 13, 7, 27, 2, 18, 33, 9, 11, 22, 8.UGC-NET




UGC-NET | UGC NET CS 2017  



Given the array of integers ‘array’ shown below :


13, 7, 27, 2, 18, 33, 9, 11, 22, 8.

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]);

(A) 20 : 20
(B) 18 : 18
(C) 18 : 20
(D) 20 : 18


Answer: (C) 

Comments

Popular Posts