Page 115 - CA_Blue( J )_Class10
P. 115

2.  What is the final value stored in variable x?                                               [2022]
                        double  x=Math.ceil(Math.abs(-7.3));
                       a.  7.0                                         b.  8.0
                       c.  6.0                                         d.  9.0
                   Ans.  b
                    3.  Write a Java expression for the following:
                        2
                        |x  + 2xy|                                                                                  [2019]
                   Ans.  Math.abs(x * x + 2 * x * y)
                    4.  Give the output of the following:
                        Math.sqrt(Math.max(9, 16))                                                                  [2019]
                   Ans.  4.0
                    5.  Evaluate the following expression if the value of x = 2, y = 3 and z = 1.
                        v = x + --z + y++ + y;                                                                      [2019]
                   Ans.  v = x + --z + y++ + y;
                         = 2 + 0 + 3 + 4
                         = 9
                    6.  Write a Java expression for the following:
                            2
                        (3x + x )
                                                                                                                    [2018]
                         (a + b)
                   Ans.  Math.sqrt((3 * x + x * x) / (a + b))
                    7.  What is the value of y after evaluating the expression given below?
                          y += ++y + y-- + --y; when int y = 8.                                                     [2018]
                   Ans.  y  =  ++y + y-- + --y
                        y  =  y + (++y + y-- + --y)
                          =  8 + 9 + 9 + 7
                          =  17 + 9 + 7
                          =  26 + 7
                          =  33
                    8.  Give the output of the following:
                       (i)  Math.floor(-4.7)                           (ii)  Math.ceil(3.4) + Math.pow(2, 3)        [2018]
                   Ans.  (i)  -5.0                                     (ii)  4.0 + 8.0 = 12.0
                    9.  Write a Java expression for the following:
                             3
                        5
                        ax  + bx  + c                                                                               [2017]
                   Ans.  a * Math.pow(x, 5) + b * Math.pow(x, 3) + c
                    10.  What are the values stored in variables r1 and r2?
                        (a)  double r1 = Math.abs(Math.min(-2.83, -5.83));   (b)  double r2 = Math.sqrt(Math.floor(16.3));   [2017
                   Ans.  (a)  5.83                                     (b)  4.0
                    11.  Give the output of the following Math methods:
                        (a)  Math.ceil(4.2)                            (b)  Math.abs(-4)                            [2016]
                   Ans.  (a)  5.0                                      (b)  4
                                                             2
                                                      2
                                                         2
                    12.  Write down Java expression for: T = √(A  + B  + C )
                   Ans.  T = Math.sqrt(Math.pow(A, 2) + Math.pow(B, 2) + Math.pow(C, 2));
                    13.  Name the mathematical method which is used to find the sine of an angle given in radians.   [2015]
                   Ans.  Math.sin()
                                              2
                                                  2
                    14.  Write a Java expression for: (a  + b ) ÷ 2ab                                               [2015]
                   Ans.  (Math.pow(a,2) +Math.pow(b,2))/(2*a*b)
                    15.  What is the data type that the following library method returns?
                        Math.random()                                                                               [2013]
                   Ans.  double

                                                                                                                       113
                                                                                          Mathematical Library Methods   113
   110   111   112   113   114   115   116   117   118   119   120