Page 93 - Trackpad_ipro 4.1_Class8
P. 93

Let's Do            It                                                    Section B (Subjective)



                 A.  Short answer type questions.

                     1.  What is a looping statement in Java?
                        ...................................................................................................................................................................................

                     2.  What is the use of the if statement in Java?

                        ...................................................................................................................................................................................
                     3.  What is the use of the default keyword in the switch statement?

                        ...................................................................................................................................................................................

                     4.  What is a syntax error?
                        ...................................................................................................................................................................................

                 B.  Long answer type questions.

                     1.  What is the for loop in Java? Write its syntax.

                        ...................................................................................................................................................................................

                        ...................................................................................................................................................................................
                     2.  What is the difference between break and continue statements?

                        ...................................................................................................................................................................................

                        ...................................................................................................................................................................................
                     3.  What are jump statements? Write the names of two jump statements.

                        ...................................................................................................................................................................................

                        ...................................................................................................................................................................................

                     4.  What is the difference between a syntax error and a logical error?

                        ...................................................................................................................................................................................
                        ...................................................................................................................................................................................


                 C.  What will be the output of the following Java codes?
                     1.  public static void main(String args[])                          Write output here:

                      {
                            int num=1, square = 0;
                            while(num <= 10)
                            {
                                square = num * num;
                                System.out.println("Square of "+num+" is: "+square);



                                                             Conditional, Looping and Jumping Statements in Java  91
   88   89   90   91   92   93   94   95   96   97   98