Find the Output: a[5] = {2,3,1,4,0}; for(i=0; i<5; i++){ a[a[i]]=a[i]; } for(i=0;i<5; i++){ System.out.println(i+ ""); }

Find the Output:

a[5] = {2,3,1,4,0};
for(i=0; i<5; i++){
a[a[i]]=a[i];
}
for(i=0;i<5; i++){
System.out.println(i+ "");
}

From the SGCL Assistant Programmer 2020 – Written exam, question 1 of 4.

More from this paper