Defect Classes The Defect Repository and
Defect Classes The Defect Repository and
• if ( money < 5 );
do this;
end;
3 . Data Defects
• These are associated with incorrect design of
data structures.
• For example, a record may be lacking a field, an
incorrect type is assigned to a variable or a field
in a record, an array may not have the proper
number of elements assigned, or storage space
may be allocated incorrectly.
• Software reviews and use of a data dictionary
work well to reveal these types of defects.
Data Defects
#include <stdio.h>
int main()
{ int array[0], minimum, size, c, location = 1;
printf("Enter the number of elements in array\n"); scanf("%d",&size);
printf("Enter %d integers\n", size);
for ( c = 0 ; c < size ; c++ )
scanf("%d", &array[c]);
minimum = array[0];
for ( c = 1 ; c < size ; c++ )
{ if ( array[c] < minimum )
{
minimum = array[c];
location = c+1; }
}
printf("Minimum element is present at location %d and it's value is
%d.\n", location, minimum); return 0; }
Correct program
#include <stdio.h>
int main()
{ int array[100], minimum, size, c, location = 1;
printf("Enter the number of elements in array\n"); scanf("%d",&size);
printf("Enter %d integers\n", size);
for ( c = 0 ; c < size ; c++ )
scanf("%d", &array[c]);
minimum = array[0];
for ( c = 1 ; c < size ; c++ )
{ if ( array[c] < minimum )
{ minimum = array[c];
location = c+1; } }
printf("Minimum element is present at location %d and it's value is
%d.\n", location, minimum); return 0; }
4 . Module Interface Description Defects
• These are defects derived from, for example,
using incorrect, and/or inconsistent parameter
types, an incorrect number of parameters, or
an incorrect ordering of parameters.
Module Interface Description Defects