Page 192 - CA_Blue( J )_Class9
P. 192

c.  if(condition)
                           {
                            //statement1;
                           else
                           //statement2;
                           }
                         d.  All
                     4.  What is the output of Java program with if statement?
                         if(true)
                           System.out.println("Yes");
                         else
                         System.out.println("No");
                         a.  No                                         b.  Yes
                         c.  Both                                       d.  None of these
                     5.  What is the output of the Java program?
                         double a=15.4;
                         if(a==15)
                           System.out.println("India ");
                           System.out.println("New Delhi");
                         else
                           System.out.println("All");
                         a.  India New Delhi                            b.  IndiaNew Delhi
                         c.  Error - else without if                    d.  All of these
                     6.  Find the output of Java program:
                         float marks = 89.5f;
                             if(marks > 89.5)
                         System.out.println("Grade A");
                         else
                         System.out.println("Grade B");
                         a.  Grade A                                    b.  Grade B
                         c.  Error - else without if                    d.  All of these
                     7.  In Java, what statement is alternative to Switch Case?
                         a.  break                                      b.  for
                         c.  if-else                                    d.  continue
                     8.  What is the output of the following Java program?

                         int a=2;
                         switch(a)
                         {
                         case 1: System.out.print("Tiger");
                         case 2: System.out.print("Deer");
                         default: System.out.println("Lion");
                         }
                         a.  Tiger                                      b.  Lion
                         c.  DeerLion                                   d.  No output
                  B.  Fill in the blanks.

                      1.   Java Ternary Operators are also called ………………….
                      2.   One example of ………………… statement is switch case statement.
                      3.   In if else if, default statement of switch case will be written in the ………………… else statement.
                      4.   The output of if else is ………………… datatype.





                   190    Touchpad Computer Applications-IX
   187   188   189   190   191   192   193   194   195   196   197