(Solved) : 20 Correct Version Gcd Algorithm Logical Errors Say Run Function Inputs N1 9 N2 26 Set Bre Q44084311 . . .

![21. Consider the following snippet of code. public static void main (String[] args) { {3,5,7}; { 4,6,8}; int[] one int[] two](https://media.cheggcdn.com/media/cce/cce996f3-d081-4488-ab66-461f56f35225/phphmGNsa.png)
20. Below is the CORRECT version of the gcd algorithm with no logical errors. Say you run this function with inputs n1 = 9, n2 = 26, and you set a breakpoint at line 4. What is the value stored in variable n2 when the program reaches this breakpoint (before it executes the line). public static void gcd(int n1, int n2) { while(n1 != n2) { 2 if (n1 > n2) { n2; 4 n1 } else { n2 — n1; } } System.out.println(n1); 10 A. 9 B. 26 C. 8 (ANSWER) D. 17 E. None of the above 21. Consider the following snippet of code. public static void main (String[] args) { {3,5,7}; { 4,6,8}; int[] one int[] two int[][] a mistery (a, one, two); System.out.println (Arrays.deepToString (a)); {one, two}; } public static void mistery (int[ ] b, int[] one, int[] two) { new int [2][3]; int[][] a = b[1] = a[0]; a [0] = two; a[1] for (int i=0; i<3; i++) { one [i]++; two [i] one; *= 2; } What does it print? Arrays.deepToString () returns a string representation of the objects in the array. [ [4, 6, 81, [3, 5, 7]] [ [4, 6, 81, [0, 0, 0]] (ANSWER) [[8, 12, 16], [4, 6, 8]] A. B. C. D. [[3, 5, 7], [4, 6, 81] [[0, 0, 0], [8, 12, 16]] E. Show transcribed image text 20. Below is the CORRECT version of the gcd algorithm with no logical errors. Say you run this function with inputs n1 = 9, n2 = 26, and you set a breakpoint at line 4. What is the value stored in variable n2 when the program reaches this breakpoint (before it executes the line). public static void gcd(int n1, int n2) { while(n1 != n2) { 2 if (n1 > n2) { n2; 4 n1 } else { n2 — n1; } } System.out.println(n1); 10 A. 9 B. 26 C. 8 (ANSWER) D. 17 E. None of the above
21. Consider the following snippet of code. public static void main (String[] args) { {3,5,7}; { 4,6,8}; int[] one int[] two int[][] a mistery (a, one, two); System.out.println (Arrays.deepToString (a)); {one, two}; } public static void mistery (int[ ] b, int[] one, int[] two) { new int [2][3]; int[][] a = b[1] = a[0]; a [0] = two; a[1] for (int i=0; i
Expert Answer
Answer to 20. Below is the CORRECT version of the gcd algorithm with no logical errors. Say you run this function with inputs n1 =…
OR