You are on page 1of 13
_ easytvet.com| SCAM Name a ___Index No. 19207203 Signature - _ STRUCTURED PROGRAMMING July 2015 Date Time: 3 hours THE KENYA NATIONAL EXAMINATIONS COUNCIL | CERTIFICATE IN INFORMATION TECHNOLOGY MODULE II STRUCTURED PROGRAMMING 3 hotwrs INSTRUCTIONS TO CANDIDATES Write your name and index mumber in the spaces provided above Sign and write the date of examination in the spaces provided above. “Answer Ail the questions in section A and amy FOUR questions in section B. Candidates should answer the questians in English. For Examiner's Use Only Section | Question Maximum sore | Candidate's score 1-10 40 F al l 1 15 a 2 i 1s B 13 is 14 15 = 15 15 ‘Total sere ‘This paper consists of 14 printed pages. Candidates should check the question paper to ascertain that all the pages are printed as indicated and that no questions are missing. 6.2015 The Kenya Nationa? Examinations Council Turn over easytvet.com| SECTION A (40 marks) Answer ALL the questions in this section 1. Outline the function of cach of the following preprocessor commands as used in a C program. (i) include (1 mark) (ii) Adefine (1 mark) Gil) ir (1 mark) (iv) error (1 mark) 2. With the aid of am example in each case, distinguish between a seconet generation and a fourth gencration programming Ianguages. (4 marks) 192/203 z easytvet.com 3. Ouiline two differences between an interpreter and a compiler as used in programming. (4 marks) 4 Given that State the Boolean results for each of the following, \ a) Cl mark) Gi) xH=12; (1 mark) . 2 (iil) xy; . ‘v (i mark) 5 — ae >, (i) yx B&xey., (i mark) 5. Differentiate between a Jreak and a contime statement as used in a C program, (4 marks) ~ 6. Quiline the finetion of each of the following escape sequence operators jo (1 mark) Gi (1 marks) Gi) (1 mark) 1920/203 3 Turn over easytvet.com| vy tt (1 mark) 7. Explain the role of each of the following C program statements. printf(“enter the student data”): (1 mark) seanf(“Yad,%c,%s,&k,n,ded); (G marks) 8. Marion developed a program using a © programming language. Explain two features of this language. (4 marks) 1920/203 easytvet.com 9, The following is 8 program written using a C programming language. Identify the errors in the program, smatks) #include«stdioh> Main() C int pl101,i: float avg=0: printf(enter 10 numericals); ie fxletaenen) scan(“Yod" pli); } for(i=Ojic=9si+4): { . ovgeaipal set avg(float)avg/Oi 5 Se ees i printf (enter average te aio! wok 1920/203, 5 ‘Turn over easytvet.com 10. Write € program that would add 3 consecutive numbers starting from number 3, The program should then display the output afer every counter. Use a While loop, (4 marks) 1920/203 easytvet.com SECTION B (60 marks) Answer any FOUR questions in this section 1, (@)— @)—Outline three characteristics of a pointer variable as used in C programming. (G marks) (ii) Outline two disadvantages of using pointers when writing aC program, (2 marks) > 4b) Distinguish between an object oriented and structured programming language. . (4: marks) (c) Write a C program that will display value and the address of variable a given that a=5,Use pointers. (6 marks) © 1920/203 7 Turn over easytvet.com '2 @) Outline the function ofeach of the following file modes used in C progeatn, Or (mark Gi) at mark) Gi) ow mark) * ) ty Describe a Sorting technique that uises the aivicder end conquer method, G3 marks) (920/203 - me easytvet.com (c) Write @ C program that would compute and display the area of two rectangles given that the length and width are 10, 15 and 20,40 respectively. Use functions, (5 marks) » BG) State the difference between gerw() and puiw() as used in C Progeamming language. (2 marks) (ii) Explain two ways in which parameters can be passed to n finction in C - programming, (4 marks) —— ‘Turn over (b) Merey is in the process of di easytvet.com! oping a system, Describe twa types of documentations that she is likely to come up with, (4 marks) (©) Write a € program that would prompt the user to enter the choice of fruit and display the message as shown in table 1.Use a cave sdatement. (5 marks) Character Message Go Tlove Oranges Aa [ My best fuit is apple | Bb Bananas are sweet - “Any other Tdan’t know the taste ‘Table 1 14. (@) Marion used a linear search to locate a record ina file, Outline two advantages of this type of search in programming. (2 marks) 1920/203 easytvet.com' (®) Mathew used arrays to display information. Explain two disadvantages he may have realised, (4 marks) (©) Distinguish between formal and actual parameters as used in C programming language, (A marks) e (4) Write a C program that would prompt a user to enter two numbers and check whether the numbers are equal, Use an if Statement, (Smarks) r 1920/203 " Tura over easytvet.comfy 1S. (@)__Deseribe each of the following design roofs 2s used in programming, (i) data low diagram; (2 marks) Gi) decision table. (2 marks) (b) Write # C program that would accept a word and display the length of the word. (S marks) yn 1920/203 12 easytvet.com Aggy wants 10 develop an information system for an organization, Explain three factors she should consider when selecting an appropriate language to use for developing the system. (6 marks) te) 1920203 a ‘Turn over

You might also like