Get premium membership and access revision papers, questions with answers as well as video lessons.

Programming Methodology Question Paper

Programming Methodology 

Course:Bachelor Of Science (Mathematics & Computer Science)

Institution: Catholic University Of Eastern Africa question papers

Exam Year:2012



THE CATHOLIC UNIVERSITY OF EASTERN AFRICA
MAIN EXAMINATION
JANUARY-APRIL 2012 TRIMESTER
FACULTY OF SCIENCE
DEPARTMENT OF MATHEMATICS AND COMPUTER SCIENCE
CMT 103: PROGRAMMING METHODOLOGY
DATE:FRIDAY 6TH APRIL 2012
==============================================================================
TIME: 8.00 AM-10.00 AM
INSTRUCTIONS: ANSWER QUESTION ONE AND ANY OTHER TWO QUESTIONS

Q1 a) (i) What is a variable?(1 mark)

(ii) Explain briefly how variables are declared and initialized.Use an appropriate example. (5 marks)

b)(i) What is a loop? Give an example of a looping statement. (2 marks)
(ii) State and explain with appropriate examples two main loop control structures in C. (8 marks)

c)(i) What do you mean by Recursion?(2 marks)
(ii) Write a recursive function that returns the factorial of an integer.(6 marks)

(iii) Write the driver function to accompany the recursive function in c(ii) above. Ensure that you consider positive integers, negative integers as well as zero.(6 marks)

Q2 a) Identify and explain the unary operators found in C language.(7 marks)

b) Write a brief note about the switch...statement as used in C language. Ensure that your note captures the general syntax and flow chart.(7 marks)

c) Assuming that the codes for white , green and red are W or w, G or g, R or r respectively. Write a C program that displays the colour corresponding to the code selected. Use the switch....statement.(6 marks)

Q3 a) (i) What do we mean by Structures as used in C language? (6 marks)
(ii) Write a program that asks for student names and corresponding average marks and displays this information in the format shown below. Use structures in your program.

NAME AVERAGE MARK
Benson 70.8
Joseph 91.3 (8 marks)

b) With the help of diagrams, briefly explain the three basic logic patterns used in programming methodology. (6 Marks)

Q4) a) Define the following terms
(i)Algorithm (2 marks)e
(ii) Flow chart (2 marks)


b)Write an algorithm to pick the biggest out of four inegral values. (5 marks)

(ii) Draw a flow chat to pick the biggest out of four integral values. (6 marks)


C) Write a C programme for the algorithm mentioned in b(i) above.(6 marks)


Q5) a) How are constants declared in C language? Give an example. (4 marks)

b) Provide the meaning of the following
(i) Stdio.h (2 marks)
(ii) math.h (2 marks)



C) How is One-dimensional array declared in C language? give the general form and an example. (4 marks)

(ii) With the help of one dimensional array, write a C language program for sorting a set of n integrals values in ascending order. (8 marks)


*END*










More Question Papers


Popular Exams


Mid Term Exams

End Term 1 Exams

End Term 3 Exams

Opener Exams

Full Set Exams



Return to Question Papers