Page 146 - CA_Blue( J )_Class10
P. 146

Unsolved Questions



              A.  Tick ( ) the correct answer.
                  1.  Which of the following is the correct syntax of Java if statement?
                    a.  if(condition)                               b.  if(condition);
                      //statement;                                      {
                                                                          //statement;
                                                                        }
                    c.  if(condition)                               d.  All of these
                       {
                          //statement1;
                       else
                          //statement2;
                       }
                  2.  What will be the output of the following Java program with the if statement?
                    if(true)
                               System.out.println("Yes");
                    else
                               System.out.println("No");
                    a.  No                                          b.  Yes
                    c.  Both a and b                                d.  None of these
                  3.  What will be the output of the following Java program?
                      double a=15.4;
                      if(a==15)
                               System.out.println("India ");
                      else
                               System.out.println("All");
                    a.  IndiaAll                                    b.  India All
                    c.  Syntax Error                                d.  All
                  4.  What will be the output of the following 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                                       d.  Nothing will print
                  5.  What is the output of the Java program below?
                    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
                  6.  If ………………… is not present in a switch case program, then fall-through occurs in Java.
                    a.  case                                        b.  default
                    c.  break                                       d.  continue






                144144  Touchpad Computer Applications-X
   141   142   143   144   145   146   147   148   149   150   151