Introduction to C Programming Language (CSCT2203)

Computer Science - COS

Semester: Second Semester

Level: 200

Year: 2019

1
REPUBLIC OF CAMEROON THE UNIVERSITY OF BAMENDA
Peace-Work-Fatherland P. O Box 39 Bambili
School/Faculty: HTTTC Department: CS/ICT Lecturer(s): Mr. Mbiethieu Cezar
Level: 200 Semester: Second Academic Year: 2018/20
Course Code: Course Title: Introduction to Programming (C Programming)
Date: Hall: Time: 1:30hrs
Instructions: Answer all questions: Follow the instructions for each question
Exercise l: (15 marks)
a) What C library allows to manage I/O devices?
b) Give the basic C syntax
c) Give the C type which allows to store decimal numbers
d) Which of the C operators is known as a ternary operator? Explain how it is used.
e) Give the syntax of a function declaration in C
Exercise 2: (15 marks)
Write a c program that reads a sequence of positive numbers and stops when it encounters a negative number.
The program will then display the average.
NB, The last negative number entered is not part of the data set. 5mks
Exercise 3:(25 marks)
The Fibonacci series is defined as follow
Fibo(n) =
0 =0
1 =1

1
+ 
2
>1
Write a function which takes as argument a positive integer n and returns Fibo(n) 5mks
Exercise 4: (15 marks) Analyze the following code?
int i, j;
for(i=0;i<10;i++)
{
for(j=0;j<i;j++) {printf(“
*
”);}
printf(“\n ”);
}
a) Give the output of the code. 5mks
b) Rewrite the code using the while loop. 5mks
www.schoolfaqs.net