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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!