# National Open University Exam Past Question – CIT736 October, 2013 Examination

## NATIONAL OPEN UNIVERSITY OF NIGERIA CIT736 Computer Programming

14/16, Ahmadu Bello Way, Victoria Island

SCHOOL OF SCIENCE AND TECHNOLOGY October, 2013 Examination

COURSE CODE: CIT736

COURSE TITLE:  Computer Programming Instruction:        Attempt any four (4) questions Time: 2 hrs

Question 1

1. 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:

1. It should accept values of n and c from the user as input
2. 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
3. The final program should return the value of the probability P.

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

Question 2

Write a Basic Program find the square and cube root a number (x).                                                      (17 marks)

Question 3

1. 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)
YOU MAY ALSO LIKE  National Open University Exam Past Question - EDU 712 OCTOBER 2013 EXAMINATION

1. b. Find errors, if any, in the following unformatted Pascal I/O statements:
2. Read (a; b; c); (2 marks)
3. ii. Write (“The sum is”, sum); (2 marks)

p.t.o

1. Suppose that we have data items; a = 10 and b = 44
2. Determine the output if the program segment is executed: Read (a, b);

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. d. 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)

Question 4

Explain the following terms;

 a) Conversion Error (4 marks) b) c) d) e) Syntax Error Round-off Error Run-time Error Logical Error (3 marks) (4 marks) (3 marks) (3 marks)

Question 5

1. 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)

1. b. Caching promotes efficiency when 2 conditions are met. State those 2 conditions (3 marks).
2. State and explain 3 methods/ways to step through code during debugging (4.5 marks)

Question 6

Write short notes on the following

1. a) Machine Language                                                                                                                             (3 marks) b)   Symbolic languages                                                                                                                            (3 marks) c)   High Languages                                                                                                                                   (3 marks) d)   Subroutine                                                                                                                                           (4 marks) e)   Looping                                                                                                                                                 (4 marks)

Close

Close