ICSE Class 10 Computer Applications Question 9 of 76

Revising Basic Java Concepts — Question 13

Back to all questions
13
Question

Question 10

What will be the resultant type of the following expression if bh represents a byte variable, i is an int variable, fl is a float variable and db is a double variable ?

bh - i + db / fl - i * fl + db / i
Answer

The resultant data type will be double.

Explanation

    bh - i + db / fl - i * fl + db / i
⇒ byte - int + double / float - int * float + double / int
⇒ byte - int + double - float + double
⇒ int + double - float + double
⇒ double - float + double
⇒ double + double
⇒ double