May 2026 Dumps
Accenture Mock 2026mediumMay 2026 DumpsProgramming

Accenture May 2026 Dumps Practice Question

Predict the output of the program: public class Test { public static void main(String[] args) { int n, temp = 0; int[] num_ar = new int[]{49, 56, 23, 16, 9, 34}; int[] temp_ar = new int[num_ar.length]; for(int i=0; i<num_ar.length; i++) { temp_ar[i] = num_ar[i]; } for(int i=0; i<num_ar.length; i++) { for(int j=0; j<num_ar.length; j++) { if(temp_ar[i] < temp_ar[j]) { temp = temp_ar[i]; temp_ar[i] = temp_ar[j]; temp_ar[j] = temp; } } } for(int i=0; i<num_ar.length; i++) { for(int j=0; j<num_ar.length; j++) { if(temp_ar[i] == num_ar[j]) { System.out.print(j + " "); } } } } }

Answer options

A
4, 5, 2, 1, 0, 3
B
Compile time error
C
4, 3, 2, 5, 0, 1
D
Runtime exception

Correct answer: 4, 3, 2, 5, 0, 1

Explanation

The code sorts elements ascending and prints their original indices in num_ar.

Related Accenture May 2026 Dumps questions

Practice more Accenture May 2026 Dumps questions

PrimerDumps has 1400+ primer questions, 2026 mocks and coding hands-on — all free.