UGC-NET | UGC NET CS 2017 Jan - III | Question 38

Last Updated :
Discuss
Comments
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]);
20 : 20
18 : 18
18 : 20
20 : 18
Share your thoughts in the comments