Page 3 - KMK PREPSPM2 1819 ANSWER
P. 3

SULIT     No. Matrik…………………………………….… No. Kad Pengenalan…………………………..  SC015



               SECTION A [40 marks]
               BAHAGIAN A [40 markah]
               This section consists of 4 questions. Answer all questions.
               Bahagian ini mengandungi 4 soalan. Jawab semua soalan.
               1       (a)    Describe algorithm.
                                                                                                 [1 mark]
                               An algorithm is a sequence of well-defined steps to solve a problem.


                       (b)    Solve the following problem using pseudocode.

                                     “A data operator takes an average of 3 minutes to key in the details of
                                     a customer into an information system. Determine the number of
                                     customers he can process (i.e. key in data) in his daily working hours.”
                                                                                                [3 marks]
                               Start
                                      read hour
                                      noCustomer = hour x 60 / 3
                                      print noCustomer
                               End

               2       (a)    Object oriented programming (OOP) is a programming technique that uses
                              “objects” to design the applications and computer programs.
                               (i)   Explain two (2) characteristics of object-oriented programming.
                                                                                                [4 marks]
                                      Abstraction is a process of hiding the implementation details and
                                      showing only functionality to the user.
                                      Encapsulation in Java is a process of wrapping code and data
                                      together into a single unit.


                              (ii)   Output statement is used to display output on the console.
                                     Write an output statement that will display the message “Mark is: ”
                                     followed by value 97.5 stored in variable mark.
                                                                                                 [1 mark]
                                      System.out.print("Mark is: "+mark);


                              (iii)   Input statement is used to accept data entered by user into the
                                     computer.
                                     Write input statements that will accept values “Feb” and 19 and store
                                     them in variables month and day respectively.
                                                                                                [2 marks]
                                      String month = sc.next();
                                      int day = sc.nextInt();





                                                            3                                SULIT
   1   2   3   4   5   6   7   8