Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

how to test a web application manually?can u explain indetail?

2039


Write positive and negative test cases for forgot password?

4841


Which testing model is best as per your understanding, and why?

1150


i have 2.5 years of experience in manual testing and qtp. can anyone say me what kind of questions do they ask on manual testing and qtp.

3480


Can you please explain me how to do testing of an E-insurance project end to end process..

2631


How to test the search functionality.For example in naukri advance search is there.how ca i test that page.

2135


Tell me example for Risk,Mitigation,Assumption?

2306


Define brain stromming and cause effect graphing?

1126


what is test strategy,test plan and test policy?Does anyone have dummy documents or any links that gives more idea about these?I am a beginner...interested in learning more abt testing.plz help and encourage me........!

1864


What are parametere require for Performance testing?

2382


what is quality Factor

2446


What is a top-down and bottom-up approach in testing?

1112


how to explain banking domain project in testing?

10876


how will you test transfer funds module...explain in detail

1571


What type of metrics would you use?

2202