<=Back

<=KNEC Craft Certificate in ICT Module 2 Structured Programming past paper july 2018

Write a program in C that could compute the sum of even numbers between 1 and 100. Use while loop

    Viewed:  447  times

  Share in:
        

Question Answer:





Questions List:

1. With aid of a diagram, describe a stack data structure
2. Explain two reasons for documenting a program
3. A student intends to write a computer program in a C programming. Outline three application that the student would use to complete the program
4. Write a program in C that could compute the sum of even numbers between 1 and 100. Use while loop
5. Explain each of the following approaches to programming i)Monolithic b)Visual
6. Differentiate between logical and relational operator as used in programming
7. The figure 1 is a flowchart. Use it to answer the questions that follows Write a program in C language to implement the logic depicted by the flowchart
8. James a student at ujuzi institute created a program that used an array to store data. Outline four properties that these data store possess
9. Differentiate between bubble and selection sort techniques
10. Write a program C language that computes a factorial number
11. Outline four disadvantages of low level programming languages
12. Write a program in C language that creates a ticket data file for railway reservation with the following structure: Train number Destination Passenger name Rate
13. A student used a pseudocode to design a program. State two benefits that the student may realize from using this design tool
14. Describe the switch statements syntax as used in C programming language
15. Outline three reasons for unit testing in a structured programming language
16. Explain two error detecting methods that could be used in program development other than testing
17. Write a C program in C language that prompts the user to enter an integer. The program then determines whether the number is divisible by 2 and outputs the message “it’s even” otherwise “it’s odd”.
18. A student would like to improve the readability of a program. Outline three approaches that he could use to achieve this objective
19. Outline three factors to consider when selecting a programming language
20. An item is sold at Ksh. 100 when 5 or more are bought. Otherwise the price is Ksh.150. Write a program in C programming language that prompts the user to enter number of items bought. The program computes and displays the total price for the items
21. State the difference between {} and [] delimiters as used in C language
22. Write a program in C language that computes the area of a triangle given that height is 10 and base is 5. Hint: Area of triangle is #1/2#base x height
23. State three structured programming language other than C language
24. Outline two traversal strategies that could be used in a binary tree data structure
25. Write an algorithm that could be used to search an element in a one- dimensional array using binary search technique
26. The following C program was created by a student. Use it to answer the question that follows. # include float main() { char str[50]; int i; printf(“Enter a value :’); scanf(“%s %f”,str, &i); Printf(“\n You entered:%c %d”,str,i); return 0; } Rewrite the program correctly.
27. Outline three characteristics of run time errors
28. John created a program that used a concept of passing the parameters by values. Outline two characteristics of such a program
29. Tegemeo institute is made up of several autonomous departments. You have been approached to assist in a program development process. (i) Describe the most appropriate programming approach for this scenario (iii)Explain two reasons for the approach in (i).
30. Write a program in C that uses an array to store marks scored by student in 5 different subject namely; 50,60, 45, 70 and 58. The program then calculates and outputs that average mark