design a black box test suite for a program that accepts
two strings and checks if the first string is a substring
of the second string and displays the number of times the
first string occurs in the second string.



design a black box test suite for a program that accepts two strings and checks if the first strin..

Answer / bhupndra

#include<stdio.h>
#include<conio.h>

int main()
{

int i=0,j=0,k=0,count=0,l=0,k1=0;
char a[80],b[80];

clrscr();
printf("\nEnter main string:-\n");
gets(a);
printf("\nEnter sub-string:-\n");
gets(b);

l=strlen(b);

while (a[i]!=EOF)
{
if (a[i]==b[j])
{
i++;
j++;
k1=1;

if (j==l)
{
j=0;
k=1;
count=count+1;
}
}
else
{
if (k1==1)
{
j=0;
k1=0;
}
else
i++;
}
}

if (k==1)
{
printf("\n\nThe given sub-string is present in the main
string.");
printf("\nIt is present %d times.",count);
}

else
{
if (k==0)
printf("\n\nThe given sub-string is not present in the
main string.");
}

}

Is This Answer Correct ?    9 Yes 3 No

Post New Answer

More Manual Testing Interview Questions

How the test plan is a tool and the product?

1 Answers   CitiGroup,


Can any explain briefly about RBT (risk based testing

2 Answers   DRDL,


How sanitary or smoke testing process will done in the application?mainly how we start doing that test?

2 Answers  


what are the critical bug occurs in banking domain?

1 Answers   Crea,


how many buils u r getting in u'r project?

5 Answers   Professional Access,


WAT IS RTVM?

2 Answers   TCS,


suppose the product/appication has to deliver to client at 5.00PM,At that time you or your team member caught a high severity defect at 3PM.(Remember defect is high severity) But the the client is cannot wait for long time.You should deliver the product at 5.00Pm exactly.then what is the procedure you follow?

6 Answers   DVH, Verizon,


How will we come to know that its a bug,in what situations we consider it as a bug?

3 Answers  


What is difference between Test Plan and Test Strategy

2 Answers   Ernst Young,


what is the difference betwen quality center version 9.0 and version 10.0

1 Answers  


can any one of u give templates for test plan and test strategy

2 Answers  


Swap 2 variables without using a temp variable

4 Answers   Oracle,


Categories