adspace


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.

Answer Posted / 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 ?    10 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you do if the bug that you found is not accepted by the developer and he is saying its not reproducible.

1256


1.what kind of testing have you done ?

2942


could u pls anyone tel me .."which is the best instute that provides eficient practical knowledge and also real-time oriented knowldge to do a project in manual and automation testing..in hyd" pls send me to dis mail-id if u find any..? sinducute17@gmail.com

2273


Hi there Does anybody can respond to my Questions? Is some one there to answer my Questions posted in Software testing category.pls E-mail to sunitht27@yahoo.com

2257


HI FRNDS, I HAVE 2.5 years OF exp In Manual Testing,Plz let me know if thr r any oppurtunities in any company in Bangalore ID:dsnithi@gmail.com Thanks in Advance

2289


What is the difference between baseline and traceability matrix?

1348


Hi friends Does anyone have screen shot of POWERMHS and please can anyone post anything which will be helpful to understand POWERMHS. thanks.

3150


what is the architecture of your current project?

2533


how to connect your project in database?

2174


Hi, i am looking job in perfomance testing using Loadrunner can any body help me a project in any domine plz(Usah) chs_29@rediffmail.com

2153


Hi, I am planing to give ISTQB - Foundation level exam. Can anyone forward the ISTQB materials at laxmi_002@rediffmail.com mail ID.

2028


Hi,friends i am going to write ICST certificate exam on augest.So can anybody post some of sample qusetions for ICST certificate exam.Really it will be useful for me

2158


hi what are the test cases for web application..i need these example..please..mail me at mina_ims@yahoo.com

2105


What is the difference between three tier and two tier application?

1231


hello frens. Im Arun from the uk. im planning to apply for tester jobs with 3yrs experience. the problem is i dont have resumes. i have to mention atleast 3 projects (preferably financial projects) in my CV. im totally blank. can u plz send ur CV's to my email.... arunmoses1982@yahoo.com. this would be a great help from you guyz. n u need any help from me? just mail me n ill get in touch with u. Thanx.

1982