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.
Answer Posted / 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 View All Answers
What are the disadvantages of manual testing?
In how many ways you perform batchtesting ?
Write 10 test scenarios to test remember me checkbox present in login window
What was a problem you had in your previous assignment (testing if possible)? How did you resolve it?
what is scrum how with ex?
Can some one help me writing a manual test case for email applications like yahoo i need for www.everonn.com
Tell me some Adhoc testing scenarios of ebay (online auction product)?
What is a testbed in manual testing?
Write the test cases for godaddy home page
i want manual and automation test cases and interview questions
what are questions asked in TCS for database tester (sqlserver)?ay idea
How do u determine,what to be tested?
if yahoo ceo asks you to do performance testing for yahoo site, what are the inputs you ask from them?
can any body tell me what is the process of between after getting a documents and testcase writing.
Hi i am looking for Test Engineer Job, i have done the course, but i don't have work experience on it, Is it So important to have real time Exp or knowledge is enough? and please let me know like how i can improve for the interview. You can send me a mail on this id: rashmi_vastred@yahoo.co.in