logo

Crowdly

Consider the following code fragment: namespace a { namespace b { int f(...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Consider the following code fragment:

namespace a {

namespace b {

int f(int x, int y=1) { return x + y; }

}

int f(int x) { return x > 1 ? x + 1 : a::b::f(x - 1); }

}

int g(int x) {

return x % 3 == 0 ? a::b::f(x, 3) : a::f(x);

}

What is the value returned by g(x) for when x equals 1, 2, and 3 respectively?

100%
0%
0%
0%
0%
More questions like this

Want instant access to all verified answers on moodle2425.up.pt?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!