<=Back

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

Write a C program that could print all the numbers that are divisible by 9 from 1 to 99. Use for loop

    Viewed:  553  times

  Share in:
        

Question Answer:





Questions List:

1. Describe compilation as used in programming
2. Differentiate between iteration and recursion as used in programming
3. Peter, a student in a college, was presented with the following ten numeric values: 56, 49, 70, 83, 23, 45, 67, 76, 55 and 37. He was asked to create a data structure that would allow him to have access to each value directly. i)Identify the most appropriate data structure that he would create ii)Using data structure in (i), write a C program that would display the data.
4. Explain two importance of documenting all the stages during program development
5. Write operators order of precedence for evaluating mathematical expressions as used Pascal programming
6. Differentiate between PRED and SUCC predefined functions as applied in Pascal programming
7. Write a C program that could print all the numbers that are divisible by 9 from 1 to 99. Use for loop
8. A student was given a computer program code to study. Outline four characteristics that he may use to ascertain that the program is written using structured programming language
9. State four characters that are used for data conversion specification in C program input and output functions
10. Explain two uses of a RESET function as used in Pascal programming language.
11. An ICT company intends to develop a new program. The team leader is faced with a challenge over which programing language to use. Explain three factors that the leader should consider when making a decision
12. Figure 1 shows a decision tree that was used by a programmer in a company to compute the discount offered to customers. Use it to answer the question that follows. Write a Pascal program that prompts a user to enter the amount spent by the customer. The program then computes and displays the discount offered using the logic depicted In Figure 1
13. Write the output of each of the following logical operators when executed using C Programming language. i)!false; ii)True && false; iii)True||false
14. Given that a=10, b=5 and c=2 determine the value of x in each of the following statements as used in Pascal programing. Show your working. i)x=2*a mod(b-3)/sqrt(c+2) ii)x=2^c+sqr(a+1)*c
15. Tom would like to use random file in his program: i)Outline three advantages of this file; ii)Explain three limitations of this approach to file organization
16. Jane, a programmer in a hospital was tasked to develop a program using Pascal programming language. The following data items are considered as input; patient, name, patient age, gender F/M and amount paid. i)Identify the most appropriate data structure for this data. Justify your answer. Write segment codes in Pascal programming language to read data in the structure identified in (i)
17. Explain the function of default statement in a C programming language.
18. With the aid of a flowchart, describe the REPEAT…UNTIL loop as used in Pascal programming
19. Outline four characteristics of assembly programming language
20. Explain three reasons for developing a computer program
21. The following is a program written by a student using a C programming language. The program could not run due to errors.Identify eight errors in the program
22. Outline two similarities between a procedure and a function as used in programming.
23. Explain three typical errors that are likely to occur during the I/O operations in a program
24. Differentiate between merge sort and quick sort techniques as used in programing
25. The following are names of a student in a programing class. Leonard, Bancy, Faith, Olive, Quinter, Alice, Patrick, Grace, Helen and Mercy. Represent them in a Binary tree
26. Patrick, a programmer, developed a program for his client. Outline four ways that he could make the program easy to read and understandable
27. Maria decided to use a compiler rather than an interpreter during program installation. Outline four reasons that could have led her to make this decision
28. A student is to develop a program that would prompt a user to enter two integers. The program should then compute the difference between the two integers. The program displays the result when it is positive, otherwise it displays the message “Negative Result”. Write the pseudocode that the student would use to design this program
29. James, an ICT student, was given a program to write using Pascal programming language. i)Outline the order in which he would declare the categories of variables in the program. ii)Outline four rules that he should observe when composing the identifiers in the program
30. Cynthia tested a program and she encountered an error when she entered a zero value as an input for a mathematical expression. i)Describe the type of error that occurred ii)State the possible consequence when the error occurs
31. Outline two functions of technical documentation in programming
32. Outline the procedure that would be followed before performing each of the following in data structures; i)Adding an element in a stack. ii)Removing an element from a queue
33. The interest accrued I for a principal P after a period of T at the rate R is given by the formula I=PxRxT. Write a Pascal program that prompts a user to enter the principal amount in the main program and then pass this value to a procedure named compute. The procedure calculates the interest at a rate of 12% per annum for a period of 5 years. The procedure then returns the interest to main