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

Post New Answer

More Manual Testing Interview Questions

Write TestCases for mobile

2 Answers   Philips,


2. The prime benefit of testing is that it results in improved defects a. True b. False

4 Answers  


what is the difference between bug and issue?

2 Answers  


what is the decission table?

1 Answers   Wipro,


I have 2 yrs 10 months experience in manual testing. there is a gap of 3 yrs in between. just 3 months before i rejoined the same company. I am looking for new & better job.What I have to enhance my career to up level, should I have to do Automation course or any other. Guide me properly.

0 Answers  


there is a mobile phone and it has got 2 buttons one is it takes photo other is it uploads photo to facebook how to you test this application ?

7 Answers   CTS, Murugappa Group,


Which method of testing we use to test LOGIN page?

10 Answers   Cap Gemini,


How much the bug is affecting the functionality of the application?

0 Answers  


1] Test Management Tool ? 2] What is tracebility Matrix? 3] What is RTM ? 4] What Is Functional testing 5] What is Regration Testing and Sanity Testing 6] Diff in Sanity and Functional Tetsing 7] Integration Tetsing 8] Diff in Primary Key and Unique Key -Should pass primary Key as null 9] What is composit Key 10] Defect Management tool in detail 11] What is Seviarity and Priority 12] Composite Key

2 Answers   HCL,


What is difference between Sanity Testing & smoke Testing?

1 Answers  


i got my Quality center cd from Nageswararao institute?can any body help me how to install it?

2 Answers  


6 what do you like least about testing?

0 Answers   VJIL Consulting,


Categories