Você está na página 1de 6

Information Technology in FOCUS for CSEC©

QUESTIONS FROM THE PROGRAMMING SECTION OF THE SYLLABUS:

Subject: Information Technology


Topic: Problem Solving and Programming
Duration: 50 Minutes
Date: ………../……./…………
Instruction: Answer All Questions

1. Match the corresponding programming language with the appropriate Generation of


programming languages.

Generation Languages
1GLs A 1 Fortran
2GLs B 2 SQL
3GLs C 3 Binary
4GLs D 4 PROLOG
5GLs E 5 Assembly

(5 marks)
Possible answer:

Generation Languages
1GLs A 1 Binary
2GLs B 2 Assembly
3GLs C 3 Fortran
4GLs D 4 SQL
5GLs E 5 PROLOG

I. Write an example of each of the following Programming languages stated above.


(5 marks)
Possible answer:
1GLs
01000001

2GLs
main proc
movax,@data
movds,ax
movah,9
movdx,offset hello_message
Information Technology in FOCUS for CSEC©
QUESTIONS FROM THE PROGRAMMING SECTION OF THE SYLLABUS:

int21h
movax,4C00h
int21h
main endp
end main

3GLs
print *, 'This program calculates 23.6*log(4.2)/(3.0+2.1)'
print *, 23.6*log(4.2)/(3.0+2.1)
end program

4GLs
FIND ALL RECORDS WHERE NAME IS "NEIL"
FIND ALL RECORDS WHERE AGE IS "18"

5GLs

English Prolog

John eats a pepperoni Eats (john, pizza


pizza. (pepperoni)).
X and Y are parents of Z Parent (X,Y,Z) :-
if X is the mother of Z mother(X,Z) , father (Y,Z).
and Y is the father of Z
Sparky barks at anyone Barks (sparky, X):- walks
who walks quickly. (X, quickly).
A equals B A = B.

A does not equal B A /= B.


Information Technology in FOCUS for CSEC©
QUESTIONS FROM THE PROGRAMMING SECTION OF THE SYLLABUS:

II. Complete the diagram below: (7 marks)

Generation of Languages

Total 17 marks

Generation of Languages

Low Level Languages High-Low Languages

Third Fourth Fifth


Second
First Generation Generation Generation Generation
Generation
Languages 1GLs Languages Languages Languages
Languages 2GLs
3GLs 4GLs 5GLs
Information Technology in FOCUS for CSEC©
QUESTIONS FROM THE PROGRAMMING SECTION OF THE SYLLABUS:

2. Complete the IPO Chart with the appropriate data base on the given question.

i. Write an algorithm in Pseudocode that will accept three numbers and calculate
the average. The algorithm should display the average and the sum
appropriately.

Input Processing Output


Enter 3 Sum = num1 + num2 + Display sum
numbers num3 Display average
Average = sum/3
(5 marks)
ii. State what would be the result of the program if the three numbers were, 10, 5
and 15? (2 marks)
Possible answers:
Sum = 30
Average = 10

Total 7 marks
3. State the name of each operator and when it is used:
a. <= less than or equal to (2 marks)
b. := assignment (2 marks)
c. > greater than (2 marks)
d. <> not equal to (2 marks)

I. Complete the following questions in Pseudocode.

a. Write an algorithm that will displays the area of a rectangle once the user
enters the length and width (4 mark)
Possible answers:

Step 1. Start
Step 2. Write “Enter Base and Height”
Step 3. Read LENGTH, WIDTH
Step 4. Set AREA  LENGTH*WIDTH
Step 5. Write “the area is”, AREA
Step 6. Stop
Information Technology in FOCUS for CSEC©
QUESTIONS FROM THE PROGRAMMING SECTION OF THE SYLLABUS:

b. Write an algorithm that will display the perimeter of a circle. The


algorithm should read the radius of a circle. (4 mark)
Possible answer:

Step 1. Start
Step 2. Write “Enter Radius”
Step 3. Read RADIUS
Step 4. PIE=3.142
Step 5. PERIMETER  2(PIE*RADIUS)
Step 6. Write “Perimeter is” PERIMETER
Step 7. Stop

Total 16 marks

II. Use the completed Pseudocode to answer the following:


Line 1. MIN = 999
Line 2. Print “Enter Integer”
Line 3. Read Num
Line 4. WHILE Num <> 0 DO
Line 5. IF Num < MIN THEN
Line 6. MIN = Num
Line 7. ENDIF
Line 8. Print “Enter Integer or 0 to stop program”
Line 9. Read Num
Line 10. ENDWHILE
Line 11. Print “The Lowest number is”, MIN

a. For EACH of the following, identify ONE line that contains the
following: (6 marks)
i. A prompting statement
Line 2

ii. An Input statement


Line 3

iii. A selection statement


Line 5 – 7
Information Technology in FOCUS for CSEC©
QUESTIONS FROM THE PROGRAMMING SECTION OF THE SYLLABUS:

iv. A loop
Line 4 – 10

v. A terminating statement
Line 7

vi. An output statement


Line 8

b. Carefully complete the following trace table below, if Num = 10:


(3 marks)

Line MIN Num


1
3
6

Line MIN Num


1 999
3 10
6 10

c. State the result of the algorithm. (1 mark)

Possible answer:
The Lowest number is 10
Total 10 marks

GRAND TOTAL 50 MARKS

END OF TEST

Você também pode gostar