<=Back

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

Assuming pascal programming language, evaluate the following expression;
Y = sqr(a) + b * c mod 4 / d
Given that a = 4; b = 6 , c = 10, and d= 3.

    Viewed:  829  times

  Share in:
        

Question Answer:





Questions List:

1. Outline two advantages of using assembly language to create a program
2. Distinguish between procedural and non-procedural programming languages
3. Explain two reasons that would make a programmer to opt for top-down design when developing a program
4. Assuming pascal programming language, evaluate the following expression; Y = sqr(a) + b * c mod 4 / d Given that a = 4; b = 6 , c = 10, and d= 3.
5. A technical institute allocates hostels to students on first come first served basis. A student first registers for term, pays fees and then applies for a hostel room. A room is allowed to students who meet this criteria. Draw a flowchart to represent the logic in the narrative
6. Explain the term user-defined data type as used in programming
7. A programmer created a program for a hospital to store patient details as a single entity consisting of : PatientNo, Patient_Name, Gender and Age. I)Identify the most appropriate data structure the programmer could have used II)Using pascal language declare a data structure that could be used to store this data
8. Outline three operations that may be carried out on a stack data structure
9. Distinguish between queue and linked list data structure
10. Table 1 shows the criteria used by Tusome Technical Institute to award grades to students. Use it to answer the question that follows Write a program in C language that would prompt a user to enter the points obtained by a student. The program then displays the corresponding grade. Use switch statement
11. Explain two characteristics of an algorithm
12. Write an algorithm that could be used to implement a quick sort
13. Write a program in C language that would prompt a user to enter an integer. The program then checks whether the integer entered is a prime number or not and displays an appropriate message
14. Write a program in Pascal language that prompts a user to enter a positive integer. The program then computes the sum of all integers from zero to the integer
15. Outline two types of utility programs used in program translation
16. A student created a program that could write data into a file. Describe three file organization techniques he could have used
17. The following is a C language program. Study and use it to answer the question that follows:
18. describe the term comment as used in Pascal programming language
19. Figure 1 shows the floor area of a rectangular room that has been fitted with a circular carpet. Use it to answer the question that follows: Write a program in pascal language to compute the area not covered by the carpet
20. Explain the term module as used in programming
21. State two differences between a function and a procedure as used in pascal programming language
22. Write a pseudocode that could be used to sort items in a list using bubble sort technique
23. Outline the use of each of the following C language file functions (4 mks) i) putc() ii)fprintf()
24. Write a program in C language that could be used to generate the following output 4 4 5 4 5 6
25. Outline two reasons for using data structures in a program
26. Describe two types of documents that could be included in a new program
27. Distinguish between writeln() and write() functions as used in pascal
28. A program prompts a user to enter the code “1234” in order to log in to a system. If the entered code is correct a message “Welcome” is displayed otherwise a message “The code is incorrect” is displayed. The program allows upto a maximum of three entries. Write a program in Pascal language that could be used to implement this logic
29. Explain the use of each of the following reserved words in structured programming i) break ii) Continue;
30. Distinguish between realloc and free functions as used in C programming language
31. Outline two advantages of merge sort algorithm
32. Figure 2 shows a list of data items in a data structure. Use it to answer the question that follows. Describe the data structure depicted in the figure.
33. Write a program in Pascal language that could be used to create a two by two and enter values into the array
34. State two ways other than comments through which a programmer could make a program more understandable
35. A student created a program using C language, identify an escape sequence he could use to format the output as a table
36. Outline the meaning of each of the following escape sequences as used in C programming language
37. Outline two types of errors that one could encounter when working with a stack
38. . Table 2 shows the criteria used by a county government to allocate bursaries to students . Use it to answer the question that follows. Write a program in Pascal language that would prompt a user to enter the status of a student. The program then outputs the amount allocated to the student. Use nested if statement
39. . Table 2 shows the criteria used by a county government to allocate bursaries to students . Use it to answer the question that follows. Write a program in Pascal language that would prompt a user to enter the status of a student. The program then outputs the amount allocated to the student. Use nested if statement