Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Type the following code. Understand the three test cases in the main function. Run the code. What are the results of the three test cases?

image text in transcribed
image text in transcribed
Type the following code. Understand the three test cases in the main function. Run the code. What are the results of the three test cases? Are the test cases sufficient? Rewrite these test cases in Junit. blic class DebugPractice \} public static void fun1(int[] data) \{ int n= datalength: int 1=0; II compare the data at index i with data at index i*2+1, II if bigger, then swap them, repeat at index i* 2+1 II The sequence of index i that will be checked will be 0,1,3,7,15,31, while ( data[i]> data[i*2+1]) \{ int t=data[i[2+1); data [[+2+1]= data[i]: data[]=t; i=i+2+1; > 1 public static void main(String[] arges) \{ "First test % System.out.printin("*-Test \#11.."); int] a={1,2,3}; System.out.printin("Before: "): for (int e:a) System.out.print(e+ ","): System.out.printin(); DebugPractice.fun1(a): System.out.printin("After: "); for (int e:a) System.out.print(e+ ","); System.out.printin(); r : Second Test % System.out.printin("mest \#2-."); int] b={10,9,8,7,6,5,4,3,2,1} System.out.printin("Before: "); for (int e:b) System.out.print(e+ ","); System.out.printin(); DebugPractice.fun1(b); System.out.printin("After: "); for (int e:b) System.out.print(e+ ","); System.out.printin(); r - Third Test */ System.out.println("-Test \#3-.-"); int]] c= new int[20]; c[0]=4; c[1]=3; c[3]=1; c[7]=8; c(15)=6; System.out.printin("Before: "); for (int e:c) System.out.print(e+ ","); System.out.printin(); DebugPractice_fix.fun1(c); System.out.printin("After: "): for (int e:c) System.out.print(e+,") System.out.printin()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is the relation of physical mathematics with examples?

Answered: 1 week ago

Question

What are oxidation and reduction reactions? Explain with examples

Answered: 1 week ago