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 is else syntax in c++?

639


Does c++ have arraylist?

539


What is the difference between a baller and a reference in C++?

576


How do you save a c++ program?

557


Is c++ high level programming language?

673






How do we balance an AVL Tree in C++?

632


What is an operator function? Describe the function of an operator function?

612


What is flush programming?

571


What is the full form of c++?

615


What is using namespace std in c++?

604


What is a tuple c++?

542


Explain the problem with overriding functions

604


What is the difference between structure and class?

554


What are the advantages of using a pointer? Define the operators that can be used with a pointer.

600


What is atoi?

540