



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Information about an exam for the module data programming fundamentals at cork institute of technology. The exam is part of various programs, including bachelor of science in computing, bachelor of science (honours) in software development, and higher certificate in science in computing in information technology support. Instructions for the exam, duration, sitting, requirements, and questions. The questions cover topics such as functions, arrays, static and dynamic arrays, pointers, and binary files.
Typology: Exams
1 / 7
This page cannot be seen from the preview
Don't miss anything!




Autumn Examinations 2009/
Module Code: SOFT
School: Maths and Computing
Programme Title: Bachelor of Science in Computing – Year 2
Bachelor of Science (Honours) in Software Development - Year 2
Higher Certificate in Science in Computing in Information Technology Support – Year 2
Programme Code: KCOMP_7_Y KSDEV_8_Y KITSU_6_Y
External Examiner(s): Mr. Peter Given Internal Examiner(s): Ms. Gemma McSweeney
Instructions: Answer Q1 and TWO other questions
Duration: 2 hours
Sitting: Autumn 2010
Requirements for this examination: None
Note to Candidates: Please check the Programme Title and the Module Title to ensure that you have received the correct examination paper. If in doubt please contact an Invigilator.
Question 1 is compulsory
Part A
(a) What is the purpose of the following functions
(i) substr function 2 (ii) at function 2
(b) give an example of what functions in (a) are used for. 2
Part A 6 marks
Part B
(a) Write a program to find the (i) the protocol (ii) the filename from a URL which is in the format protocol:/ /address / filename
The program should take in a URL
pass the string to a function called getProtocol passing back the protocol using passing by reference The URL is passed to a function getFilename passing back the filename using passing by reference
The main program should print out the protocol and the filename respectively
Part B 34 marks
Question 1 40 marks
Question 3
A system is set up to hold information on student details. It should hold the following data:
Student Number, name, address, date of registration, course title.
(a) Set up the struct of type date. 1
(b) Set up a type definition for struct of type date 1
(c) Set up the composite struct student 4
(d) Set up an array of students at run time holding numStudents
number of students 5
(e) Write a function enterStudents to enter the details for the numStudents set
of students 7 Only show how to input: Student Number, course title and the month of the date of registration.
(f) Show how to call the function enterStudents in Part (e) in the
main program. 2
(g) If you were to include the modules names and marks for each module within the
details of each student, list 2 different ways how you could store this information as a part of the student struct What additional features would you include in both cases in your student struct
Question 3 30 marks
Question 4
Pointers & 2 D arrays a) A reference variable passed as a parameter to a function acts as a pointer. What does this mean? 1
(b) What is indirection? The following code uses indirection, explain what is happening in the code int * xptr, x=5,y; xptr = &x; y = *xptr; 3 (c) Dynamic arrays are created by using pointers. Give an example of how they are passed to functions using pointers and how they are used in the main program to call the array 3
(d) With reference to Question 3 student struct, (i) Write code to read the details student number, course title and the day of date of registration into a single struct using pointers. Include how to pass this struct in the main. (ii) Write a function to print out the details of the student struct used in Q4(d)(i) 11
(e) Write a function called findAverage which uses pointers to find the average of 3 float values. Include in the main program how to enter the values, call the function findAverage and output the average. 5 Part A 23 marks
Question 5 Files Part A
(a) What is a binary file? 1 (b) What library is used to handle strings for holding them as binary records 1 (c) How are records stored in a sequential file? 2 (d) How do you set up fixed length records to be used in binary files 1 (e) How do you read in a string from the keyboard? 1 (f) How are records stored in a random access file? 2 (g) Explain what happens when you read a record from a sequential file making reference to the read command 2
Part A 10 marks Part B (a) Set up account details for customers which include the following: Customer name, customer address, customer telephone number and date of registration 6
(b) Set up each record and store the information in Part B (i) in a binary sequential file dependant on the number of customers. Only details of the customer name, and day of date of registration are required to be entered. 12
(c) A customer wishes to close all his/her business with the given bank. Explain how you would delete this customer from the binary sequential file set up in Part B (b). 2
Part B =>20 marks
Question 5 30 marks