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.



design a black box test suite for a program that accepts two strings and checks if the first strin..

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

Post New Answer

More Manual Testing Interview Questions

What is meant by Metrices?What is purpose of Metrices in Testing?What is Template for that?PLZ REPLY ASAP.Thanks in advance.

1 Answers  


How u test MS- Vista without any requirement Doc.

2 Answers   Syntel,


what is white box testing and what is the teckniques

2 Answers   Wipro,


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?

1 Answers  






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.

5 Answers  


What is difference between Smoke&Sanitary Testing?

9 Answers   HCL, Infotech,


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?

6 Answers   Tanla Solutions,


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?

1 Answers  


can u give me the Test case step template and write one test case step (ex)please

7 Answers   AppLabs,


What is the difference between version and build.

6 Answers   AppLabs, CTS, Seed Infotech,


Categories