<=Back

<=KNEC diploma in ICT module 1 structured programming past paper: July 2018

Given that x is a variable in C program that stores a numeric value, distinguish between x++ and ++x as used in program operation

    Viewed:  303  times

  Share in:
        

Question Answer:





Questions List:

1. Outline three advantages of structured programming languages
2. Differentiate between low level and high level programming languages
3. Table 1 shows a five-day schedule of trips for students in various department. Use it to answer the question that follows. (i) Draw a flowchart to represent the logic of a program that could accept the day number and output the destination. (ii) Using a switch statement, write a C program to implement the program logic.
4. Explain each of the following statements as used in C programming: (i) Sentinel; (ii) Break.
5. Explain two disadvantages of monolithic programming
6. Distinguish between source code and object code as used in programming
7. The area A of a triangle is obtained using the formula A=#sqrt((S(S-a)(S-b)(S-c) ) )# where a, b and c are dimensions of a triangle and S=#(a+b+c)/2# Write a C program that would prompt for the three dimension of a triangle, computes the area and display the result to the nearest 3 decimal places
8. Outline four qualities of a good algorithm
9. Explain the role of each of the following header files in a C program: (i) stdio.h (ii) math.h
10. Explain the circumstances under which each of the following Pascal keywords are most appropriate while programming: (i) goto; (ii) type
11. In an athletics competition, athletes were awarded money based on the ranking as shown in Table 2. Write a C program that what would accept the rank. The program should the determine the award through the use of a function and display the results. Use if statement.
12. Outline two ways of checking the correctness of a program
13. Describe two categories of data that could be used to test a program
14. Explain a circumstance under which each of the following parameters passing methods are most appropriate: (i) pass by value; (ii) pass by reference
15. Distinguish between technical and user documentation of a program
16. Write a Pascal program that would accept a positive integer. the program should then determine the square of the number and display the number and its square through the use of procedure
17. State two operations that can be carried out in a queue data structure
18. Describe a linked list as applied in programming
19. State the meaning of each of the following file handling modes: I. a II. w III. r
20. Given that x is a variable in C program that stores a numeric value, distinguish between x++ and ++x as used in program operation
21. Outline the steps involved in swapping two elements in an array during sorting
22. With the aid of an illustration sort the following numbers in ascending order using a selection sort algorithm. (5 marks) 8, 4, 6, 12, 3, 2, 5
23. Code reusability is a popular trend used by programmers for quick programs development. outline four characteristics of such programs
24. Explain the term random access as used in the file organization
25. Distinguish between gets () and puts () as applied in C programming language
26. The following is a C program. Use it to answer the question that follows: #include<stdio.h< int main(){ int x,y,z; x=3,y=9,z=5; (x<=y)?12:9; z=x%y; return 0; } Using a trace table, show the values of x, y and z for the program executions.
27. A text file named students.txt is located D and has list of students. Write a Pascal program that reads a file and display the list on the screen
28. Explain the term in-built function as used in C programming
29. Distinguish between a record and an array data structure as used in programming
30. Describe sequential search algorithm as used in programming
31. Using binary search algorithm illustrate the steps used to search for value 45 in the following list of numbers. 12 15 18 20 25 30 48 50 75
32. Write a Pascal program that would display all the odd numbers from 1 to 29 alongside their squares. Use the while loop
33. State the functions of each of the following C escape characters: (i) \n (ii) \t
34. Write the general format for declaring a structure data type in C programs
35. Explain two reasons for using functions in a program
36. With aid of a flowchart, describe a repeat until loop as used in Pascal programs
37. Write Pascal program that uses the for loop to generate the following output. (6 marks) 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4