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 / 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 |
explain current project?
what is mean by client and server?
what is monkey testing?
how can u do database testing manually?
how will u Do Smoke testing and Sanity testing for these fields:We have 3 fields on page: Name,Address and Pincode ?
Explain me in detail V model with diagram?
WHAT R THE TYPES OF TESTING U KNOW AND U EXPERIENCED?
what is server-side testing? what is automation framework?
What are the contents of a Test Plan?
Hi frnds dis ajay. can any one tell me correctly vat is ENCRYPTION & DECRYPTION ? hw s these are used in testing ? its an interview... tank u all frnds.............
What are all the scenario for 1.google analytics 2.api 3.paypal
In V-model both testing and development done simultaneosly,we know that.But how can you say that both happen parallely.how is it related in real time?This question has been asked to me today only.Can any one please help me on this?