MCQs
Character is 1 byte, integer 4 bytes and float 4 bytes.
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
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
The size of the double data type is 8.
$ g++ size1.cpp
$ a.out
8
The sum of three numbers are belongs to different number systems, so the result is typecasted into integer.
Output:
$ g++ size.cpp
$ a.out
4
sizeof(char) <= sizeof(wchar_t) <= sizeof(long)
None.
The limit header holds the details of the machine dependent details.
None.
The sizeof operator gives the size of the object or type.