ICSE Class 10 Computer Applications
Question 48 of 76
Revising Basic Java Concepts — Question 52
Back to all questions 52
Question Question 31
What are the values stored in variables r1 and r2 ?
- double r1 = Math.abs(Math.min(-2.83, -5.83));
- double r2 = Math.sqrt(Math.floor(16.3));
- r1 has 5.83
- r2 has 4.0
Explanation
- Math.min(-2.83, -5.83) returns -5.83 as -5.83 is less than -2.83. (Note that these are negative numbers). Math.abs(-5.83) returns 5.83.
- Math.floor(16.3) returns 16.0. Math.sqrt(16.0) gives square root of 16.0 which is 4.0.