| C | Create a class that is derived from a parent class 3. Consider both of the following approaches to the binary search: Approach A private static int search (int[] a, int searchValue) { int left = 0 int right = a.length1 while (left <= right) { int midpoint = (left+right)/2 if (a[midpoint] == searchValue) return midpoint else if (a[midpoint] < searchValue) left = midpoint + 1 else right = midpoint 1 } return 1 } Approach B private static int search (int[] a, int target, int left, int right) { if (left > right) return 1 else { int midpoint = (left + right) / 2 if (a[midpoint] == target) return midpoint else if (a[midpoint] < target) return search (a, target, midpoint + 1, right) else return search (a, target, left, midpoint 1) } } Which approach uses recursion? Explain why Approach B has more parameters than Approach A. | A. | Approach B uses recursion. Approach B includes the additional left and right parameters because they are required in the process of recursion to reduce the search area, either by increasing the value of left or decreasing the value of right when a recursive call is made. | | B. | Both Approach A and Approach B use recursion. The additional parameters are not necessary and should be removed to make the method implementation more readable. | | C. | Approach B uses recursion. Approach B has left and right parameters because they are not defined locally in the method itself. Either defining these values in the parameters or locally in the method is a matter of preference and has no bearing on the outcome. These values are needed to define the search area, either by increasing the value of left or decreasing the value of right. | | D. | Approach A uses recursion. Approach B requires the left and right parameters because they are needed in the process of iteration to reduce the search area, either by increasing the value of left or decreasing the value of right. 4. If an instance method calls another instance method of the same class, an object must be used for dereferencing the call. | | False 5. Assume that in a given class, Villain, the instance member xCoordinate and static member newOriginX, are both are declared public, allowing the client to use them directly (that's fine -- maybe there is no illegal value for either, so no need to provide mutators). Consider legal and correct the client code (where the two objects are members of the class in question): evilVillain1.xCoordinate = 3; evilVillain1.newOriginX = -2.2; evilVillain2.xCoordinate = 5; evilVillain2.newOriginX = -1.4; Immediately after this code, what are the values of the instance and static members? (We will get warnings about accessing the static member through an object vs. the class name, but for this problem we ignore the warning - it's okay.) | A | evilVillain1 has xCoordiante = 3 evilVillain2 has xCoordiante = 5 the class's static, if accessed through evilVillain1.newOrigin, = -1.4 the class's static, if accessed through evilVillain2.newOrigin, = -1.4 | | B | evilVillain1 has xCoordiante = 3 evilVillain2 has xCoordiante = 5 the class's static, if accessed through evilVillain1.newOrigin, = -2.2 the class's static, if accessed through evilVillain2.newOrigin, = -2.2 | | C | evilVillain1 has xCoordiante = 5 evilVillain2 has xCoordiante = 5 the class's static, if accessed through evilVillain1.newOrigin, = -2.2 the class's static, if accessed through evilVillain2.newOrigin, = -2.2 | | D | evilVillain1 has xCoordiante = 3 evilVillain2 has xCoordiante = 5 the class's static, if accessed through evilVillain1.newOrigin, = -1.4 the class's static, if accessed through evilVillain2.newOrigin, = -2.2 | | | |