Question

In: Computer Science

specifications for Tasks: 1. Write a program which accepts a list of integers which may contain...

specifications for Tasks:

1. Write a program which accepts a list of integers which may contain duplicated integers, and which outputs the input list as a sorted list in ascending order without duplication You can use either Ruby, C, C++, C# or Java to implement your program (referred to as P).

2. Design a test suite of 10 test cases (referred to as TC). Each test case has not more than 20 integers.

3. Test P against TC to make sure that your P passes every test case of TC prior to continuing the other tasks.

4. Manually construct two non-equivalent mutants for P (referred to M1 and M2).

5. Choose 2 MRs that you developed in Assignment 1 (referred to as MR1 and MR2).

6. Compute the effectiveness for MR1 and MR2 using M1, M2 and the test cases in TC as their source test cases.

7. You are required to submit a report which must contain at least the followings items:

a. Program listing of P.

b. A description of all elements of TC. 2

c. A description of the mutated statements in P for mutants M1 and M2. Note that you need not to give the complete program listings for mutants M1 and M2. You are only required to point out which statements in P are changed and how are they changed to construct M1 and M2.

d. Explain the process that you applied to guarantee that your M1 and M2 are nonequivalent mutants.

e. Explain with sufficient details on how the effectiveness for MR1 and MR2 are calculated, using the metric of expected ratio of violations.

f. Discuss and interpret your results about the effectiveness for MR1 and MR2.

Solutions

Expert Solution

This answer contain answer for first 3 parts.

1. Please find the below code in C#

using System;
using System.Collections.Generic;
using System.Linq;

namespace SortingPgm
{
    class Sorting
    {
        static void Sorting_number(List<int> a)
        {
            List<int> q;
            q = a.Distinct().ToList();
            q.Sort();
            Console.WriteLine("Sorted List: ");
            for (int i = 0; i < q.Count; i++)
            {
                Console.WriteLine(q[i]);
            }

        }
        static void Main(string[] args)
        {
            List<int> q=new List<int>();
            Console.WriteLine("Enter number of elemets");
            int n = Convert.ToInt32(Console.ReadLine());
            if (n > 20) { Console.WriteLine("Out of limit"); }
            else
            {
                Console.WriteLine("Enter the elemets");
                for (int i = 0; i < n; i++)
                {
                    q.Add(Convert.ToInt32(Console.ReadLine()));
                }
            }
            Sorting_number(q);
            Console.ReadLine();
        }
    }
}

2.Test suit

Test case

Description

Steps

Expected Result

Actual Result

Pass/fail

1

List with size 1

Test for list with one element

1 . Enter number of element 1

2. enter 20 in keyboard

Sorted list is:

20

2

List with duplicate elements

Test for list with duplicate elements

1.Enter the number of element 5

2.Enter 1 2 3 1 5

Sorted list is: 1 2 3 5

3

List without duplicate elements

Test for list without duplicate elements

1.Enter the number of element 6

2.Enter the elements 1 5 8 7 9 3

Sorted list is:1 3 5 7 8 9

4

List with sorted elements

Test for list with elements are sorted in ascending order

1.Enter the number of element 6

2.Enter the elements 1 3 5 7 8 9

Sorted list is:1 3 5 7 8 9

5

List with maximum number

Test for list with maximum number of elements

1.Enter the number of element 20

2.Enter the elements 1 2 3 4 1 2 3 4 5 9 6 7 8 5 2 3 4 5 6 7

Sorted list is: 1 2 3 4 5 6 7 8 9

6

List without elements

Test for empty list

1.Enter he number of elements 0

Sorted list is:

7

List with sorted elements

Test for list with elements are sorted in descending order

1.Enter the number of element 6

2.Enter the elements 9 8 7 5 3 1

Sorted list is:1 3 5 7 8 9

8

List with negative numbers

Test for list with negative numbers

1.Enter the number of element 6

2.Enter the elements 9 8 7 -5 3 1

Sorted list is:--5 1 3 7 8 9

9

List with floating point numbers

Test for list with floating point numbers

1.Enter the number of element 6

2.Enter the elements 1.1

Raise exception

10

List with more than 20 numbers

Test for list more than 20

1.Enter the number of element 21

Display message out of limit

3.

Please find below table contain result of test case test againts the program

Test case

Description

Steps

Expected Result

Actual Result

Pass/fail

Screenshot

1

List with size 1

Test for list with one element

1 . Enter number of element 1

2. enter 20 in keyboard

Sorted list:

20

Sorted list is:

20

Pass

2

List with duplicate elements

Test for list with duplicate elements

1.Enter the number of element 5

2.Enter 1 2 3 1 5

Sorted list : 1 2 3 5

Sorted list : 1 2 3 5

Pass

3

List without duplicate elements

Test for list without duplicate elements

1.Enter the number of element 6

2.Enter the elements 1 5 8 7 9 3

Sorted list :1 3 5 7 8 9

Sorted list :1 3 5 7 8 9

Pass

4

List with sorted elements

Test for list with elements are sorted in ascending order

1.Enter the number of element 6

2.Enter the elements 1 3 5 6 7 8

Sorted list :1 3 5 6 7 8

Sorted list :1 3 5 6 7 8

Pass

5

List with maximum number

Test for list with maximum number of elements

1.Enter the number of element 20

2.Enter the elements 1 2 3 4 1 2 3 4 5 9 6 7 8 5 2 3 4 5 6 7

Sorted list : 1 2 3 4 5 6 7 8 9

Sorted list : 1 2 3 4 5 6 7 8 9

Pass

6

List without elements

Test for empty list

1.Enter the number of elements 0

Sorted list :

Sorted list :

Pass

7

List with sorted elements

Test for list with elements are sorted in descending order

1.Enter the number of element 6

2.Enter the elements 9 8 7 5 3 1

Sorted list : 1 3 5 7 8 9

Sorted list : 1 3 5 7 8 9

Pass

8

List with negative numbers

Test for list with negative numbers

1.Enter the number of element 6

2.Enter the elements 9 8 7 -5 3 1

Sorted list is:--5 1 3 7 8 9

Sorted list is:--5 1 3 7 8 9

Pass

9

List with floating point numbers

Test for list with floating point numbers

1.Enter the number of element 6

2.Enter the elements 1.1

Raise exception

Exception raised

Pass

10

List with more than 20 numbers

Test for list more than 20

1.Enter the number of element 21

Display message out of limit

Sorted List:

out of limit

Sorted List:

Pass


Related Solutions

Write a complete MiniMIPS program that accepts a seqeunce of integers at input and after the...
Write a complete MiniMIPS program that accepts a seqeunce of integers at input and after the receipt of each new input value, displays the largest and smallest integers thus far. An input of 0 indicates the end of input values and is not an input value itself. Note that you do not need to keep all integers in memory.
Write a program which accepts a sequence of comma-separated numbers from console and generate a list...
Write a program which accepts a sequence of comma-separated numbers from console and generate a list and a tuple which contains every number. Suppose the following input is supplied to the program: 34, 67, 55, 33, 12, 98. Then, the output should be: ['34', '67', '55', '33', '12', '98'] and ('34',67', '55', '33', '12', '98').
Write a program which accepts a sequence of comma-separated numbers from console and generate a list...
Write a program which accepts a sequence of comma-separated numbers from console and generate a list and a tuple which contains every number. Suppose the following input is supplied to the program: 34, 67, 55, 33, 12, 98. Then, the output should be: ['34', '67', '55', '33', '12', '98'] and ('34',67', '55', '33', '12', '98'). Input can be comma separated in one line.
Write a Java program that reads a list of integers into an array. The program should...
Write a Java program that reads a list of integers into an array. The program should read this array from the file “input.txt”. You may assume that there are fewer than 50 entries in the array. Your program determines how many entries there are. The output is a two-column list. The first column is the list of the distinct array elements; the second column is the number of occurrences of each element. The list should be sorted on entries in...
In a program, write a function that accepts two arguments: a list, and a number n....
In a program, write a function that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all of the numbers in the list that are greater than the number n. The program should ask for a list of numbers from the user as well as a value (a, b, c)--> inputs from user. After that, each number in that list should be compared to that value (a or b or...
1) Write a function searchValue that accepts an array of integers, the size of the array,...
1) Write a function searchValue that accepts an array of integers, the size of the array, and an integer. Find the last occurrence of the integer passed in as an input argument in the array. Return the index of the last occurrence of the value. If the value is not found, return a -1 2) Write the line of code to call the previous function assuming you have an array vec with length n, and are looking for the number...
java Problem 3: An Interesting Problem Write a program that accepts two positive integers: a deposited...
java Problem 3: An Interesting Problem Write a program that accepts two positive integers: a deposited amount of money and an interest rate, as an annual percentage rate. Your program will calculate the number of years that will take for the account balance to reach $1, 000,000. You can assume that the initial deposit is less than $1,000,000 Input The input will begin with a single line containing T , the number of test cases to follow. The remaining lines...
1.Write a function div7(lst) which takes in a list of integers, and returns a list of...
1.Write a function div7(lst) which takes in a list of integers, and returns a list of booleans of the same length, such that for each integer in the original list, the boolean in the output list is True if that integer was divisible by 7, or False if not. Use list comprehensions in python, the function only could be at most two lines long. Here is some examples: >>> div7([14, 5, 7, 3, 29, 28, 10]) [True, False, True, False,...
Write a python program per the following specifications: 1. Populate an array(list) of size n =...
Write a python program per the following specifications: 1. Populate an array(list) of size n = 50 randomly with only integers 0 and 1 2. Repeat step 1 nn = 1000 times using either a while loop or a for loop see below At this point you should have a total of 50000 observations with either 0 or 1 This is our experimental data which we will compare to the theoretical expected result From Lab06template.py import random temp = -1...
Write a Calculate class which contains methods that accepts two integers as arguments and return the...
Write a Calculate class which contains methods that accepts two integers as arguments and return the results of Addition, Subtraction, Division and Multiplication. Call these methods though main()and print the results.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT