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

please help me to write sample tets cases for a List box

1 Answers  


Write TestCases for mobile

2 Answers   Philips,


At first time when you receive the application at that time which testing you do?

1 Answers  


What are the properties of a good requirement?

0 Answers  


Tell me about the best bug you ever found.

1 Answers   Accenture, SPIC,






How we make scripts for unit testing with Nunit.

0 Answers  


hello frens. Im Arun from the uk. im planning to apply for tester jobs with 3yrs experience. the problem is i dont have resumes. i have to mention atleast 3 projects (preferably financial projects) in my CV. im totally blank. can u plz send ur CV's to my email.... arunmoses1982@yahoo.com. this would be a great help from you guyz. n u need any help from me? just mail me n ill get in touch with u. Thanx.

0 Answers  


Is Software Testing categorized as a technical or Non-technical job???

6 Answers  


In an application currently in production, one module of code is being modified. Is it necessary to re- test the whole application or is it enough to just test functionality associated with that module?

3 Answers   Media Magic, Ordain Solutions,


2.How are you going to map between Test Scenarios and Test Cases?

2 Answers  


What is the difference between Functional testing and Functionality testing?

10 Answers   TCS,


State a generalized process for load test? Or explain how you did it previously.

0 Answers  


Categories