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

What is the difference between baseline and traceability matrix?

1211


What exactly is quality control?

1119


What is a defect?

1134


can any one send sample test cases for database testing by taking an example? also leave emailid please. thanks (very urgent)

3135


What are the different strategies for rollout to end users?

1251


How to derive test data from the design documents?

2017


what is meant by application server and its functions?

6995


wat is meant by frontend and backend testing

6157


HI, This question is Investment Banking domain related Question. I was asked in an Interview to tell the 5 test cases for Equity,Bond,Futures and options. Please help.. Pragya

4494


How we will test ubercate

2057


How to do manual testing of a E-insurance project (end to end process)

3326


Difference between smoke and sanity testing

1829


What do you understand by usability testing?

1068


Can any one explain me about hybrid integration testing? and what is interface in integration testing? thanks in advance...... regards, MurthySharma.Manchella

2248


Can some one help me writing a manual test case for email applications like yahoo i need for www.everonn.com

1971