Page 160 - Computer
P. 160

Computer Science  4.  Draw a flowchart to calculate the   (i)  It can be easily modified, unlike
              can be used in all types of problems
                                                         flowcharts.
              that needs a solution?
                                                    (ii)  It can be read and understood easily.
              area of a circle.
                                                    (iii) It is easier to convert the pseudocode
        FOR ONLINE READING ONLY
                                                         flowcharts.
                 Representation of algorithms            to a programming language than
                 using pseudocode                   (iv)  It is helpful in structured design.
                                                    (v)  It can be easily written using any
          Pseudocode is the textural representation      word processor or text editor.
          of an  algorithm  containing a  detailed
          description of instructions. Pseudocode   Disadvantages of pseudocode
          is a non-formal  language  that  helps
          programmers  to write  algorithms. It is  The following are the disadvantages of
          a type of structured English or Swahili   pseudocode:
          used to specify an algorithm. It is neither   (i)  It is more difficult for a beginner to
          compiled  nor executed  by a computer.         follow the logic or write pseudocode
          There are no accurate  formatting  or
          syntax rules for writing pseudocodes.          than a flowchart.
                                                    (ii)  There is no standard way of writing
          The importance of pseudocode                   pseudocode. As a result, we can

          Pseudocode is easy to read, understand,        have different pseudocodes from
          and modify. Pseudocode helps review            one problem.
          the  steps  to  confirm  that  the  expected
          implementation will achieve the desired   In pseudocode, keywords are used to
          output.                                  indicate  common  input,  processing
                                                   operations,  and output.  They can be
          Advantages of pseudocode                 written entirely in uppercase or start
          The following are the advantages of      with a capital letter. The commonly used
          pseudocode:                              keywords are described in Table 8.2.


          Table 8.2: Standard keywords used in pseudocode

           Item          Keyword                             Description
          1      START or BEGIN              This is used whenever you start your
                                             pseudocode.

          2      INPUT, READ, or GET         These are keywords used for inputting data.
          4      PRINT,     DISPLAY,     or This will show your output to a screen or any
                 SHOW                        output device.


                                               152
                                                                  for Secondary Schools
   155   156   157   158   159   160   161   162   163   164   165