Page 92 - Trackpad_ipro 4.1_Class8
P. 92

3.  Which of these statements is used as a substitute for the 'switch' statement?

                         a. if...else...if ladder                        b. if...else ladder

                         c. if ladder                                    d. do-while

                      4.  Which of the following keywords is/are used with the switch statement?
                         a. break                                        b. default

                         c. Both a and b                                 d. None of these

                      5.  Which of the following statements repeatedly executes a set of statements for a given
                         number of times?

                         a. break                                        b. for

                         c. continue                                     d. if…else…if
                      6.  Which of the following is an example of a runtime error?

                         a. Missing semicolon at the end of the line
                         b. Adding an extra bracket at the end of the class or function

                         c. Dividing a number by zero

                         d. Using (*) sign in place of (+) sign

                  B.  Write ‘T’ for true and ‘F’ for false.
                      1.  The while statement is a conditional statement in Java.                          ......................

                      2.  The do-while loop is similar to the for loop.                                    ......................
                      3.  The variable that controls the execution of a loop is known as a
                         control variable.                                                                 ......................

                      4.  The break statement forcefully terminates the loop within which it lies.         ......................
                      5.  The default must be the first case in the switch statement.                      ......................

                  C.  Fill in the blanks using the words given below:

                                               Hints

                                                   Break, Do-while, Case, While, Conditional


                      1.  The ................ loop executes the statements at least once, whether the given condition
                         returns true or false.

                      2.  The ........................ loop checks the condition first before executing the statements written
                         inside its body.
                      3.  The ........................ keyword is used to define the case in the switch statement.

                      4.  The ........................ keyword is used to stop the execution of the switch statement when a
                         matched case is found.

                      5.  A ........................ statement allows us to change the default flow of a program.


                    90     iPro (Ver. 4.1)-VIII
   87   88   89   90   91   92   93   94   95   96   97