Page 432 - Computer science 868 Class 12
P. 432

ob. change(0, va, nva);
                        System.out.println(.Modified array");
                        ob. display();
                        }
                    }


                   Unsolved Questions



              A.  Tick ( ) the correct option:

                  1.  In recursion, the condition where the function calls itself is known as
                    a.  Base case                                   b.  Worst case
                    c.  Average case                                d.  Recursive case
                  2.  Recursive technique is not used in
                     a.  tree traversal                             b.  Loop
                    c.  back tracking alogorithm                    d.  if-else if-else
                  3.  Which of the following statements is true?
                    a.  Recursion uses LIFO concept.
                    b.  Recursion uses the concept of queue.
                    c.  Recursion uses less memory compared to iteration.
                    d.  Recursion is faster than iteration.
                  4.  Which of the following recursive formula can be used to find the sum of all odd numbers upto a given number?
                    a.  sum (n) = n + sum (n % 2)                   b.  sum (n) = n + sum (n/2)
                    c.  sum (n) = n + sum (n + 2)                   d.  sum (n) = n + sum (n*2)
                  5.  Which of the following recursive formula can be used to find the factorial of a given number?
                    a.  fact (n) = n + fact (n + 1)                 b.  fact (n) = n + fact (n/2)
                    c.  fact (n) = n * fact (n - 1)                 d.  fact (n) = n + fact (n –1)

              B.  Fill in the blanks:
                  1.  Fill in the blanks to print the factors of any number ‘n’ using recursive method void factor(int n)
                      void factors(int n,int i)
                      {
                     if (a.…………………)
                          System.out.println();
                     else if(b.…………………)
                     {
                         System.out.println(c.…………………);
                         d.…………………
                      }
                     else
                     e.…………………
                      }
                  2.  Fill in the blanks to return the lcm of two numbers a and b using recursive method int lcm(int a, int b, int lc) where a = 24 b = 36
                    and lc = 1 will store lcm
                      void lcm(int a,int b,int lc)
                      {
                     if (a.…………………)
                          b.…………………
                      else
                     {
                          c.…………………
                      }}



                430430  Touchpad Computer Science-XII
   427   428   429   430   431   432   433   434   435   436   437