Question: NEED HELP ASAP PLEASE! MATCHING QUESTION! Use a match atmost once. Consider the following instance variable and method. private int[] a; public int f(int x)
NEED HELP ASAP PLEASE! MATCHING QUESTION!

Use a match atmost once. Consider the following instance variable and method. private int[] a; public int f(int x) { PRECOND for (int k = a.length - 1; k >= 0; k-- LOOPINVAR if (a[k] 0); 3. assert(true) 4. assert(false); 5. All values in positions through m are less than n. junit test for the method that fails 6. All values in positions m+1 through a.length-1 are greater than or equal to n. 7. All values in positions m+1 through a.length-1 are less than n. Best postcondition 8. The smallest value is at position The best Precondition is. m. junit test for the method that passes 9. The largest value that is smaller than n is at position m. Loop invariant 10. All values in positions k+1 through a.length-1 are greater than or equal to n. 11. All values in positions k through a.length-1 are less than n. 12. All values in positions through k are less than n. 13. int[] a = (3,9,3,5,8) assertTrue(f(4) == 2); 14. int[] a = (1,9,3,5,8) assertTrue(f(4)==0)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
