



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
The exam questions for the data programming fundamentals module of the higher certificate in computing, bachelor of science in computing, and bachelor of science (honours) in software development programs at the cork institute of technology. The exam covers topics such as setting up dynamic arrays, functions, strings, pointers, and random access files.
Typology: Exams
1 / 7
This page cannot be seen from the preview
Don't miss anything!




Semester 1 Examinations 2011/
Module Code: SOFT 6011
School: Science and Informatics
Programme Title(s):
Higher Certificate in Computing (Evening) – Year 2 Bachelor of Science in Computing – Year 2 Bachelor of Science (Honours) in Software Development – Year 2
Programmes Code(s):
External Examiner(s): Mr Peter Given
Internal Examiner(s): Ms Gemma McSweeney Mr Tadhg Leane
Instructions: Answer Question 1 (compulsory) and TWO other questions of yourchoice
Duration: 2 Hours
Sitting: Semester 1 2011/
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. If in doubt please contact an Invigilator.
Q1 Part A Write sections of a program: (1) to set up a dynamic array of strings to hold modules names delivered by a given of course. 3
(2) to set up a dynamic array of marks for the modules delivered in (Q1 (1) ) 3
(3) to include a function called readInNamesAndModules to read in the module name and marks with reference to the module array and mark array set up in (Q1(1) & Q1(2) ) 7
(4) to include a function findGPA to find the grade point average from the mark array details read in Q1(3). The function GPA which should be returned by reference. 5
(5) to include a function PassOrFail which decides whether a person has passed or failed. If a person gets a gpa < 40, then they have failed otherwise they have passed. Return a string representing pass or fail from the function using pass by value. 7
(6) to include a function findCredits which returns the credits based on the number of gpa. A 100% gpa gives 30 credits. Pass the value by reference for the number of credits back from the function 3
Part A 28 Marks
Q2 Part A
i) Identify the error in the following code and provide an alternative correct solution:
int main() { char str1[] = "Hello"; char str2[] = "Hello"; if(str1 == str2) cout << "Equal"; else cout << "Unequal"; 5 return 0; }
ii) Explain the difference between String and C string 3
Part A 8 Marks Q2 Part B Write a program that takes nouns and forms their plurals on the basis of these rules: a. If noun ends in “y,” remove the “y” and add “ies.” b. If noun ends in “s,” “ch,” or “sh,” add “es.” c. In all other cases, just add “s.”
In the program you must prompt for and read the input string. You must find the plural and then must print the input string and its plural out to the screen.
You can use the following data to test your code: Chair dairy boss circus fly dog church clue dish
Part B 22 Marks
Question 2 Total 30 Marks
Q3 Part A
i) Explain why, when declaring and working with pointers, it is essential to know the type of data that is being pointed to.
ii) What purpose does the de-reference operator (*) serve in C++?
iii) Assume the variable declarations:
int Foo = 0; int *ptr = &Foo; Identify all of the following statements which will change the value of Foo to Foo * 2 -note there may be more than one correct choice:
iv) If a variable is a pointer to a structure, then which of the following operators is used to access data members of the structure through the pointer variable?
v) Briefly explain one benefit that can be gained from using pointers.
Part A 10 Marks (2 marks each)
Q3 Part B
What is the outcome of the execution of the following C++ program (explain the reason for your answer).
int main () { int firstvalue, secondvalue; int * mypointer; mypointer = &firstvalue; *mypointer = 10; mypointer = &secondvalue; *mypointer = 20; cout << “firstvalue is “ << firstvalue << endl; cout << “secondvalue is “ << secondvalue << endl; return 0; }
Part B 5 Marks
2 Explain how to set up random access files, including setting up a blank file inserting an additional record deleting a record 9
3 Set up a student record that can be used in binary files. Details included student name, identity number, address, course. Why have you chosen the given library? 4
Question 4 Total 30 Marks