Page 140 - CA_Blue( J )_Class10
P. 140

6.  To check whether a variable "a" is equal to 0, which of the following statements is correct?
                    a.  if(a = 0)                                   b.  if(a == 0)
                    c.  a = 0                                       d.  none of these

                  7.  If break is not used with switch case, then the program ………………….
                    a.  Causes a syntax error                       b.  Executes normally
                    c.  Causes fall-through situation               d.  Causes a logical error
                  8.  Which of the following is a conditional statement?
                    a.  case                                        b.  break
                    c.  System.out.println()                        d.  if…else
                  9.  Which of the following is the use of System.exit(0)?
                    a.  Terminate a program                         b.  Go to the next iteration
                    c.  Exit from switch block                      d.  None of these
                 10.  Which of the following data type cannot be used with switch statement?
                    a.  int                                         b.  float
                    c.  char                                        d.  string

                 11.  What will be the output of the following code snippet?
                    int x = 10;
                    if (x < 10)
                    {
                        System.out.println("Less than 10");
                    }
                    else
                    {
                        System.out.println("Greater than or equal to 10");
                    }
                    a.  Less than 10                                b.  Greater than or equal to 10
                    c.  No output                                   d.  Compilation error
                 12.  What will be the output of the following code snippet?
                    int day = 3;
                    switch (day) {
                        case 1:
                            System.out.println("Monday");
                            break;
                        case 2:
                            System.out.println("Tuesday");
                            break;
                        case 3:
                            System.out.println("Wednesday");
                            break;
                        default:
                            System.out.println("Invalid day");
                    }
                    a.  Monday                                      b.  Tuesday
                    c.  Wednesday                                   d.  Invalid day
                 13.  What is the value of result after the following code is executed?
                    int a = 5, b = 10;
                    int result = (a > b) ? a : b;
                    a.  5                                           b.  10
                    c.  true                                        d.  false


                138138  Touchpad Computer Applications-X
   135   136   137   138   139   140   141   142   143   144   145