Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
double & WeeklyHours()
4.
{
5.
double h = 46.50;
6.
double &hours = h;
7.
return hours;
8.
}
9.
int main()
10.
{
11.
double hours = WeeklyHours();
12.
cout
Options:
A .  46.5
B .  6.50
C .  compile time error
D .  none of the mentioned
Answer: Option A

We are returning the value what we get as input.
Output:
$ g++ ret1.cpp
$ a.out
46.5



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers