Page 139 - CA_Blue( J )_Class10
P. 139

You will get the following output:




















                                Let's Revisit


                       ®  Flow of control means the way in which sequence the program executes so that the correct output is generated.
                       ®  Conditional statements allow you to check a condition and execute certain block of code depending on whether the
                       condition is true or false.
                       ®  Ternary operator is a special operator with two symbols and containing three operands or expressions.
                       ®  The switch statement allows us to check various conditions and execute the related set of statements.
                       ®  The break statement is optional to use with every case in the switch statement.
                       ®  The System.exit() function is used to stop the program immediately whenever required.






                                                              MIND DRILL






                      Solved Questions


                 A.  Tick ( ) the correct answer.

                    1.  Which of the following represents the normal flow of control?
                       a.  Bottom-Up Approach                          b.  Top-Down Approach
                       c.  Side wise                                   d.  None of these

                    2.  Which of the following depends on the condition provided?
                       a.  Conditional Flow of Control                 b.  Multiple-branching statement
                       c.  Normal flow of control                      d.  None of these
                    3.  Which of the following is used to handle the conditional flow of control?
                       a.  Loop                                        b.  Function
                       c.  if Statement                                d.  Compound
                    4.  Which of the following statement is used to exit from the switch case?
                       a.  continue                                    b.  break
                       c.  System.exit(-1)                             d.  return
                    5.  Which of the following statement is used to stop a program immediately?
                       a.  continue                                    b.  break
                       c.  System.exit(0)                              d.  return


                                                                                                                       137
                                                                                           Conditional Constructs in Java  137
   134   135   136   137   138   139   140   141   142   143   144