



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
Main points of this past exam are: Memory Diagram, Dimensions, Function Calls, Reference Means, Function Call, Local Variables, Float Farray, Wallpaper Required, Height, Reference Variables
Typology: Exams
1 / 7
This page cannot be seen from the preview
Don't miss anything!




Semester 1 Examinations 2010/
Module Code: SOFT 60011
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: Winter-Spring 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 input the length, width and height of the room returning these values to the main program 3
(ii) Write a function called calcRoomArea 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 Do not include area for any windows or doors in your calculations 3
(iii)Write a function called findAreaOfRoll which passes the length and width of roll and calculates the area. This function uses pass by value
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 ==> 18 marks
p.t.o. for rest of question 1
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 compare two strings: str1 and str2 where str1 is less than str 1
(v) How do you compare two cstrings str1 and str2 where str1 is greater than str 1 Section A ==> 8 marks p.t.o. for remainder of Q
Question 2 continued
Section B
Write a program which prints out text entered in the format below.
**Format 1
**** Some Text ****
Note: The ‘*’ character can be any character entered e.g. &, $, + etc Ask the user for any number of starting characters surrounding the text. In the case shown there is 4. This program should be written using cstrings.
Include the following functions a function called readCharacter which reads in the required character from the keyboard and passes it back by reference 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
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