Cyber Monday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

C++ Institute Exam CPA Topic 7 Question 95 Discussion

Actual exam question for C++ Institute's CPA exam
Question #: 95
Topic #: 7
[All CPA Questions]

What happens when you attempt to compile and run the following code?

#include

using namespace std;

int min(int a, int b);

int main()

{

int b=10;

b = min(5,20);

cout << b;

return 0;

}

int min(int a, int b)

{

if (a

return(a);

else

return(b);

}

Show Suggested Answer Hide Answer
Suggested Answer: C

Contribute your Thoughts:

Taryn
3 months ago
I think the correct answer is C) It prints: 5 because the function min will return the smaller number
upvoted 0 times
...
Krissy
3 months ago
Hmm, this is a tricky one. I'm going to have to think it through step-by-step. Let me see... *scratches head* Ah, I got it! It's C!
upvoted 0 times
Lovetta
2 months ago
Yeah, I agree with Lovetta. It should be 5.
upvoted 0 times
...
Naomi
2 months ago
I'm pretty sure it prints 5 as well.
upvoted 0 times
...
Josphine
2 months ago
No, I believe it prints 10.
upvoted 0 times
...
Kris
2 months ago
I think it prints 5.
upvoted 0 times
...
...
Denae
3 months ago
I'm not sure, but I think it might be A) It prints: 10
upvoted 0 times
...
Elza
3 months ago
Ha! This is a trick question. The code is printing the value of 'b', which is initially set to 10. So the answer must be A.
upvoted 0 times
...
Theresia
3 months ago
Wait, I'm a little confused. Isn't the 'min' function supposed to return the smaller of the two numbers? If that's the case, then the output should be 5. C it is!
upvoted 0 times
Catherin
2 months ago
So, the output should be 5.
upvoted 0 times
...
Margo
2 months ago
Yes, you're correct. The 'min' function returns the smaller of the two numbers.
upvoted 0 times
...
...
Ling
3 months ago
Okay, let me think about this. The 'min' function is comparing 5 and 20, so it should return 5. That means the output should be 5. I'm going with C.
upvoted 0 times
King
3 months ago
I agree, the output should be 5
upvoted 0 times
...
Marvel
3 months ago
I think it prints: 5
upvoted 0 times
...
...
Dominque
3 months ago
Hmm, this seems straightforward. The function 'min' should return the smaller of the two numbers, so I'm going with option C.
upvoted 0 times
Naomi
2 months ago
Yes, option C is the correct answer
upvoted 0 times
...
Kelvin
3 months ago
I agree, it should return the smaller number
upvoted 0 times
...
Eveline
3 months ago
I think it prints: 5
upvoted 0 times
...
...
Tesha
4 months ago
I agree with Margret, the function min will return the minimum of the two numbers
upvoted 0 times
...
Margret
4 months ago
I think the answer is C) It prints: 5
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77