Docsity

Annual Interest Rate - Software Development - Old Exam, Exams of Software Development Methodologies

Toggle sidebar
bg1
Cork Institute of Technology
Higher Certificate in Science in Computing in Information
Technology Support – Award
(NFQ Level 6)
Summer 2006
Software Development
(Time: 2 ½ Hours)
Instructions: Examiner: Ms Gemma O’Callaghan
Answer questions 1 and any two others. Mr. James Greenslade
Question 1 is compulsory. Mr. John Walsh
Question 1: (50 marks)
(a) What is the output from the following program?
#include<iostream>
using namespace std;
int function1(double &number, int rep);
int main()
{
double num1, num2;
int num3;
num1 = 4.0;
num3 = 2;
cout<<"function1: "<<function1(num1,num3)<<endl;
cout<<"num1 :"<<num1<<endl;
num2 = 11.0;
cout<<"function1 again: "<<function1(num2,5)<<endl;
cout<<"num2: "<<num2<<endl;
return 0;
}
int function1(double &number, int rep)
{
int count = 0;
do
{
number = number +1.1;
pf3
pf4

Partial preview of the text

Download Annual Interest Rate - Software Development - Old Exam and more Exams Software Development Methodologies in PDF only on Docsity!

Cork Institute of Technology

Higher Certificate in Science in Computing in Information

Technology Support – Award

(NFQ Level 6)

Summer 2006

Software Development

(Time: 2 ½ Hours)

Instructions: Examiner: Ms Gemma O’Callaghan Answer questions 1 and any two others. Mr. James Greenslade Question 1 is compulsory. Mr. John Walsh

Question 1: (50 marks)

(a) What is the output from the following program? #include using namespace std;

int function1(double &number, int rep);

int main() { double num1, num2; int num3;

num1 = 4.0; num3 = 2;

cout<<"function1: "<<function1(num1,num3)<<endl; cout<<"num1 :"<<num1<<endl; num2 = 11.0; cout<<"function1 again: "<<function1(num2,5)<<endl; cout<<"num2: "<<num2<<endl;

return 0; }

int function1(double &number, int rep) { int count = 0; do { number = number +1.1;

rep--; count++; }while(rep > 0);

return count; } (6 marks)

(b) Create a class called SavingsAccount. Use a static class variable to hold the annualInterestRate for all account holders. Each object of the class contains the following data members, an account number and a savings balance which indicates the total amount that is currently in the account. Provide a method calculateMonthlyInterest() which will calculate the monthly interest by multiplying the savings balance by the annualInterestRate divided by 12.Provide a constructor method that allows an object of this class to be initialised when it is declared. (10 marks)

(c) Write a statement to declare a file pointer called output. Write a statement to open the file “Essay.txt” that is associated with the file pointer for reading. Write a statement to close the file pointer when you are finished with it. (6 marks)

(d) Write C++ code to read from the file “Essay.txt” that you opened above and count the number of vowels in the file. (6 marks)

(e) Write the C++ code to display the following pattern.









**

(6 marks)

(f) Write a C++ function that takes an integer value and returns the number with its digits reversed. For example, given the number 7631, the function should return 1367. (6 marks)

(g) Write a structure template for a student record consisting of their student number, their first name, their surname and also an array to hold the results of their six final exams. Write statements to input values from the keyboard for each member of the student record. (10 marks)

Hint:- Use C++ strings to hold the employee names. (8 marks)

Question 4: (25 marks) (a) Explain the differences between arrays and linked lists. (4 marks)

(b) Show how to define the structures used to be able to create a linked list of characters. (5 marks)

(c) Write the C++ code needed to create a linked list of characters that is made up of three nodes. head -> C -> + -> + -> NULL (10 marks)

(d) Write a function to add an element to the front of a linked list of characters. (6 marks)