Question: 9. Consider the following functions: int find(int num1, int num2) { int first, second; first = num1 * num2; second = first - num1 +

9. Consider the following functions:

int find(int num1, int num2) { int first, second; first = num1 * num2; second = first - num1 + num2; 
 if (second > 50) num1 = first / 10; else num2 = second / 20; return num1 + num2; } int discover(int one, int two) { int secret = 1; for (int i = one; i < two; i++) secret = secret * i; return secret; } 

What is the output of each of the following program segments?

a. cout << find(15, 25) << endl; 
b. cout << discover(3, 9) << endl; 
c. cout< 
d. x = 20; y = 10; 
 cout << discover(x, y) << endl; 
 

10. What is the output of the following code fragment?

int alpha = 5; int beta = 10;

if (beta >= alpha) { int alpha; int temp;

alpha = 20; temp = beta - alpha; beta = beta * temp; cout << alpha << ' ' << beta << endl; } cout << alpha << ' ' << beta << endl;

11. Consider the following function prototype:

void funcDefaultParam(double x = 7.3, int y = 4, string z = "*");

Which of the following function calls is correct?

funcDefaultParam();

funcDefaultParam(2.8);

funcDefaultParam(3.2, 0, "h");

funcDefaultParam(9.2, "*");

funcDefaultParam(7, 3);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!