Professional Documents
Culture Documents
1. The following are various programming languages that are apart of various generations.
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:
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.
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.
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
Total 10 marks
r CSE SECTION OF TH
Readln (PRICE);
Readln (QTY);
TOTAL: = PRICE * QTY;
IF TOTAL > 1500 THEN
BEGIN
DISCOUNT: = TOTAL * 0.15;
END
ELSE
BEGIN
DISCOUNT: = TOTAL * 0.10
END;
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
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
V. Complete the following trace table with the corrected algorithm written in 4
(IV). (2 marks)
END OF TEST