C++ | Function Overloading

Q.11.
If the user did not supply the value, what value will it take?

a) default value
b) rise an error
c) both default value & rise an error
d) error

Q.12.
Where can the default parameter be placed by the user?

a) leftmost
b) rightmost
c) both leftmost & rightmost
d) topmost

Q.13.
Which value will it take when both user and default values are given?

a) user value
b) default value
c) custom value
d) defined value

Q.14.
What will be the output of the following C++ code?

#include <iostream>
using namespace std;
void func(int a, bool flag = true)
{
if (flag == true )
{
cout << “Flag is true. a = ” << a;
}
else
{
cout << “Flag is false. a = ” << a;
}
}
int main()
{
func(200, false);
return 0;
}

a) Flag is true. a = 200
b) Flag is false. a = 100
c) Flag is false. a = 200
d) Flag is true. a = 100

Q.15.
What will be the output of the following C++ code?

#include <iostream>
#include <string>
using namespace std;
string askanyNumber(string prompt = “Please enter a number: “);
int main()
{
string number = askanyNumber();
cout << “Here is your number: ” << number;
return 0;
}
string askanyNumber(string prompt)
{
string number;
cout << prompt;
cin >> number;
return number;
}

a) 5
b) 6
c) the number you entered
d) compile time error