Page 111 - CA_Blue( J )_Class10
P. 111

Answers
                     1.  User Defined    2.   Math.sqrt()      3.  absolute       4.  nearest          5.  mn
                     6.   5              7.  double            8.  -53.0          9.  6.0             10.  4.0


                 C.  Answer the following questions:
                    1.  Write the output of the following statements:
                       a.  System.out.println(Math.ceil(Math.pow(0.2,3)));
                       b.  System.out.println(Math.max(Math.min (4.5,3.4),2.3));
                   Ans.  a.  1.0                                       b.  3.4
                    2.  If double a=2.3, b=4.5, then what will be the output of the following statements?
                       a.  System.out.println(Math.pow(Math.ceil(a), 2));
                       b.  System.out.println(Math.round(b) + Math.min(a,b));
                   Ans.  a.  9.0                                       b.  7.3
                    3.  What will the System.out.println(Math.abs(-3.4)); statement return?
                   Ans.  3.4
                    4.  Write the output of the following program.
                         class output
                       {
                         public static void main()
                         {
                            int a=5;
                            double b=5.6, c;
                            System.out.println(a*Math.pow(a,2));
                            System.out.println(Math.ceil(b));
                            c=Math.min(a,b);
                            System.out.println(c);
                       }
                       }
                   Ans.  125.0
                        6.0
                        5.0
                    5.  What will be the output of the following statements?
                       a.  System.out.println(Math.rint(5.7));         b.  System.out.println(Math.rint(-5.5));
                       c.  System.out.println(Math.rint(5.5));         d.  System.out.println(Math.rint(-2.8));
                   Ans.  a.  6.0                                       b.  -6.0
                        c.  6.0                                        d.  -3.0
                    6.  Write the output of the following statements.
                       a.  System.out.println(Math.cbrt(15625));       b.  System.out.println(Math.sqrt(81));
                   Ans.  a.  25.0                                      b.  9.0
                    7.  Write the final value that is stored in c and d.
                         double a= -10.2, b=-44.1,c,d;
                       c= Math.abs(Math.floor(a));
                       d=Math.ceil(Math.abs(b));
                   Ans.  c = 11.0                                       d = 45.0
                    8.  Convert the following mathematical expressions into Java expressions.
                           2
                       a.  a + c 2                                     b.  a 1⁄n
                                   2
                             -b +    b  - 4ac
                       c.  x =                                         d.  sin a  cos b + cos a  sin b where a and b are in radian
                                 2a

                                                                                                                       109
                                                                                          Mathematical Library Methods   109
   106   107   108   109   110   111   112   113   114   115   116