Introduction to Computer Programming (C Programming) (GSDR2222)

Higher Institute of Transport and Logistics (HITL)

Semester: Second Semester

Level: 200

Year: 2018

School/Faculty: HITL DEPARTMENT: General Studies LECTURER(S): Dr. Onabit/Mr. Mbiethieu
Level: 200 SEMESTER: Second Academic Year: 2017/2018
COURSE CODE: GSDR 2222 COURSE TITLE: Introduction to Programming (C Programming)
DATE: 21/07/2018 HALL: Amphi 300 TIME: 2hrs (10:30 – 12:30)
Instructions: Answer all questions.
THE UNIVERSITY OF BAMENDA
P.O BOX 39 Bambili
REPUBLIC OF CAMEROON
Peace-Work-Fatherland
0 .
. 17 0
r.
Exercise 1: 10 marks
Explain the following: program, programming, programming language,
instructions, source code.
Exercise 2: 10 marks
Give the syntax of a function, then write a function which takes an interger as
parameter and return ‘Y’ if the number is ODD and ‘N’ if not
Exercise 3: 20 marks
A. Declare an array and store the following elements
10 25 4 48
B. Write a loop to display the elements of the array above
C. Write a program to sum and make the average of the elements of a given
array size n
Exercise 4: 25 marks
a) Fill the table below with the values of each variable after each interation
Int I, a=50, b=10, c=0, n=5;
For (I = 0; I<n ; I ++) {
a= a – i;
i= i + 1;
b+=i;
c= i/2;
}
b) Rewrite the above code using the while loop
www.schoolfaqs.net