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 ? | 6 Yes | 3 No |
Post New Answer View All Answers
What is quality center? How many built in tables does quality center have?
What r the things,u prefer and prepare before starting testing?
What is defect cascading in software testing?
What is difference between cmmi and cmm levels?
if yahoo ceo asks you to do performance testing for yahoo site, what are the inputs you ask from them?
What's the relationship between environment reality and test phases?
Write notes on apparel testing equipments.
Hi Friends, Just One Month Back I was Join in Small Company as a Testing Eng.I have Six Month Exp. In this Company all my team memb.r fresher & PM give responsibility on us to prepare all require QC doc. for our new project.So I need ur help in this matter .How Can I start my work and Which Doc.I start to collect & From Where I get Detail Information all abt these thing. Thanks to all friends who give reply to this. Suyog
In usability testing we check spelling, content, look and feel, color combination, link or menu navigation? please let me know more about usability testing.
When we use integration testing for any new system so why we required system testing.
What is AGP?what is setup.inf?What are the ways to install driver?
what is traceability matrix and its usefulness
Have you prepared traceability matrix and how to prepare it?
Can any one give a summary of testing a territory management system? what would be the test scenarios, few test cases. how it works.
Tell some examples of bug severity and bug priority?