Menu

[Solved]Consider Following Program Test Cases Main Argc Argv Int Argc R Char Argv R 1 2 3 Atoi Arg Q37240841

Consider the following program and test cases.
• main(argc,argv)• int argc, r, i;• char *argv[];• { r = 1;• for i = 2 to 3 do• if (atoi(argv[i]) > atoi(argv[r])) r = i;• printf(“Value of the rank is %d n”, r);• exit(0); }
• Test Case 1:
input: 1 2 3output: Value of the rank is 3• Test Case 2:input: 1 2 1output: Values of the rank is 2• Test Case 3: input: 3 1 2output: Value of the rank is 1
Mutant 1: Change line 5 to for i = 1 to 3 doMutant 2: Change line 6 to if (i > atoi(argv[r])) r =i;Mutant 3: Change line 6 to if (atoi(argv[i]) >=atoi(argv[r])) r = i;Mutant 4: Change line 6 to if (atoi(argv[r]) >atoi(argv[r])) r = i;
Design one more mutant. Execute the above programs for themutants 1,2,3 and 4 and your mutant. Evaluate the results for eachtest case separately for each mutant. Identify which ones arekillable and which ones are not, with the given test cases.

Expert Answer


Answer to Consider the following program and test cases.• main(argc,argv)• int argc, r, i;• char *argv[];• { r = 1;• for… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *