FINAL EXAMINATION
SCHOOL OF COMPUTING AND SCIENCES
DEPARTMENT: SOFTWARE ENGINEERING
MODULE CODE AND TITLE
CSC2403 Semester 4
STRUCTURED PROGRAMMING
DATE: /5/2024 TIME AND SESSION:
DURATION: 3 HOURS TOTAL MARKS: 70
EXAMINER/LECTURER: BAHATI DAVID MODERATOR(S):
INSTRUCTIONS TO THE CANDIDATE
1. Questions must be attempted in the answer booklet provided
2. All queries should be directed to the invigilator; do not communicate or attempt
to communicate with any other candidate
3. You have TWO HOURS to complete this paper. You are not allowed to leave the
examination room within the first hour and in the last 15 minutes of this
examination.
4. This is a CLOSED BOOK examination.
5. SECTION D and C are Compulsory and choose any 5 other questions in Section
A and 5 other Questions in Section B
6. Please, do not write on the question paper
SECTION A : III Array and Strings
1 Write a C program to find the transpose of a given matrix
2 Write a C program that accepts (3×3 ordered matrices A and B),and compute the following
(i)summation of Two numbers (ii) Subtraction of Two numbers
3 Write a C program to find the sum and average of n integer numbers
4 Write a C program to find the largest element in an array
Write a C program to find the greatest number from two dimensional array
5 Write a C program to sort the elements by passing array as function argument
6 Define string. How string is declared and initialized ? Explain string input/output functions with an
example
7 What is string ? Write a C program that reads a sentence and prints the frequency of each of the
vowels and total count of consonants?
8 Write a C program to eliminate multiple spaces from a sentence and make it single
SECTION B : Functions & Recursion
9 Write a program to find GCD and LCM of two numbers using concept of functions
10 Write a C program to compute polynomial co-efficient nCr using recursion
Write a C program for evaluating the binomial coefficients using a function factorial(n)
Write a C program to find the binomial co-efficient a number using recursion
11 Write a C recursive function for multiplying two integers where a function call is passed with two integers m
and n
12 Write a C program to check a number is a prime or not using recursion
13 Write a C program to find the factorial of a number using recursion
14 Explain recursion. and write a program to find nth term of Fibonacci series
15 Write a C program to calculate the Fibonacci sequence using recursion functions
Write a c-program using functions to generate the Fibonacci series.
16 What is recursion? Explain. Write a c-program using recursive function for Binary to Decimal Conversion.
SECTION C: POINTERS
17 What is a pointer? Write a C program to find the sum and mean of all elements in an array using pointer
18 Write a C program to swap two numbers using call by address(pointers or reference) method
19 Write a C program using pointers to compute the Sum, Mean and Standard deviation of all elements
stored in an array of „n‟ real numbers
20 What is pointer? give the advantages and disadvantages of pointer data type
SECTION D
1) 26. What will be output of the following code or find errors if present in the code
Correct it
2) We suppose the parliament want to elect the law, having n parliamentary
having the menu: If they press on 1 you Accept the law, if they press on 0 they
refuse the law and if you press on any other key you abstract the law; write a c
code which will manage that vote and give the result of the election if the law is
passing by how many voices or not passing by how many voices or abstract they
start vote and each parliamentary number should know and did he elect