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

switch(c)

                  {
                  case 1: System.out.print("one");

                  case 2: System.out.print("two");
                  case 3: System.out.println("Wrong choice");
                  }

              (iv)  Give the output  of the following function  where a and  b are  arguments greater  than  0. Show the dry run/
                  working.                                                                                          [2]

                  int first(int a, int b)

                  {
                  int ans,sm,la;

                  if(a<b)
                  {  sm=a;la=b;            }

                  else
                  {  sm=b;la=a;            }

                  ans=la;
                  while(ans%sum!=0)

                  ans+=la;
                  return ans;

                  }
              (v)  What will be the output?                                                                         [2]

                  int a[] = {21,32,65,35};
                  int s=0,i;

                  for(i=0;i<=1;i++)
                  {

                    s=a[i]+a[3-i];
                    System.out.println(s);
                  }
              (vi)  Debug the following method snippet.                                                             [2]

                  public void circle(int a, 3.14)
                  {  int ar=3.14 * r * r;
                    System.out.println(ar); }

                  }
              (vii) Define Pure Method.                                                                             [1]







                522522  Touchpad Computer Science-XI
   519   520   521   522   523   524   525   526   527   528   529