← Quiz: References and Functions: all 10 questions
Quiz: References and Functions · Question 4 of 10
What does this print? (code)
What does this print?
#include <iostream>
using namespace std;
int add(int a, int b = 10, int c = 100) { return a + b + c; }
int main() {
cout << add(1, 2);
return 0;
}
- A.3
- B.103
- C.111
- D.13
Answer & explanation
Correct answer: 103
b = 2 is given, c uses its default 100: 1 + 2 + 100 = 103.
Can you get the rest right without peeking?
Take the timed Quiz: References and Functions quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →