Page 129 - 2617_JSSPS_C-7
P. 129

PERIODIC ASSESSMENT 4                                            (Based on chapter 5)








                 A.  Find the error in the following Java code:

                    public static void main(String args[])

                   {
                   int i;

                   for (i = 1; i <= 5; i++) {

                   System.out.println("The value of i is: " i);

                   }
                   }

                 B.  Define the following terms:


                    1.   if Statement:




                    2.  for Loop:



                    3.  While Loop:




                    4.  break Statement:




                 C.  Write a program that determines whether a given integer is even or odd.




























                                                                                           Periodic Assessment 4   127
   124   125   126   127   128   129   130   131   132   133   134