Page 211 - Cs_withBlue_J_C11_Flipbook
P. 211

4.  What will be the output of the following code?
                       if(10>3)
                       System.out.print("Greater");
                       else
                       System.out.print("Smaller");
                       a.  Smaller                                     b.  Greater
                       c.  It will show an error.                      d.  It will not print anything.
                    5.  What will be the output of Math.pow(3,3)?
                       a.  3                                           b.  27.0
                       c.  27                                          d.  9.0
                    6.  Which of the following functions finds the logarithm of a value provided in the argument?
                       a.  Math.sin()                                  b.  Math.tan()
                       c.  Math.logarithm()                            d.  Math.log()
                    7.  double d=Math.sqrt(8.1); d will contain ………………… .
                       a.  9                                           b.  9.0
                       c.  0.9                                         d.  81.0
                    8.  Which of the following functions returns the value in the argument to its nearest integer?
                       a.  Math.round()                                b.  Math.abs()
                       c.  Math.pow()                                  d.  None of these
                    9.  Math functions of Java are in ………………… package.
                       a.  util                                        b.  applet
                       c.  lang                                        d.  None of these
                    10.  Which of the following is/are jump statements?
                       a.  continue                                    b.  break
                       c.  return                                      d.  All of these
                    11.  Which of the following is called entry-controlled loop?
                       a.  for                                         b.  do-while
                       c.  continue                                    d.  break
                   12.  ………………… is fixed iteration loop.
                       a.  while                                       b.  do-while
                       c.  for                                         d.  None of these
                    13.  How many times the inner loop will execute?
                       for(i=1;i<=3;i=i+2)
                         for(j=1;j<=i;j++)
                             Statement;
                       a.  1 time                                      b.  2 times
                       c.  3 times                                     d.  4 times
                    14.  What will be the output?
                       for(i=1;i<=10;)
                       {
                         i++;
                         ++i;
                       }
                       System.out.println(i);
                       a.  10                                          b.  11
                       c.  9                                           d.  None of these

                 B.  Fill in the blanks:
                    1.  If ………………… is not present in switch case, then the situation is known as fall through.

                    2.  If the statements of a programming language executes from first to last, then it follows ………………… approach.
                    3.  int a=10, b=4, c=0;

                       if(c==0)

                                                                                                                       209
                                                                                                 Statements and Scope  209
   206   207   208   209   210   211   212   213   214   215   216