What will be the output of the following C++ code? #include <iostream> ...
View Question
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
string askNumber(string prompt = “Please enter a number: “);
int main()
{
string number = askNumber();
cout << “Here is your number: ” << number;
return 0;
}
string askNumber(string prompt)
{
string number;
cout << prompt;
cin >> number;
return number;
}
What will be the output of the following C++ code? #include <iostream> ...
View Question
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;
}
What will be the output of the following C++ code? #include <iostream> ...
View QuestionWhich value will it take when both user and default values are given?
a) user value b) default value c) custom value d) defined value Answer: a Explanation: The default value ...
View QuestionWhere can the default parameter be placed by the user?
a) leftmost b) rightmost c) both leftmost & rightmost d) topmost Answer: b Explanation: To avoid the ambiguity between ...
View QuestionIf 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 Answer: a
View QuestionWhat are the advantages of passing arguments by reference?
a) Changes to parameter values within the function also affect the original arguments b) There is ...
View QuestionWhat should be passed in parameters when function does not require any parameters?
a) void b) blank space c) both void & blank space d) tab space Answer: ...
View QuestionWhat will happen while using pass by reference?
a) The values of those variables are passed to the function so that it can manipulate ...
View QuestionOverloaded functions are ________________
a) Very long functions that can hardly run b) One function containing another one or more ...
View Question