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

Recently igot job,Please,help me,Can u explain the real time process of manual Testing from starting.Please don't mind.

4 Answers   Cambridge, Fortech,


if you have compressed file which has multiple source files,after make of this source file, you are getting undefinedreference error. How your will debug this problem ? Whatmight be different root causes for this ?

1 Answers   Tech Mahindra,


Tell me the Severity and Priority for the following Case. Login Page is not opening for the First Time - For Valid inputs and the login page is opening for the second time for valid inputs.....

2 Answers  


Explain Water fall Model

7 Answers   ITC Infotech,


Hi...What is Test design and Test data management in Test plan Document?

1 Answers   e Cognosys,






What is online testing?

4 Answers  


If any bug is found in exploratory testing, then may I consider it as a test case?

2 Answers  


What is Test Policy

7 Answers   JVS,


How would you do the ollowing Security Testing for web application? 1) Authentication. 2) Authorization. 3) cookies. 4) penetration testing. 5) session testing. 6) encryption and decryption testing

1 Answers   TCS, Wipro,


how to test an web application. and what step have to considered first.

1 Answers  


Integraton testing

6 Answers   Infosys,


What do you do in Configuration Management?

1 Answers   Zensar,


Categories