1,405 views

1 Answer

Best answer
1 1 vote

For this we need to know the rules of type conversion during arithmetic operation..Quoted from Kerninghan And Ritchie textbook :

· If either operand is long double, convert the other to long double.
· Otherwise, if either operand is double, convert the other to double.
· Otherwise, if either operand is float, convert the other to float.
· Otherwise, convert char and short to int.
· Then, if either operand is long, convert the other to long.

 So here before applying sizeof() operator we should know the type of the addition result of c and i which is addition of type char and short int..According to rule 4 as mentioned above both of these data types will be converted to int data type prior to addition..Thus the result will have int data type and given size of int is 4 bytes..

Hence , sizeof(c+i) will give us 4 as result..

Hence C) should be the correct answer.. 

• selected by
Position:
Show:

Related questions

0 0 votes
1 1 answer
726
726 views
gatecse asked Dec 9, 2020
726 views
Match the following:$$\begin{array}{|l|l|l|l|} \hline (1) \text{Waterfall model} & (a) \text{Specifications can be developed} \\& \text{incrementally} \\\hline (2) \tex...
8 8 votes
1 answers 1 answer
7.4k
7.4k views
sh!va asked May 7, 2017
7,423 views
Estimation at software development effort for organic software in basic COCOMO is:E = 2.0 (KLOC) 1.05 PME = 3.4 (KLOC) 1.06 PME = 2.4 (KLOC) 1.05 PME = 2.4 (KLOC) 1.07...
0 0 votes
0 0 answers
519
519 views
sh!va asked Sep 30, 2017
519 views
In C++, size of float and double data types are 4 bytes and 8 bytes respectively. Calculate range ( minimum and maximum values) of float and double: