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 ? | 9 Yes | 3 No |
What is meant by Metrices?What is purpose of Metrices in Testing?What is Template for that?PLZ REPLY ASAP.Thanks in advance.
How u test MS- Vista without any requirement Doc.
what is white box testing and what is the teckniques
What is difference between windows 2000 server and windows 2003 server
23 Answers CMS, IBM, Logica CMG, Microsoft, nvidia, PC Solutions, Satyam, Slash Support, Symantec, Vee Technologies, Veritas, Wipro,
What r the attribute of good software test?
how do we update the test cases if the requirements change in manual testing. if we r not using quality center. depending on the changed requirements do i need to write a new test case or can we update the old test case.basically i want to update i dont want to write a new test case. so plzzzzzz answer.
What is difference between Smoke&Sanitary Testing?
what are the different type of bugs in client server and web based?and what is the difference in testing client server and web based?
difference between smoke and sanity testing? help me with the clear answer...
5 Answers Cap Gemini, Polaris,
can anyone send me the test cases apart from an bank application form?
can u give me the Test case step template and write one test case step (ex)please
What is the difference between version and build.
6 Answers AppLabs, CTS, Seed Infotech,