English

Given: double k = Math.rint(−9.4) + Math.sqrt(9.0); - Computer Applications

Advertisements
Advertisements

Question

Given: double k = Math.rint(−9.4) + Math.sqrt(9.0); 

Options

  • −5.0

  • −6.0

  • −6.4

  • −5.4

MCQ

Solution

−6.0

Explanation:

Math.rint(−9.4) will return −9.0, which is the nearest integer to −9.4. Math.sqrt(9.0) yields 3.0. Therefore, the expression is solved as follows: 

k = Math.rint(−9.4) + Math.sqrt(9.0);

k = −9.0 + 3.0

k = −6.0

shaalaa.com
  Is there an error in this question or solution?
Chapter 1.07: Mathematical Library Methods - EXERCISES [Page 80]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 1.07 Mathematical Library Methods
EXERCISES | Q I. 4. | Page 80
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×