Question
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int a = 5;
6.
float b;
7.
cout
What is the output of the following program?
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int a = 5;
6.
float b;
7.
cout
Answer: Option D
Was this answer helpful ?
The a as a integer will be converted to float while calculating the size. The value of any variable doesn’t modify inside sizeof operator. Hence value of variable a will remain 5.
Output:
$ g++ size3.cpp
$ a.out
4 5
Was this answer helpful ?
More Questions on This Topic :
Question 4.
Identify the incorrect option.
....
Submit Solution