Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given below is a simple C program to accept a set of inputs and calculate standa

ID: 3877432 • Letter: G

Question

Given below is a simple C program to accept a set of inputs and calculate standard deviation. It has consciously been seeded with defects. If you were asked to perform white box testing on this program, identify some of the defects in the program. Also, list the methodology you used to identify these defects 2. CODE FOR CALCULATING STANDARD DEVIATION 2 AND 3 PROBLEM #include void main (argc, argv) int no numbers; /* The number of numbers for which std dev is to be calculated */ fioat mean, stdev; /* temporary variables int i, total; /* temporary variables / int numbers [100] * the actual numbers Rrintf ("please enter the number of numbers In") : scanf (" cd', ' &no; numbers) ;

Explanation / Answer

Defects:

1) mean is declared as float but total/no_numbers is Integer division and it won't give us float

2) stdev
is declared as float but total/no_numbers is Integer division and it won't give us float

3) stdev formula is
SD = sqrt (total/no_numbers) i.e Square root is missing

4) printf("The standard deviation is %f") : format specifier should be %f and not %d

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote