Question: 1. Consider the JAVA method findSomething below: /** Precondition: a.length is equal to b.length. */ public static boolean findSomething(int[] a, int[] b) { for (int
1. Consider the JAVA method findSomething below:
/** Precondition: a.length is equal to b.length. */
public static boolean findSomething(int[] a, int[] b) { for (int aValue: a) { boolean found = false; for ( int bValue: b) { if (bValue == aValue) found = true; }
if (!found) return false;
}
return true;
}
Which best describes what method findSomething does? Method findSomething returns true only if
a. Arrays a and b contain identical elements in the same order
b. Arrays a and b contain identical elements in reverse order
c. Arrays a and b are permutations of each other
d. Array a contains at least one element that is also in b
e. Every element of array a is also in b, and every element of array b is also in a.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
