Exam Questions: Data Programming Fundamentals, Autumn 2011/12, Exams of Computer Fundamentals

Exam questions for the data programming fundamentals module (soft 6011) in the science and informatics school at cork institute of technology. The exam covers topics such as dynamic arrays, strings, pointers, and file handling. Students are required to answer questions related to setting up dynamic arrays, identifying errors in code, writing functions, and understanding memory concepts. The exam consists of four questions, each worth different marks.

Typology: Exams

2012/2013

Uploaded on 03/28/2013

mahmud
mahmud 🇮🇳

4.6

(8)

48 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Page 1 of 7
CORK INSTITUTE OF TECHNOLOGY
INSTITIÚID TEICNEOLAÍOCHTA CHORCAÍ
Autumn Examinations 2011/12
Module Title: Data Programming Fundamentals
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):
KCOMP_7_Y2
KSDEV_8_Y2
KCOME_6_Y2
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 your
choice
Duration:
2 Hours
Sitting:
Autumn 2011/12
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.
pf3
pf4
pf5

Partial preview of the text

Download Exam Questions: Data Programming Fundamentals, Autumn 2011/12 and more Exams Computer Fundamentals in PDF only on Docsity!

CORK INSTITUTE OF TECHNOLOGY

INSTITIÚID TEICNEOLAÍOCHTA CHORCAÍ

Autumn Examinations 2011/

Module Title: Data Programming Fundamentals

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):

KCOMP_7_Y

KSDEV_8_Y

KCOME_6_Y

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: Autumn 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.

Question 1

Q1 Part A

Write sections of a program

(1) to set up a dynamic array of strings to hold student names doing a certain course. 4 (2) to set up a dynamic array of student identity numbers for the corresponding student names delivered in (Q1 section A (1) ) 4

(3) to include a function called readInStudentName s to read a set of student names using the array set up in (Q1 section A (1) ) 5

(4) to include a function readInStudentIDNumbers to read in a set of student identity numbers referring to the array set up in (Q1 section A (2)). 4

(5) to include a function to printOutStudentNameAnd StudentIdNumber to write out all students details for those present in the arrays set up in Q1( section A (1) & (2)) 5

Part A 22 Marks

Q1 Part B

  1. Use the details from (Q1 Section A (1) ) to call the function readInStudentNames in (Q1 Section A (3) ). 3
  2. Use the details in Q1 (Section A (2) ) to call the function in readInStudentIdNumbers as listed in Q1( section A (4) ). 3 3. Print out the student details: name followed by student Id Number calling function printOutStudentNameAnd StudentIDNumber in (Q1 section A (5)) 4

Part B 10 Marks

Question 2 – Strings

Q2 Part A

i) Identify the error in the following code and provide and alternative correct solution:

int main() { char str1[] = "Hello"; char str2 [5]; str2 = str1; cout << str2; return 0; 5 }

ii) What is the outcome of the following code

char name[50]=”John”; char surname[50]=”Smith”; strcat (name, surname); strcat (surname, name); cout << name << endl; cout << surname << endl; 5

Part A 10 Marks

Q2 Part B

Write a program which detects whether a string is a palindrome or not. A palindrome is a word which is unchanged when the order of the letters is reversed. For example:

navan is a palindrome because the reverse is also navan

kayak is a palindrome because the reverse is also kayak

The program should prompt for a read a string input by the user. The program should then detect if this string is a palindrome or not.

Part B 20 Marks

Question 2 Total 30 Marks

Question 3 – Pointers

Q3 Part A

i) What does the reference operator (&) in C++ do?

ii) When using a pointer to reference a C++ data structure (struct) what operator do you use to access the members of the struct?

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 1 -note there may be more than one correct choice:

  1. ptr++; 3) (*Foo)++;

  2. Foo++; 4) (*ptr)++;

iv) If a variable is a pointer to an integer, then which of the following operators is used to access the integer value pointed to by the memory address stored in the pointer?

  1. ‘.’ 3) ‘*’

  2. ‘&’ 4) ‘->’

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 executing the following code:

int main () { char ac[] = {'c', 'h','a','r','\0'}; char * str = ac; cout << *str; char c = str[3]; cout << c; str[1]= ‘l’; ac[3]=’p’; cout << ac; return 0;

}

Part B 5 marks

Question 4 - Random Access and Sequential Files

  1. what is a binary file? Give an example! 4
  2. what does fixed length record mean? 2
  3. Create a fixed length for a student holding student number, name, address & phone number and date of registration. 7
  4. Are cstring or string libraries used to set up fixed length strings? What is the advantage to for setting up fixed length records? Explain the advantage to the type of library for setting up random access files 7
  5. Explain how to set up random access files, including  setting up a blank file  inserting an additional record  deleting a record 10

Question 4 Total 30 Marks