Page 69 - IP
P. 69

Informatics Practices
                                                         Class XII

                                              MODEL TEST PAPER -III
          MM-70                                                                           Time - 3 Hrs.
          ===================================================================
          Note: (i) Programming Language – Java & MySql
          (ii) Write answers of all the sub-questions of each question together.
                  (i)    Select Avg (Commission) for Sales; (ii)   Select Count(Sales) from Sales;

                  Q4. a. What is the difference between inheritance and polymorphism                          1

                       (b)Rewrite the following if-else segment using switch-case statement.                   2
                         char ch = ‘P’;
                         if((ch == ‘p’) || (ch == ‘P’)) System.out.println("Platinum");
                         if((ch == ‘g’) || (ch == ‘G’)) System.out.println("Gold");
                         if(ch == ‘S’) System.out.println("Silver");
                        else System.out.println("Normal");



            (c)What is the purpose of the following statement:
                    jTextField1.setText(“Informatics Practices”.toUpperCase( ));                               1


            (d)  What will be the contents of sum after executing the following code:                          1
            int i = 2, j = 5,sum =0;
                          while (i < j)
                          {
                                sum+ =i;
                                i++;
                         }

           (e) What will be the contents of jTextField1 and jTextField2 after executing the following code:    2
                         String str =”Mahatma”; jTextField1.setText(str.substring(4)); jTextField2.setText( “”
                         +str.length( ));

           (f)    The following code has some error(s).Rewrite the correct code underlining all corrections made. 2
                         int i = 2, j = 5;
                         while j >i
                         {
                                jTextField1.getText(“j is greater”); j --; ++I;}
                                joptionpan.showMessageDialog(“Hello”);
   64   65   66   67   68   69   70   71   72   73   74