Page 497 - CA_Blue( J )_Class10
P. 497

if(Character.isLetter( ch))
                           {
                           if("AEIOUaeiou".indexOf(ch)>=0)
                              ns=ns+(char)(ch+1);
                           else
                              ns=ns+(char)(ch-1);
                           else
                              ns=ns+ch;
                           }
                           System.out.print(ns);
                       }
                   }
                   6.  Define a class to accept values into 4x4 array and find and display the sum of each row.   [15]
                      Example:
                      A[][]={ 1,2,3,4},{5,6,7,8},{1,3,5,7},{2,5,3,1}}
                      Output:
                      sum of row 1 =10 (1+2+3+4)
                      sum of row 2=26 (5+6+7+8)
                      sum of row 3=16 (1+3+5+7)
                      sum of row 4=11 (2+5+3+1)                                                [Understanding/Application]
                  Ans.  class sumrow
                      {
                      int x[][]=new int[4][4];
                      sumrow(int z[][])
                      {
                           x=z;
                      }
                      void calculate()
                      {
                           int r, c, s=0;
                           for(r=0;r<4;r++)
                      {
                           for(c=0;c<4 ;c++)
                           {
                              s=s+x[r][c];
                           }
                           System.out.println("sum of row="+r+"="+s);
                           s=0;
                           }
                         }
                      }
                   7.  Define a class to accept a number and check whether it is a SUPERSPY number or not. A number is called SUPERSPY if the sum
                      of the digits equals the number of the digits.                                              [15]
                      Example 1:
                      Input : 1021
                      output : SUPERSPY number [SUM OF THE DIGITS = 1+0+2+1 = 4, NUMBER OF DIGITS = 4 ]
                      Example 2:
                      Input : 125
                      Output : Not an SUPERSPY number [1+2+5 is not equal to 3]                [Understanding/Application]
                  Ans.  class superspy
                      {
                           int n;
                           superspy(int x)
                           {
                              n=x;
                           }
                           boolean superspy()
                           {


                                                                                                                       495
                                                                                   ICSE SPECIMEN QUESTION PAPER (2025)  495
   492   493   494   495   496   497   498