Data Structure and Graph Theory (CSCT5204)
Computer Science - COS
Semester: Resit
Level:
Year: 2017
Page 1 of 2
SCHOOL: H.T.T.T.C DEPARTEMENT: CS LECTURER(S): Mr. DIFOUO JEAN PATRICE
COURSE CODE: COURSE TITLE: ADVANCED DATA STRUCTURES OPTIONS: ICT/FCS 500
DATE: HALL: …….. TIME: 2 Hrs NATURE: RESIT EXAM
INSTRUCTION: Answer all these questions.
Problem statement:
For the end of their program in HTTTC BAMBILI, five (5) ICT5 or FCS500 students are going to write
their end of course examination in three papers listed below with their various coefficients:
PAPER_CODE NAME CV
1 DATA STRUCTURES 4
2 C PROGRAMMING 3
3 ALGORITHMS 2
Where each paper is written on 20.
You wish to write a C program to manage that exam. The whole process is divided into five phases.
1. The registration phase where all the students are going to be registered in that examination
management software each providing his names with maximum 30 characters and his registration
number RegNum which is an integer.
2. The mark recording phase where the marks scored by the students are entered into the software on
20
3. The averages computation phase where the software then computes the average of each student
4. The ranking phase where the software then ranks the students based on their averages from the
highest to the lowest
5. The result publishing phase where the software publishes the result
Questions A: Design of data structures to solve the problem 20mks
1. Declare a data type named paper knowing the each paper has a code which is an integer, a
name which is a string of characters and a coefficient which is an integer 6 mks
2. Declare a variable papers_list to be used to store all the three papers(1, 2 and 3) 4 mks
3. Declare the data type student containing: all the information(RegNum, names, sex) on a student, a
field named marks which is an array of three numbers representing the marks on 20 scored by the student
on paper1, paper2 and paper3 respectively and a field average that will store his or her average on 20
6mks
4. Declare a variable students_ list where all the students will be stored 4mk
REPUBLIC OF CAMEROON
Peace – Work – Fatherland
***********
THE UNIVERSITY OF BAMENDA
***********
HIGHER TECHNICAL TEACHER TRAINING
COLLEGE (H.T.T.T.C.) BAMBILI
***********
DIRECTORATE OF STUDIES
**********
P.O.BOX 39 BAMBILI
REPUBLIQUE DU CAMEROON
Paix – Travail - Patrie
***********
UNIVERSITE DE BAMENDA
***********
ECOLE NORMALE SUPERIEURE
D’ENSEIGNEMENT TECHNIQUE
***********
DIRECTION DES ETUDES
**********
Tél: 33 05 10 69
www.schoolfaqs.net
Page 2 of 2
Questions B: Manipulation of the various data structures 50 mks
1. Write the function void init_papers(paper plist[ ]) that initializes the papers in the array plist by
setting for each paper its code, its name and its coefficient. NB the C function strcpy(char* dest, const
char* src) can be used to assign strings 6mks
2. Write the function void registration (student slist[ ]) that reads the names and sex of each student
and stores in the array slist. NB: the registration numbers are assigned automatically from 1 to 5 and
the marks and averages are initialized with zero. 6mks
3. Write the function void record_marks(student slist[ ]) that records the marks of the students. NB:
slist is the array of students 6mks
4. Knowing that all the students are registered and their marks recorded, write the function
void average_computation_ process(student slist[ ], paper plist[ ] ) that computes the average of each
student and stores in the appropriate field 6mks
5. Write a function void print_students(student slist[ ]) that prints all the information on students,
their marks and averages. 6mks
the output is given below
RegNum Names sex Paper 1 Paper 2 Paper 3 average
1
NJI PAUL
M 11 10 12 10.89
2
NGWA NELSON
M 15 13 10 13.22
3
NGUM CHANTAL
F 10 16 13 12.67
4
PENN RAOUL
M 14 12 13 13.11
5
NUSA SULE
M 13 11 12 12.11
6. At this stage, which sorting techniques is suitable to search for the student who scored 13.11 as
average? Why? 4mks
7. The students are ranked based on their averages in descending order.
a) State the principle of one well known sorting algorithm that can be used to sort students’ averages
6mks
b) Use that principle step by step showing the state of the list after each round 6Mks
8. At this stage, which sorting techniques is suitable to search for the student who scored13.11 as
average? Why? 4mks
www.schoolfaqs.net