Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 126 - 2617_JSSPS_C-7
P. 126

    Assess Yourself

                         Choose the correct option.

                         1.  Which of these is not a type of statement in the Java language?
                                   a. if statement                                b. if … else statement

                                   c. if … else… if statement                     d. if…elif…if statement

                         2.   Which of the following statements is used to execute either of the blocks of statements from if or else
                            statements?

                                   a. if…else                                     b. if

                                   c. switch                                      d. while

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

                                   a. if…else ladder                              b. if ladder

                                   c. do-while                                    d. None of these

                         4.   What is required for every method in a program?

                                   a. A return type                               b. A name

                                   c. A constructor                               d. A global variable

                         5.   Where is the return statement placed in a method?

                                   a. At the beginning                            b. At the middle

                                   c. Always the last line of the method          d. It can be placed anywhere

                         Fill in the blanks with the correct words.

                                           Hints  constructor, variable, brackets, decision-making, object

                         1.  Conditional statements are also known as                    statements.
                         2.  The body of a method is defined by the curly                  .

                         3.  An                      can be defined as a real-world entity such as a telephone, mouse or bag.

                         4.  The control                     defines the duration until which the loop will execute.
                         5.  A                      is a type of special member method with same name as of class.

                    Q    Answer the following questions:
                      A
                         1.  What is the use of the default keyword in the switch statement?

                            Premium Edition-VII
                    124

| 121 122 123 124 125 126 127 128 129 130 131 |