<=Back

<=KNEC diploma in ICT module 1 structured programming past paper:November 2021

Write a program in Pascal language that prompts a user to enter two integers. The program then checks whether the two integers are equal and displays a Boolean result

    Viewed:  642  times

  Share in:
        

Question Answer:





Questions List:

1. The following segment code was declared in a Pascal program. Use it to answer the question that follows. TYPE Grade = (‘A’, ‘B’, ‘C’, ‘D’, ‘E’); VAR Mark: Grade; Name the type of variable used.
2. Using an appropriate predefined function, write a statement that would generate the ASCII value of character ‘D’
3. Distinguish between source code and object code as used in programming
4. Write a program in Pascal’s language that would generate the following output when executed. & && &&& &&&& &&&&&
5. Declare an employee record containing; name, hours worked per day for 5 days and address
6. Write a program in c programming language that would create a data file with the following employee details. Employee number and basic pay
7. Given the following c program expression; Basic pay + allowances > 2200 && code ==1 || netpay >1000 Write the order of the operator precedence
8. Differentiate between pseudo code and structure narratives as used in programming
9. Write a program in C language that accepts 10 numbers, store them in array and display them number in reverse order
10. Outline two functions of a compiler as used in programming
11. Write a program in pascal language that prompts a user to enter a price of an item ranging between 10 and 100 shillings. The maximum number of items one could buy is 20. The program then computes and displays the cost of the items
12. State two contents in each of the following documentations. i)Program; ii)User
13. Explain two approaches used by programmers to improve the readability of a program.
14. A program prompts a user to enter two numbers. The program then divides the first number by the second number and displays the result. When the second number is zero, the program displays an error message “Error” and terminates the program. Draw a program flow chart to represent the logic of this program
15. Distinguish between do ……. While and while loops as used in C programming
16. The following program was created during a programming lesson. Use it to answer the question that follows. main() { int i, j; i = 12; j = 10; fn (&i, &j); printf(“%d %d\n”, i,j); } fn (m,n); int *m, *n; { (*m)++; (*n)++; printf(“%d, %d”, *m, *n); } Interpret the program
17. Outline three reasons for creating a documentation during a program development
18. Explain two types of errors that are likely to occur after a program compilation
19. Write a program in Pascal language that prompts a user to enter two integers. The program then checks whether the two integers are equal and displays a Boolean result
20. Write an algorithm that could be used to implement a sequential search in an array
21. Figure 1 shows a decision tree used by a student to analyze a program for computing customer’s discounts. Use it to answer the question that follows Write a C program to implement the logic depicted in figure.
22. Outline four characteristics of quick sort technique
23. Describe two causes of errors likely to occur when a C program fail to read a data file.
24. Write a pascal program that prompt a user to enter a digit. The program then computes and displays the square root using the pre- defined function
25. Draw a program flow chart that could be used to solve the values of x in the quadratic equation: f(x) = ax2+bx+c
26. State two non-linear structure used in programming
27. Explain two activities that take place during program compilation
28. Differentiate between dry run and walkthrough program testing methods
29. Write a program in pascal language that uses function to compute the volume of a cube when its length is passed to it. The program then displays the result
30. Explain each of the following terms as used in programing: (4 marks) i) test data; ii)Bug
31. Outline three sources of programming projects
32. Outline three circumstances that could lead to a use of pseudocode
33. Given the values i=6 and j=10, for statement j = ++i+6, evaluate: (4marks) i) Prefix increment; ii) Post fix decrement
34. Write a program in pascal language that would read and output temperature readings in four different locations three different times in a day
35. State four examples of structured programming languages other than pascal and C languages
36. Outline two advantages of high level languages
37. With the aid of a flow chart, describe the insertion procedure of an element in a queue data structure
38. Write a program in pascal language that divides two integers: 16 and 3. The program then using two predefined function to display the result as integer
39. Write a C program that prompts a user to enter age of a person. The program then displays the age and a message “You are an adult” whenever the age is greater than 18 years