Sail E0 Webinar
Question


What is the output of the following program?


1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int num1 = 10;
6.
float num2 = 20;
7.
cout
Options:
A .  2
B .  4
C .  8
D .  garbage
Answer: Option B

In this program, integer is converted into float. Therefore the result of num1 and num2 is float. And it 

is returning the size of the float.
Output:
$ g++ size2.cpp
$ a.out
4



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers