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

Can the static testing be done for both web and client server application?

4 Answers  


If you found any high priority bug before release product then what will you do as tester if you only tester in team??

1 Answers   Persistent,


find out the odd man out in following options GUI spy, Object Spy, Gui map editor, Inspector.

1 Answers  


what is the architecture of your current project?

0 Answers   Value Labs,


What is the difference between Compatibility and Configuration testing?

1 Answers  






What is difference between V-Model and Agile Model?

0 Answers   TCS,


How do you prepare a regression testing suite?

4 Answers  


what is tracebility matrix?

8 Answers   IonIdea, TCS,


how to test if there are 2000 requirements ro be tested in an application ?

4 Answers  


Can any one tell me the format/columns for writing test scenarios in excel sheet?

4 Answers  


Any one pls describe master and visa card are same equity or different. and is it possible have same card number different expiry date with each master and visa.

2 Answers   iFlex,


what is the diff. bw separate database testers and manual testers with sql knowledge guys... iam confusing so much ,,in cmpny database testers are not working on manual..? both positions are same are not? explian clesly with example? thank u

0 Answers   Wipro,


Categories