# National Open University Exam Past Question – CIT736 JUNE/JULY EXAMINATION

## NATIONAL OPEN UNIVERSITY OF NIGERIA CIT736 Computer Programming

14/16 AHMADU BELLO WAY, VICTORIA ISLAND, LAGOS SCHOOL OF SCIENCE AND TECHNOLOGY JUNE/JULY EXAMINATION

COURSE CODE:   CIT736

COURSE TITLE:   Computer Programming (2 units)

TIME ALLOWED: 2 hours

INSTRUCTION:    Attempt any four (4) questions

1.

1. a. With the aid of a diagram, briefly explain the term “translator” (4 marks).
2. Explain briefly, the following  types of program errors, stating examples in each case (7.5 marks):
3. Conversion error ii. Round-off error iii.   Syntax error
4. Runtime error
5. Logical error
6. c. List and explain briefly 4 properties of a good prog (6 marks)

2.

1. a. Write a FORTRAN 90/95 program to compute the sum, product and average of any n integers where n>=0. In particular ensure that the program handles the case n=0 without yielding any errors (10 marks)
2. Caching promotes efficiency when 2 conditions are met. State those 2 conditions (3 marks). c. State and explain 3 methods/ways to step through code during debugging (4.5 marks)

3

1. a. Draw the flowchart for a program that reads 3 integers and prints out their sum, product and average (7 marks)
2. Write a Pascal program that calculates and displays the squares of all numbers between 1 and

1000 as well as the sum and average of these squares. (8.5 marks)

1. Briefly explain the logic behind desk checking (2 marks)
YOU MAY ALSO LIKE  EDT 834 INSTRUCTIONAL TELEVISION AND RADIO EDT 834 MAY/JUNE 2012 EXAMINATION

4.

1. a. Given the probability function P=(1-n!)/((n-c)!*n^c), where n is the number of days in a year, c is the size of the population, write a FORTRAN program to calculate and display the value of P given any value of n and c. The program should work as follows:
2. It should accept values of n and c from the user as input
3. It MUST contain a function called fact which accepts a single argument and returns its factorial iii. fact must be used in the program to calculate all factorial values
4. The final program should return the value of the probability P. (13 marks)

1. What is the difference between a FORTRAN function and a FORTRAN subroutine? (2.5 marks)
2. What is the advantage of using functions and subroutines in FORTRAN programs? (2 marks)

5.

1. a. Complete the following table containing Pascal keywords/functions with the output/effect of

each of statement (5 marks):

 Keyword Description/Effect Clrscr Gotoxy(int,int) ReadKey Delay(1000) Halt(1)

1. Find errors, if any, in the following unformatted Pascal I/O statements:
2. Read (a; b; c); (2 marks)
3. Write (“The sum is”, sum); (2 marks)
4. c. Suppose that we have data items; a = 10 and b = 44
5. Determine the output if the program segment is executed: Read (a, b);
YOU MAY ALSO LIKE  National Open University Exam Past Question – CHS 316 JANUARY/FEBRUARY 2013 EXAMINATION

c = a ^ 2; d = 2 * b; Write (a, c, d); (3 marks)

1. If the write statement is changed to: Writeln (a, c);

Write (d); (2 marks)

1. Write a pascal program to read the values 2.34, 1.25, 3.25 and prints each value, one per line, with formatted output of one decimal place and a field width of 5. (5.5 marks)

1. F=C*(9/5)+32 where F is Fahrenheit and C is Celsius
2. a. Write a Pascal program to read and convert a Fahrenheit temperature supplied by a user to

Celsius. (5.5 marks)

1. Draw the flowchart for the program in a. (3.5 marks)
2. Write a Pascal program to read and convert a Celsius temperature supplied by a user to

Fahrenheit. (5 marks)

1. Draw the flowchart for the program in c. (3.5 marks)

Close

Close