🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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;
}
  1. A.3
  2. B.103
  3. C.111
  4. 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 →