ICSE Class 10 Computer Applications Question 11 of 76

Revising Basic Java Concepts — Question 15

Back to all questions
15
Question

Question 12

Determine the data type of the expression

(100(1−pq)(q+r))−((p+r)/s(long)(s+p))\Big(\dfrac{100(1 - pq)}{(q + r)}\Big) - \Big(\dfrac{(p + r) / s}{(\text{long})(s + p)}\Big)

If p is an int, r is a float, q is a long and s is double.

Answer

The result of the given expression will be double type.

Explanation

(int∗(int−int∗long)(long + float))−((int+float)/double(long)(double+int))⇒(int∗(int−long)float)−(float/doublelong)⇒(int∗intfloat)−(doublelong)⇒float−double⇒double\Big(\dfrac{\text{int} * (\text{int} - \text{int} * \text{long})}{\text{(\text{long} + \text{float})}}\Big) - \Big(\dfrac{(\text{int} + \text{float}) / \text{double}}{(\text{long})(\text{double} + \text{int})}\Big) \\[1em] \Rightarrow \Big(\dfrac{\text{int} * (\text{int} - \text{long})}{\text{float}}\Big) - \Big(\dfrac{\text{float} / \text{double}}{\text{long}}\Big) \\[1em] \Rightarrow \Big(\dfrac{\text{int} * \text{int}}{\text{float}}\Big) - \Big(\dfrac{\text{double}}{\text{long}}\Big) \\[1em] \Rightarrow \text{float} - \text{double} \\[1em] \Rightarrow \text{double}

Get the Bright Tutorials app Stuck on a question? Ask Bright Buddy — your AI tutor — for step-by-step help in the app.