Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

C Programming Exam for BSc (Hons) Software Development & Computer Networking - Year 3, Exams of Computer Engineering and Programming

The c programming examination paper for the bsc (hons) software development and computer networking - year 3 program at the cork institute of technology. The exam consists of four questions, covering topics such as linked lists, functions & string manipulation, structs and arrays, and pointers. The first question is compulsory and covers setting up a node for a flight record, reading flight details from a file, booking flights, and deleting flights from the linked list.

Typology: Exams

2012/2013

Uploaded on 03/28/2013

duraid
duraid 🇮🇳

4.3

(3)

75 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CORK INSTITUTE OF TECHNOLOGY
INSTITIÚID TEICNEOLAÍOCHTA CHORCAÍ
Semester 1 Examinations 2012/13
Module Title: C Programming
Module Code: SOFT7019
School: Science & Informatics
Programme Title: BSc (Hons) Software Development and Computer Networking - Year 3
Programme Code: KDNET_8_Y3
External Examiner(s): Ms Erica Gill
Internal Examiner(s): Ms G MacSweeney
Instructions: Answer Question 1 and TWO other questions
Duration: 2 Hours
Sitting: Winter 2012
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 paper.
If in doubt please contact an Invigilator.
pf3
pf4
pf5

Partial preview of the text

Download C Programming Exam for BSc (Hons) Software Development & Computer Networking - Year 3 and more Exams Computer Engineering and Programming in PDF only on Docsity!

CORK INSTITUTE OF TECHNOLOGY

INSTITIÚID TEICNEOLAÍOCHTA CHORCAÍ

Semester 1 Examinations 2012/

Module Title: C Programming

Module Code: SOFT

School: Science & Informatics

Programme Title: BSc (Hons) Software Development and Computer Networking - Year 3

Programme Code: KDNET_8_Y

External Examiner(s): Ms Erica Gill Internal Examiner(s): Ms G MacSweeney

Instructions: Answer Question 1 and TWO other questions

Duration: 2 Hours

Sitting: Winter 2012

Requirements for this examination:

Note to Candidates: the correct examination paper. Please check the Programme Title and the Module Title to ensure that you have received If in doubt please contact an Invigilator.

Question 1 Linked Lists (Compulsory)

(i) Set up a node to hold a flight record of information and a link pointer.

The flight information should include

a flight id, departure airport, destination airport and the total number of seats, the seats

sold, the number of seats sold.

Define the total number of seats as a constant. 4

(ii) Write the main code and functions to

 Set up details of flights are read from the file “Flights.dat”

 each flight has its own unique flight id.

 The flights position is searched against the linked list.

 When the flight is found, it is added to the correct position in the list.

(iii) Write a function and the main to book a flight for a customer. Use the search function

provided in (ii)

 Locate the flight in the list

 Enter the required number of seats

 Check the number of seats sold to date against the total

 Find the number of required seats by the customer

 Decide whether flights can be booked or not and book the flight

(iv) Write all the code to do the following and show how it is used in the main.

A flight is no longer in use.

 Find the node to be deleted using the search function in (ii).

 Delete this flight from the Flight linked List

 Display the contents before and after deletion. State that the record is deleted.

Question 1  40 marks

Question 3 Structs and Arrays

Section A (i) Explain the difference between a static array and a dynamic array 2 (ii) Write two small program using (a) dynamic arrays and (b) static arrays to enter decimal numbers. 6 Point out the main differences between both programs with the respective the arrays (a) and (b) Section A => 8 marks

Section B

Write the following as a program using functions as much as possible

 Set up a structure of Accounts including the account number, the customer name, the address , the date the account was opened and the balance. 7

 Using files, read in the customers accounts to date into a dynamic account array 6  Deposit/ Withdrawal actions: Search for a customer account by entering the account number In the array- the customer account is either present or not. If present make either a deposit / withdrawal. For a withdrawal, ensure there is enough for a balance. Inform the customer otherwise. 9

Section B => 22 marks Question 3 => 30 marks

Question 4 Pointers

Section A (i) What must you do to assign a pointer to a memory address of a variable 2 (ii) How do you access a pointer to each member of a struct 2 (iii) Assuming the variables int y =0 and int *yPtr = &y Which of the following statements set y to 1 (1) yptr++; (2) (y ) ++; (3) y++; (4) (ptr ) ++; 4 (iv) How do you assign a pointer to the first element of an array 2 (v) How many bytes does a pointer move in going to the next position for an array of floats. 2 Section A => 12 marks Section B (i) Create a structure of type student which contains name, age and course. 2 (ii) Write a function to enter details of student as given in (i). Also include how call this function from the main 6

Section B => 8 marks Section C Write a function to swap values using pointer functions Also write the main code for the function Section C =>10marks

Question 4  30 marks in total