0% found this document useful (0 votes)
41 views14 pages

2015 Nov

kneck 2021

Uploaded by

June Aluoch
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
41 views14 pages

2015 Nov

kneck 2021

Uploaded by

June Aluoch
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 14
easytvet.com Name: ee Index No.: at 2920/103 Candidate's Signatu STRUCTURED PROGRAMMING November 2015, Date: _ ‘Time: 3 hours ‘THE KENYA NATIONAL EXAMINATIONS COUNCIL DIPLOMA IN FORMATION COMMUNICATION TECHNOLOGY MODULEL STRUCTURED PROGRAMMING, 3 hours INSTRUCTIONS TO CANDIDATES Write your name and index number in the spaces provided above. Sign and write the date of examination in the spaces provided above. Answer any FIVE of the EIGHT questions in this paper in the spaces provided after each question Candidates should answer the questions in English. For Examiner's Use Onty i - . “TForal uestion | 1 | Question 2 3 4 5 6 7 8 : Score Candidate's Score | This paper consists of 16 printed pages. Candidates should cheek the question paper to ascertain that all the pages are printed as indicated and that no questions are missing. G2015 The Kenya National Examinations Council ‘Turn over easytvet.com 1. (@__Deseribe compitation as used in programming. (2 marks) (b) Differentiate between iteration and recursion as used in programming. (4 marks) (©) Peter, a student in a college, was presented with the following ten numeric values: 56, 49, 70, 83, 23, 45, 67, 76, 55 and 37. He was asked to create a data structure that would allow him to have access to each value directly. (i) Tdentify the most appropriate data structure that he would create. (1 mark) (ii)—‘Using the data structure in (i), write a C program that would display the data. (5 marks) 2920103 2 November 2015 easytvet.com @ — Gi) Describe two items that could be added to a user manual in order to assist in the access of details and information. (4 marks) Gi) Explain two importance of documenting all the stages during program development. {4 marks) 2. (a) Write operators order of precedence fot evaluating mathematical expressions as used in Pascal programming. (G marks) (&) @__David wrote a program with the seven days of a week declared as enumerated type in Pascal programming. Write two statements that would be used to generate a message “IT’S A WEEKDAY” if the day is not Sunday or Saturday in the program, 4 marks) 2920/03 a ‘Turn over November 2015 easytvet.com (i) Differentiate between PRED and SUCC predefined functions as applied in Pascal programming. (4 marks) (©) Write aC program that could print all numbers that are divisible by 9 from I to 99. Use or loop. (5 marks) (@) A student was given a computer program code to study. Outline four characteristics that he may use to ascertain that the program is written using structured prograraming language. (4 marks) 2920/03 4 November 2015 easytvet.com 3, (@)_State four chatacters that are used for data conversion specification in C program input and output functions. (2 marks) (b) Explain two uses of a RESET function as used in Pascal programming language, (4 marks) (©) An ICT company iatends to develop a new program. The team leader is faced with a challenge over which programming language to use, Explain three factors that the leader should consider when making a decision. (6 marks) 2920/103 5 Turn over November 2015 easytvet.com {@)__ Figure | shows a decision tree that was used by a programmer in a company to eampute the discount offered to customers. Use it to answer the question that follows. Customer Category A | —¥ fro Bisoount] Discount 15% Customer Category B > Figure | Woite a Pascat program that prompts 2 user to enter the amount spent by the customer. ‘The program then computes and displays the discount offered using the logie depicted in Figure 1. (8 marks) 2920/03 6 Navember 2015 easytvet.com 4. @ Write the output of each of the following logical operators when executed using C programming language. @ false (mark) (ii) true && false (1 mark) (iti) true iffalse (1 mark) (©) Given that a=10, b=5 and c=2 determine the values of x in each of the following statements as used in Pascal programming. Show your working: (i) x=2*a mod (b-3ysqri(c#2) (2 marks Gi) x=2%e + sqr(at te (2 marks) (c) ‘Tom would like to use random file in his program: @ Outline three advantages of this file; (GB marks) 2920/103, 7 ‘Turn over November 2015 easytvet.com (ii) Explain two limitations of this approach to file organization. (4 marks) (@) Jane, a programmer in a hospital was tasked to develop a program using Pascal programming Janguage. The following data items are considered as input: Patient name, patient age, gender F/M and amount paid. (i) Identify the most appropriate data structure for this data. Justify your answer. (2: marks) (ii) Write seginent codes in Pascal programming language to read data in the structure identified in (i), (4 marks) 2920/103 8 November 2015 easytvet.com 5. (a) __Explain the function of default statement ina C programming language. (2 marks) (©) With the aid of a flowchart, describe the REPEAT. ..UNTIL loop as used in Pascal programming, (4 marks) (© (i) _—_ Outline four characteristics of assembly programming language. (4 marks) (ii) Explain three reasons for developing a computer program, (6 marks) 2920103” 9 ‘Turn over November 2015 easytvet.com {) | The following is a program written by a student using C programming language. The program could not run due to errors. 4include (stadio.A> void main() { float i,j; printf (“input two integers’); fscanf (“td %£",6i,5)7 7 Printf("\n addition=8d subtraction=$d\n” itj, i-d)s 3 Identify eight errors in the program. (4 marks) 6. (a) Outline two similarities between a procedure and a function as used in programming. (2 marks) (b) Explain three typical errors that are likely to occur during fite VO operations in a program, (6 marks) 2920/103° 0 November 2015 easytvet.com (©) _ Differentiate benween merge sort and quick soré techniques as used in programming. (4 marks) (2) @_ The following are names of students in a programming class: Leonard, Bancy, Faith, Olive, Quinter, Alice, Patrick, Grace, Helen and Mercy. Represent them in a binary tree, (5 mark) (ii) State the result generated when the tree is traversed using the post order strategy: (3 marks) 2920/103 u ‘Turn over November 2015 easytvet.com 7. (a) Patrick, a programmer, developed a program for his client. Outline four ways that he could make the program easy to read and understandable. (4 marks) (>) Maria decided to use a compiler rather than an interpreter during program translation. Outline four reasons that could have ted her to make this decision. (4 marks) (©) Astudent is to develop a program that would prompt a user to enter two integers. The program should then compute the difference between the two integers. The program

You might also like