Page 230 - computer science (868) class 11
P. 230

c.      n : …………………
                     d.      c : …………………
                  7.  The ………………… operator, which is used to create an object or an array, allocates space in memory for storing data members of
                    the object or array elements.
                  8.  Any change made to a ………………… through an object will affect the common data member of all objects.
                  9.  When the method is called, the compiler finds the best-matched function at runtime depending on the arguments. This is known
                    as ………………… .
                 10.  ………………… are also known as mutators, and cause a change in the state of the object.
              C.  Answer the following questions:

                  1.  What is the difference between Method Header and Method Signature?
                  2.  What are the advantages of using a method?
                  3.  Write the general syntax of declaring a method.
                  4.  What is the difference between Return Type and Return Statement?
                  5.  Consider the following program:
                    boolean check_armstrong(int n)
                    {
                         int temp, digits=0, rem=0, sum=0;
                         temp=n;
                        while(temp>0)
                        {
                             temp = temp/10;
                            digits++;
                         }
                        temp = n;
                        while(temp>0)
                        {
                             rem = temp % 10;
                            sum +=  (Math.pow(rem, digits));
                            temp = temp/10;
                         }
                        if(n==sum)
                             return true;
                         else
                             return false;
                     }
                        a.  Method Header : …………………
                        b.  Access Specifiers : …………………
                        c.  Return Type and Return Statement : …………………
                        d.  Method name : …………………
                        e.  Parameter : …………………
                  6.    Write any two characteristics of Return Statement.
                  7.    What type of method is the following:

                     int add(int m1)
                     {
                         m1=(m1+5)*5;
                        return m1;
                    }
                                                                                    #Coding & Computational Thinking
              D.  Unsolved Programs:                                                #Experiential Learning
                  1.  Define a class guard having the following specifications:
                    Data Members
                     String gn         :   Name of the guard


                228228  Touchpad Computer Science-XI
   225   226   227   228   229   230   231   232   233   234   235