



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
Instructions and questions for the data programming fundamentals exam held at cork institute of technology in autumn 2010/11. The exam covers topics such as entering dimensions of a room, calculating room area, pass by reference, string manipulation, pointers, and file processing.
Typology: Exams
1 / 7
This page cannot be seen from the preview
Don't miss anything!




Autumn Examinations 2010/
Module Code: SOFT 6011
School: Mathematics & Computing
Programme Title: Bachelor of Science in Computing – Year 2 Higher Certificate in Computing – Year 2 Bachelor of Science (Honours) in Software Development – Year 2
Programme Code: KCOMP_7_Y KCOME_6_Y KSDEV_8_Y
External Examiner(s): Mr. Peter Given Internal Examiner(s): Ms. G. McSweeney
Instructions: Answer Q1 and two other questions.
Duration: 2 Hours
Sitting: Autumn 2010/
Requirements for this examination:
Note to Candidates: Please check the Programme Title and the Module Title to ensure that you have received the correct examination. If in doubt please contact an Invigilator.
Question 1
Section A You are required to write parts of a program which does the following
Find the number of rolls of wallpaper required to fit a room with dimensions length by width by height
(i ) Using reference variables write a function called enterDimensions to enter the length, width and height of the room returning these values to the main program 3
(ii) Write a function called calcRoomAreaWithoutDoornWindow t hat takes in the room length, width and height and calculates the area of the room and returns the area as a reference variable There is one door in the room with the dimensions :( width 1.5 m and length 3.5 m ) There is one window with the dimensions ( width 2.5 m and length 2.25 m) 5
(iii)Write a function called findAreaOfRoll which passes the length of each roll from the main program. The width of roll is standard 2.25m Calculate the area of the roll. This function uses pass by value to return the area of the roll
4 main program (iv ) Write the main program section to carry out (i) to (iii) above, including all the declarations and function calls 8
Section A ==> 20 marks
Question 2 String Manipulation
Section A
(i) What is the difference between reading in a string variable and a cstring variable? 2 (ii) Show how you would declare name as a string name as a cstring 2 (iii) How would you find the length of (a) a string (b) a cstring 2
(iv) How do you copy str2 to str1 1
(v) How do you concatenate 2 strings str2 onto the end of str1 1
Section A ==> 8 marks
Section B
Write a program which prints out text entered in the format below.
Note: Ask the user for any number of starting characters surrounding the text. This program should be written using strings
Include the following functions a function called readToSurroundText which reads in the number of characters for each side of the centre line passing by reference a function called createLine to create the text for either the top or lower line a function called createInnerLine with the required number of characters on each side of the text
Write the main part of the code to use these functions
Section B ==> 22 marks
Question 2 ==> 30 marks
Question 4 files
(i) Compare how a sequential file with a random access file are used in file processing. 2 marks (ii) Assume each course has the same number of modules from year to year and term to term. Assume there is a max of 2000 students. Assume there are a total of 50 courses. Assume that can be 4 to 6 modules delivered per semester. There are 2 semesters per term and 4 years in total.
Set up a system to hold courses and students taught and modules delivered within.
Details held on courses include course reference number, course title , Modules taught each semester including Module Id, Module name, lecturer delivering the course and Semester delivered. Students taking the course include registration number, name and address and registrationDate.
Assume that can be 4 to 6 modules delivered per semester. There are 2 semesters per term and 4 years in total. 9 marks
(iii) Set up a function referencing Q4(iii) to do the following
(a) initialise the random access file called courses.txt (b) enter a number of course records to the random access file: enterRecords (c) delete one course from the file : deleteOneCourse
19 marks
Question 4 ==> total 30 marks