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 ?    6 Yes 3 No

Post New Answer

More Manual Testing Interview Questions

How to write gui test cases ? plz gve me some sugessition about gui test cases along with examples plz plz any one plz

3 Answers   CSE, TCS,


Which methodologies, Technologies are fallowed in your company?

3 Answers  


pl. give me the list of top jobs website to register i have 2Yrs. Experience in manual testing

0 Answers  


which out of the following can be considered as performance testing:- 1. Benchmarking 2.Recovery testing 3. more than one user testing

0 Answers   ADITI,


what is analysizing test results & creating the bug reportts?

1 Answers   Semantic Space,






1.What are the difference b/w client & server?

4 Answers   IBM,


Use of Requirements Traceability?

3 Answers  


what is test plan

8 Answers   CTS,


What is Deep Structure Testing?

1 Answers   iSoft,


Hi my name is surbhi. I am a commerce graduate and doing Testing course. I want to make my career in it industry. But right now i m full confused dnt know from where to Start what to do. I cant stay without job also. Write now Working in a hotel. Pls suggest me? How to make my carreer In testing and is there any jobs for freshers in bangalore

3 Answers   STG,


what is the diff b/n testing methodologies and testing techniques?

7 Answers   Thomson,


iam new testing, i want improve writing test cases and bug defect etc? any on give suggestion pls?

0 Answers   Satyam,


Categories