Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Given a simple program designed to take inputs of integers
from 1-1000 and to output the factorial value of that
number, how would you test this program? You do not have
access to the code. Please be as specific as possible.

Answer Posted / min soo kim

If the function that takes integers from 1 to 1000 can be
considered function f(n), then we could write the following
line of code

int i = 0;
int is_incorrect = 0;
for(i = 2; i <= 1000; i++)
{
// This is a simple for loop to divide a f(n) factorial
with f(n-1) factorial, which would give the result of n.
if(f(i) / f(i-1)) !- i)
{
is_incorrect = 1; // Mark the flag as incorrect, since
we did not get the value that we want.
break;
}
}

Is This Answer Correct ?    17 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are stacks? Give an example where they are useful.

1064


Is there structure in c++?

1033


What is a catch statement?

1059


How a new element can be added or pushed in a stack?

1022


Distinguish between a # include and #define.

1159


What is the purpose of the "delete" operator?

1069


Explain the concept of memory leak?

1115


What are the advantages of prototyping?

1065


Why we use #include conio h in c++?

1056


Why do we need constructors in c++?

1117


What do you mean by inheritance in c++? Explain its types.

1152


Is the declaration of a class its interface or its implementation?

1178


What is abstraction in c++?

1363


What is function overriding in c++?

1074


Describe about storage allocation and scope of global, extern, static, local and register variables?

1260