Black Box Testing
Black Box Testing
Solution
ax2+bx+c=0
Real Roots
BLACK BOX TESTING
Solution
The number of test cases can be derived form above relations and shown below:
2 1 50 50 Real roots
3 50 50 50 Imaginary roots
Here test cases 5 and 8 are redundant test cases. If we choose any value other than nominal,
we may not have redundant test cases. Hence total test cases are 10+4=14 for this problem.
//Calculation of effort and development in a COCOMO model
#include<stdio.h>
#include<conio.h>
#include<math.h>
void organic(int K)
{
float E,D;
E=2.4*(K^1.05);
D=2.5*(E^0.38);
printf("effort and development of organic model is %d, %d",E,D);
}
void semidetached(int L)
{
float E,D;
E=3.0*(L^1.12);
D=2.5*(E^0.35);
printf("effort and development of semidetached model is %d,
%d",E,D);
}
void embedded(int C)
{
float E,D;
E=3.6*(C^1.20);
D=2.5*(E^0.32);
printf("effort and development of embedded model is %d,
%d",E,D);
}
void main()
{ int KLOC;
printf("enter size of the software development:");
scanf("%d",KLOC);
printf("organic mode");
organic(KLOC);
printf("semidetached mode");
semidetached(KLOC);
printf("embedded mode");
embedded(KLOC);
getch();
}
//PROGRAM TO IMPLEMENT FUNCTION POINT ANALYSIS
#include<stdio.h>
#include<conio.h>
void main()
{
int f_ip[3];
int f_op[3];
int f_inq[3];
int f_ilf[3];
int f_eif[3];
int f_ufp=0;
int r[14];
int i,f;
float caf,fp;
clrscr();
printf("enter number of lowest inputs\n");
scanf("%d",f_ip[0]);
printf("enter number of average inputs\n");
scanf("%d",f_ip[1]);
printf("enter number of high inputs\n");
scanf("%d",f_ip[2]);
printf("enter number of low outputs\n");
scanf("%d",f_op[0]);
printf("enter number of average outputs\n");
scanf("%d",f_op[1]);
printf("enter number of high outputs\n");
scanf("%d",f_op[2]);
printf("enter number of low inquiries\n");
scanf("%d",f_inq[0]);
printf("enter number of average inquiries\n");
scanf("%d",f_inq[1]);
printf("enter number of high inquiries\n");
scanf("%d",f_inq[2]);
printf("enter number of low internal logical files\n");
scanf("%d",f_ilf[0]);
printf("enter number of average internal logical files\n");
scanf("%d",f_ilf[1]);
printf("enter number of high internal logical files\n");
scanf("%d",f_ilf[2]);
printf("enter the number of low external interface files\n");
scanf("%d",f_eif[0]);
printf("enter the number of average external interface files\n");
scanf("%d",f_eif[1]);
printf("enter the number of high external interface files\n");
scanf("%d",f_eif[2]);
f_ufp = ((f_ip[0]*3)+(f_ip[1]*4)+(f_ip[2]*6)+(f_op[0]*4)+
(f_op[1]*5)+(f_op[2]*7)+
(f_inq[0]*3)+(f_inq[1]*4)+(f_inq[2]*6)+(f_ilf[0]*7)+(f_ilf[1]*10)+
(f_ilf[2]*15)+
(f_eif[0]*5)+(f_eif[1]*7)+(f_eif[2]*10));
printf("\nunadjusted function point = %d", f_ufp);
printf("\ngive ratings for factors\n0. no influence\t1.
incidental\t2. moderate\t3. average\t4. significant\t5.
essential\n");
printf("\n\n does system require reliable backup and recovery\n");
scanf("%d", r[0]);
printf("is data communication required\n");
scanf("%d", r[1]);
printf("are there distributed processing functions\n");
scanf("%d",r[2]);
printf("is performance critical\n");
scanf("%d",r[3]);
printf("will system run in an existing heavily utilized operational
environment\n");
scanf("%d",r[4]);
printf("does system require online data entry\n");
scanf("%d",r[5]);
printf("input transaction over multiple screens\n");
scanf("%d",r[6]);
printf("are master files updated on line\n");
scanf("%d",r[7]);
printf("is i/ps, o/ps, files, inquiries complex\n");
scanf("%d", r[8]);
printf("is internal processing complex\n");
scanf("%d", r[9]);
printf("is code reusable\1");
scanf("%d",r[10]);
printf("are conversions and instll. included in design\n");
scanf("%d",r[11]);
printf("is system designed for multiple instll. in diff. orgs.\n");
scanf("%d",r[12]);
printf("is app. designed to facilitate change and ease of use by
user\n");
scanf("%d",r[13]);
for(i=0;i<14;i++)
{
f+=r[i];
}
caf=(0.65+(0.01*f));
fp=f_ufp*caf;
printf("fnction point = %f",fp);
getch();
}
//PROGRAM TO FIND THE LINES OF CODE(LOC) IN THE GIVEN
FILE.
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<stdlib.h>
FILE *fp;
void main()
{
char name[10],ch;
int count=0,fl=0,f1,f2=0,fn=0;
clrscr();
printf("Enter the file name:\t");
scanf("%s",name);
fp=fopen(name,"r");
if(fp==NULL)
{printf("Error- File does not exist");
getch();
exit(0);
}
while(!feof(fp))
{ fscanf(fp,"%c",&ch);
switch(ch)
{case '/': fl=1;
if (f2==1)
f2=0;
break;
case '*': if(fl==1)
f2=1;
break;
case '\n': if(f2==0&&fn==0)
{++count;}
fn=1;
break;
default : fl=0,fn=0;
}
}
Draw the flow graph & DD Path graph. Also find the independent paths from the DD Path
graph.
25, 26, 27
36, 37
(ii) ABFGNOQR
(iii) ABCEGNPQR
(iv) ABCDEGNOQR
(v) ABFGHIMQR
(vi) ABFGHJKMQR
(vii) ABFGHJMQR