Surie Aziz @ SMKDPM 2009

CONFIDENTIAL

COMPUTING 2006

PAPER 1 / MEI / 6A3

STPM/S(E)958 STPM/S(E)958

SMK DATUK PETER MOJUNTIN, PENAMPANG

EXAMINATION NO. 2

MALAYSIAN HIGHER SCHOOL CERTIFICATE

Computing Paper 1

Two Hours and Thirty Minutes

DO NOT OPEN THIS EXAMINATION PAPER

UNTIL YOU ARE INSTRUCTED TO DO SO

1.  This paper consists of TWELVE structured question

2.  Answer all questions in separate papers.

3.  The [ ] symbol at the end of each question shows the marks that will be given for the answer.

Prepared by Checked by Verified by

(SURIYATI ABDUL AZIZ) (VERITINUS SANTIONG) (MARIE YONG PIK HUA)

Computing Teacher Ketua Bidang Teknik Pengetua

Vokasional SMK Datuk Peter Mojuntin

This examination paper has 8 printed pages.

STPM/S(E)958 See Overleaf


Answer all questions

1. “ In this generation, compiler was used to converts the entire source program into machine language before executing it. Programming languages that was used in this generation used English like words, and can be used on more than one type of computer. This language also can handle bigger and much complex problem. Examples of programming language in this generation were COBOL, Fortran, Basic, Pascal, C and Ada.”

Based on statements above,

(a) From what generation is the programming language mention above. [2]

(b) State the meaning of Programming Languages. [2]

(c) Other than compiler, state another two tools used by computers to converts the entire source program into machine language before executing it. [2]

(d) State TWO characteristic of programming languages in fourth generation languages (4GL).

[2]

2. Below is an algorithm to solve a mathematical problem in getting the biggest number and average number from three given numbers.

1.  Start

2.  Read X

3.  Read Y

4.  Read Z

5.  Total = X + Y + Z

6.  Average=Total / 3

7.  If X > Y and X > Z then Biggest =X, goto line 10

8.  If Y > X and Y > Z then Biggest =Y, goto line 10

9.  If Z > X and Z > Y then Biggest =Z, goto line 10

10.  Display Average

11.  Display Biggest

12.  End

(a)  Define the meaning of ALGORITM [2]

(b)  There are TWO types of algorithm. State and briefly explain both of the algorithm. [4]

(c)  Based on algorithm above, draw a suitable flowchart diagram. [12]

5. Briefly explain two reasons why functions used in a program. [4]

6. Explain and write a sample C statement to show the use of

(i) Definition of Function

(ii) Call of Function

(iii) Function Prototype

(iv) Formal Parameters

(v) Actual Parameters [5]

7. Briefly explain two types of function below. Write a sample of C statements to support your explanation :

(i) A function that can return a value

(ii) A function that do not return any value [4]

Question 8 based on Diagram 2 below.

DIAGRAM 2

8. From diagram 2,

(i) List three identifiers which have global scope. [3 marks]

(ii)  List three identifiers which have local scope. [3 marks]

(iii) State two differences between global scope identifier and local scope identifier. [2 marks]

(iv) Given the value of num1 is 200, num2 is 300 and num3 is 500. If one instruction as below is put in line Z, what is the value return to the main program ? [2]

Instruction to be put in line Z : addnumber=addnumber*A+B+C

Question 9 based on diagram 3 below.

Array name = WORLDCUP / Array name = SUBJECTMARK
1972
1976
1980
1984
1988
/ 20.5 / 65.8
34.6 / 78.5
56.3 / 34.7

DIAGRAM 3

9. From logical arrays in diagram 3,

(i) Write C statements to declare SUBJECTMARK array. [1]

(ii) Data can be assigned into an array when the array is declared. Write a C statement to declare and assign all the data for WORLDCUP array. [3]

(iii) Data can also be assigned into an array in the main program. Write a C statement to assign all the data in the main program as in diagram 3 for SUBJECTMARK array. [3]

Question 10 based on diagram 4 below :

Array name = APPLE / Array name = ORANGE
250
450
300
180
/ 20.5 / 65.8
34.6 / 78.5
56.3 / 34.7

DIAGRAM 4

10. From arrays in diagram 4 above,

(i) Write a C program using FOR loop to calculate the total of apples. [3]

(ii) Write a C program using nested FOR loop to calculate the average of oranges in stores. [4]

Question 11 based on diagram 5 below :

DIAGRAM 5

11. From structure record in diagram 5 above,

(i) State the differences between structure and array. [4] (ii) Explain two ways to declare a copy of structure above. [4]

(iii) Assume you are given one copy of the above structure name ‘ScienceClassStudent’. Assign data of two students below to the ScienceClassStudent structure record.

[4]


Question 12 based on diagram 6 below :

Text File Name : STUDENT

File pointer declaration in C program

DIAGRAM 6

12. Based on diagram 6 above,

(i) Write a C statements to open STUDENT file as input file in read only mode. [2]

(ii) Write a C statements to open STUDENT file as output file in write only mode. [2]

(iii)  Write a C statements to read data from STUDENT file. [2]

(iv) Write a C statements to write one record below into STUDENT file. [2]

“Nurfaizah”, “5S2”, 17, 2,800.00

(v) Explain open file mode below : [4]

(a) “a”

(b) “r+”

(c) “w+”

(d) “a+”

(vi) Explain the difference between text file and ASCII file. [4]

“End of Question Paper”

- 1 -