LYCEE DE RUHENGERI APICUR
TSS
MODULE DETAIL TRAINEE’S DETAIL
SECTOR: ICT TRAINEE’S
NAME
SUB-SECTOR: CSA TRAINER’S NIYGUSHIMWA ISAAC
NAME:
CERTIFICATE: CERTIFICATE 4 REQF LEVEL: 4
MODULE (CODE C PROGRAM ADDITIONAL INFORMATION
& NAME): DURATION:
DATE: 20 FEB 2026
COMPETENCE DECISION COMPETENT NOT YET
COMPETENT
MID-TERM EXAM
Section A: Multiple Choice Questions (MCQs) – 20 Marks
Choose the correct option for each question. Each question carries 2 marks.
1. Which of the following is the correct syntax to declare an integer
variable in C?
a) int x;
b) integer x;
c) num x;
d) var x;
2. What is the output of the following code?
int x = 5;
printf("%d", x++);
a) 4
b) 5
c) 6
d) Error
3. Which loop executes at least once even if the condition is false?
a) for
b) while
c) do-while
d) if
4. Which of the following is not a valid data type in C?
a) int
b) float
c) string
d) double
5. What does the % operator do in C?
a) Divides two numbers
b) Returns the remainder after division
c) Multiplies two numbers
d) Adds two numbers
6. What is the correct way to declare a function that returns an integer?
a) function int myFunc()
b) int myFunc()
c) int: myFunc()
d) myFunc() int
7. Which of the following is true about pointers?
a) They store values directly
b) They store memory addresses
c) They store functions
d) None of the above
8. What will be the output of this logical expression?
int a = 1, b = 0;
printf("%d", a && b);
a) 0
b) 1
c) True
d) False
9. Which of these is used to include standard input/output
functions in a C program?
a) #include <stdio.h>
b) #import <stdio>
c) #include <stdlib.h>
d) #use <stdio.h>
10. Which of the following loops is preferred when the number of
iterations is known beforehand?
a) while
b) do-while
c) for
d) if
11. What is the correct way to declare a character variable in C?
a) char c = 'A';
b) character c = "A";
c) char c = "A";
d) char c = A;
12. Which operator is used to access the value stored at a
pointer?
a) &
b) *
c) ->
d) %
13. Which of the following is true about arrays in C?
a) Arrays can store different data types in the same array
b) Arrays are stored in contiguous memory locations
c) Arrays can grow dynamically in C
d) Arrays don’t use indices
14. What will be the output of the following program snippet?
int x = 10, y = 20;
printf("%d", x > y ? x : y);
a) 10
b) 20
c) True
d) False
15. Which of the following keywords is used to exit a loop
immediately?
a) continue
b) exit
c) break
d) stop
16. What is the correct way to define a function that takes two
integers and returns their sum?
a) int sum(int a, int b) { return a+b; }
b) function sum(int a, int b) { return a+b; }
c) int sum(a, b) { return a+b; }
d) int sum(int a; int b) { return a+b; }
17. Which of the following logical operators returns true only if
both operands are true?
a) ||
b) &&
c) !
d) ==
18. Which operator is used to get the address of a variable?
a) *
b) &
c) ->
d) %
19. Which of the following is not part of C program structure?
a) Preprocessor directives
b) main() function
c) Global variables
d) Constructor
20. What is the output of this program?
int a = 5, b = 2;
printf("%d", a / b);
a) 2.5
b) 2
c) 3
d) Error
Section B: Short Answer & Practical (30 Marks)
1. a. Write the basic structure of a C program
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………….
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………….
………………………………………………………………………………………….
b. Explain the difference between if-else and switch-case
statements with examples.
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………….
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………….
2. Write a C program to check if a number entered by the user is even or
odd.
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………….
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………….
………………………………………………………………………………………….
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………….
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………….
………………………………………………………………………………………….
3. Explain what a pointer is in C and give a short example of using a
pointer to print the value of a variable.
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………….
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………….
………………………………………………………………………………………….
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………….
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………….
………………………………………………………………………………………….
Section c:open ended question
The following C program contains multiple errors, including syntax, logical,
and runtime errors. Your task is to carefully analyze the program, identify all
errors, explain the type of each error, and suggest the correct version.
#include <stdio.h>
int main() {
int numbers[5], i, sum;
sum = 0
printf("Enter 5 numbers: ");
for(i = 1; i <= 5; i++) {
scanf("%d", numbers[i]);
sum = sum + numbers[i];
printf("The average is %d\n", sum/5);
if(sum = 0) {
printf("Sum is zero\n");
}
return 0}