CSEC©
QUESTIONS FROM THE PROGRAMMING SECTION OF THE SYLLABUS:
Subject:               Information Technology
Topic:                 Problem Solving and Programming
Duration:              45 Minutes
Date:                        /    /
Instruction:           Answer All Questions
   1. The following are various programming languages that are apart of various generations.
 A: 01000001 (65)   a: 01100001 (97)
 B: 01000010 (66)   b: 01100010 (98)
 C: 01000011 (67)   c: 01100011 (99)
       Figure. 1
                                   movax,@data
                                   movds,ax
                                   movah,9
                                   movdx,offset hello_message
                                               Figure. 2
 5LET S =0
 10 MAT INPUT V
 20LET N = NUM
 30IF N =0THEN99
       Figure. 3
                                   ProgramLesson1_Program3;
                                   Var
                                   Num1, Num2, Sum : Integer;
                                   Begin {no semicolon }
                                               Figure. 4
                                                                #include <stdio.h>
                                                                int main(void)
                                                                {
                                                                printf("Hello world!\n");
                                                                return EXIT_SUCCESS;
                                                                }
                                                                               Figure. 5
Information Technology in FOCUS for CSEC©
             QUESTIONS FROM THE PROGRAMMING SECTION OF THE SYLLABUS:
     I. State the programming languages listed above.                     (5 marks)
        Possible answer:
                 Figure. 1 – binary
                 Figure. 2 – assembly
                 Figure. 3 – BASIC
                 Figure. 4 – Pascal
                 Figure. 5 - C
     II. Name the Generations that the languages belong to.                       (3 marks)
         Possible answer:
                 First generation
                 Second generation
                 Third generation
                 Fourth generation
     III. In your own word state TWO differences between High Level and Low Level
          Languages.                                                        (4 marks)
          Possible answer:
              Two differences between high and low level languages; low level languages
          deals with a computer's hardware components and constraints. These are
        languages that are classified as machine dependent. This means only a particular
        computer’s CPU will understand this type of language while high level languages
        are not machine dependent as low level programming languages. This means that
        programs created on one computer can be used on another computer.
     IV. What does the term     Machine Dependent       and    Not Machine Dependent ?
                                                                              (2 marks)
        Possible answer:
            Machine Dependent – means only a particular computer’s CPU will understand
        this type of language.
            Not Machine Dependent – means that programs created on one computer can
        be used on another computer.
     V. Which Generation of programming language is based on a Database Management
        System?                                                          (1 mark)
        Possible answer:
            Fourth generation programming language
                                                                                 Total 15 marks
               ESTIONS FROM THE PROGRAMMING SECTION OF THE SYLLABUS:
2. The algorithm below is designed to read an integer. If the integer is less than 30,
   multiply 5 to the number then Output the product.
   I.        Identify the line of codes that represent Prompting Statement ,   Processing
             Statement (Arithmetic) or “Output Statement”.
                            Start
             Line 1:        Write Enter a number
             Line 2:        Read NUMBER
             Line 3:               IF NUMBER < 30 THEN
             Line 4:                     Set PRODUCT       NUMBER * 5
             Line 5:        Write “The Product is”, PRODUCT
                            ENDIF
                            Stop
                                                                                     (5 marks)
          Possible answer:
             Prompting Statement – line 1
             Processing Statement – line 3 – line 4
             Output Statement – line 5
   II.       Find the product if the variable NUMBER is storing 8.             (2 marks)
          Possible answer:
             The Product is 40
   III.      What would be the result of the algorithm if the variable NUMBER is storing 34
             instead of 8?                                                   (1 mark)
          Possible answer:
             The Product is 0
   IV.       Correctly state the function that is used in the algorithm. (1 mark)
          Possible answer:
             If Then function
   V.        State the purpose of the arrow in the algorithm.                  (1 mark)
          Possible answer:
             Assignment
                                                                               Total 10 marks
r CSE SECTION OF TH
                3. Study the following segment of programming codes in Pascal:
                      Readln (PRICE);
                      Readln (QTY);
                             TOTAL: = PRICE * QTY;
                                IF TOTAL > 1500 THEN
                                BEGIN
                                        DISCOUNT: = TOTAL * 0.15;
                                END
                                ELSE
                                        BEGIN
                                                DISCOUNT: = TOTAL * 0.10
                                        END;
                       I.     State the variables that are located in the lines of code.
                             Possible answer:
                                   PRICE
                                                                                                  (2 marks)
                                   QTY
                                   TOTAL
                                   DISCOUNT
                      II.     What would be the appropriate data type for the identified variables? (1 marks)
                             Possible answer:
                                     Real/floating point
                                     Integer
                      III.    If price is 12 and quantity is 4, what discount would be calculated and what would
                              the discount be.                                                      (1 mark)
                             Possible answer:
                                DISCOUNT:= TOTAL * 0.10
                                DISCOUNT= 4.8
                      IV.     What kind of statement is used in the program?                      (1 mark)
                             Possible answer:
                                If Then Else statement
                      V.       State the purpose of the following:
                             a. :=                     Possible answer: assignment                (1 mark)
                             b. >                      Possible answer: greater than              (1 mark)
                             c. ;                      Possible answer: end of a statement        (1 mark)
                             d. BEGIN and END          Possible answer: start and end program     (1 mark)
                UESTIONS FROM THE PROGRAMMING SECTION OF THE SYLLAUS:
  VI.         State the purpose of the Pascal program.                (1 mark)
              Possible answer:
                Pascal is a procedural programming language that supports structured
              programming and data structures to encourage good programming practices.
                                                                            Total 10 marks
4. State the line of code with the errors in the following algorithms.          (4 marks)
        I.     Start
          Line 1 Write Enter three numbers
          Line 2: Read A, B
          Line 3:         Set A A + B
          Line 4:         Set B   B+A
          Line 5: Writ A, B
                         Stop
        Possible answer:
            Line 1
            Line 5
        II.  Start
        Line 1 Write Enter Three numbers
        Line 2: Read Num1, Num2, Num3
        Line 3:        AVG      SUM
        Line 4:        SUM      Num1 + Num2 - Num3
        Line 5: Write The average is AVG
             Stop
   Possible answer:
       Line 3 – 4
       Line 5
        III.      State the name of the errors in the above algorithms.   (2 marks)
                  Possible answer:
                       syntax error
                       logic error
        IV.       Rewrite the question 4(II) appropriately.    (2 marks)
                  Possible answer:
                      I.      Start
                  Line 1: Write “Enter Three numbers”
                  Line 2: Read Num1, Num2, Num3
                  Line 3:            SUM       Num1 + Num2 - Num3
       QUESTIONS FROM THE PROGRAMMING SECTION OF THE SYLLABUS:
                           G      SUM
        Line 4:     Write “The average is:”, VG
        Line 5:     Stop
V.      Complete the following trace table with the corrected algorithm written in 4
        (IV).                                                          (2 marks)
     LINES    Num1 Num2         Num3      SUM AVG
     LINE 2   5    3            2
     LINE 3
     LINE 4
     LINES    Num1 Num2         Num3      SUM AVG
     LINE 2   5    3            2
     LINE 3                               6
     LINE 4                                       6
                                                                       Total 10 marks
                           GRAND TOTAL 45 MARKS
                                  END OF TEST