Vidyalelo
Data Structure · Q84

Searching Algorithms

Programming · Data Structure · question 84

Q84

What does the following piece of code do? for (int i = 0; i < arr.length-1; i++) for (int j = i+1; j < arr.length; j++) if( (arr[i].equals(arr[j])) && (i != j) ) System.out.println(arr[i]);

A.
Print the duplicate elements in the array
Answer
B.
Print the element with maximum frequency
C.
Print the unique elements in the array
D.
Prints the element with minimum frequnecy

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board