Cit 2112 – Introduction to Programming 1
Cit 2112 – Introduction to Programming 1
a) A student created the following C program during a practical lesson. Use it to answer the
question that follows
#include<stdio.h>
int main()
{
int num1, num2;
num1=25;
a) Write the function of each of the following escape sequences in C programming language.
5 marks
i. \t
ii. \v
iii. \n
iv. \”
v. \0
b) Explain the term parameter passing as used in programming 2 marks
c) Explain two similarities between third and fourth generations programming languages 4 marks
d) Explain two differences between sequential and random file as used in programming 4 marks
a) Write a C program that could be used to generate the following output 5 marks
10 15 20
10 15
10
b) Distinguish between strlen() and strcpy() functions as used in C programming language 4 marks
c) The following types of errors were identified by a student while executing a programming they
had written in a structured programming language:
i. A non-terminating loop
ii. Erroneous result
iii. The program terminating prematurely
Explain the type of error that could have led to each of these observations. 6 marks