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

Exam: Computer Science II - Software Development and Computer Networking, Exams of Computer Engineering and Programming

An old exam from the bachelor of science (honours) in software development and computer networking - stage 2 at cork institute of technology. It includes questions on topics such as linked lists, dynamic memory allocation, arrays, pointers, functions, ipc, processes, threads, and sockets.

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
Bachelor of Science (Honours) in Software Development and Computer Networking - Stage 2
(Bachelor of Science in Software Development and Computer Networking - Stage 2)
(NFQ – Level 8)
Summer 2005
Computer Programming II
(Time: 3 Hours)
Instructions
Answer question 1 and any three others
Q1 carries 30 marks, Q2 and Q3 carry 20 marks
each; Q4, 5,6 carry 25 marks each.
Answer Section A and Section B in separate
answerbooks.
Examiners: Dr. D. Chambers
Mr. T. Parslow
Mr. P. O’Connor
Ms. G. MacSweeney
Mr. J. O’Dwyer
Section A
Question 1 (compulsory)
A Explain how Linked Lists use Dynamic Memory Allocation.
What kind of memory is used by arrays in general? [ 2 marks ]
B Data to be stored in a node of a linked list should include the following
student number
student name
student address
telephone number
Course
(i) Explain how to set up a node using the above data [ 3 marks]
(ii) Describe how to represent in memory:
o an empty list
o the end of a link list [ 2 marks ]
(iii) Write the code to search for the position of a node in a list given a student number.
[ 4 marks ]
(iv) Write the code for adding a number of students to a list, one at a time in order of
student number. [ 4 marks ]
pf3
pf4
pf5

Partial preview of the text

Download Exam: Computer Science II - Software Development and Computer Networking and more Exams Computer Engineering and Programming in PDF only on Docsity!

Cork Institute of Technology

Bachelor of Science (Honours) in Software Development and Computer Networking - Stage 2 (Bachelor of Science in Software Development and Computer Networking - Stage 2) (NFQ – Level 8)

Summer 2005

Computer Programming II

(Time: 3 Hours)

Instructions Answer question 1 and any three others Q1 carries 30 marks, Q2 and Q3 carry 20 marks each; Q4, 5,6 carry 25 marks each. Answer Section A and Section B in separate answerbooks.

Examiners: Dr. D. Chambers Mr. T. Parslow Mr. P. O’Connor Ms. G. MacSweeney Mr. J. O’Dwyer

Section A

Question 1 (compulsory)

A Explain how Linked Lists use Dynamic Memory Allocation.

What kind of memory is used by arrays in general? [ 2 marks ]

B Data to be stored in a node of a linked list should include the following

  • student number
  • student name
  • student address
  • telephone number
  • Course

(i) Explain how to set up a node using the above data [ 3 marks]

(ii) Describe how to represent in memory: o an empty list o the end of a link list [ 2 marks ]

(iii) Write the code to search for the position of a node in a list given a student number. [ 4 marks ] (iv) Write the code for adding a number of students to a list, one at a time in order of student number. [ 4 marks ]

(v) Write the code to delete a node from a list given the student number & name. [ 4 marks ] (vi) Using a memory diagram show how to create a node & add it to an empty list. [ 2 marks ] (vii) Using sketched diagram show how to delete: o the first node in the list according to the student number o the last node in the list according to the student number [ 2 marks ]

C Student Table

Student Id Code

Student Name

Address Telephone Course

0000123456 Jane Smith

Midleton, Co.Cork

021 463456 dnet

0012789456 Ann O Brien

Youghal, Co.Cork

024 98845 ccom

0012987899 Bobby Kelly

Cobh, Co.Cork

dcom

(i) Write the code to set up an empty list and then add each of the given Student records to the list [ 4 marks ]

(ii) Write the code to print the details of each of the nodes in the list [ 3 marks ] Question 1 Î 30 marks

Section B

Q4 (a) What is a process? Outline two methods by which processes may be created. Compare and contrast the two approaches. Using C type syntax, write a program that will activate the Unix commands ls, who or exit() using a menu-based selection. (9 marks) (b) What is IPC? Write an account of the shared memory approach to IPC. (6 marks) (c) You are required to set up a message queue that can be shared between many processes. One process will own the queue and take messages from the queue. Many processes will write messages to the queue. The processes will need to share an array of size N that will hold N entries of type MessVar. MessVar will contain the sender_name, the senderID ,time, date and text. The queue is to be arranged in circular order with space N-1 followed by space 0 (use modulo arithmetic). Outline an algorithm for the above scenario. Use C type syntax and ignore any potential synchronisation problems. (10 marks)

Q5.(a) What is a thread? Contrast threads and processes. Distinguish between multiplexed threads and bound threads. Draw a state transition for a multiplexed thread. (8 marks) (b) Outline the problem that may arise due to the concurrent execution of threads. Outline any two methods that might be used to solve the problem. (8 marks) (c) You are required to set up a student accommodation server. The server must be capable of handling multiple concurrent connections and so is to be thread based. A student may advertise available accommodation by sending the required details to the server. To add an entry to the available accommodation the student must send – Name, Location, room type, gender preferred, cost, phone, email to the server. The information is now available for all to see by requesting a list of available rooms. If a student sees a room s/he is interested in he may attempt to book the room. If the booking request is successful, the room must be removed from available list to avoid double bookings. What concurrency problems, if any, could arise in the above scenario? Sketch a solution for the server using C type syntax. Ignore communications details. (10 marks)

Q6.(a) What is a socket? Describe the address structure used by an Internet type socket Explain how a server name can be resolved to an IP address. Outline the code that would allow a client program to enter the server name as a command line argument. E.G. whois cromlech , where cromlech is the Unix server. (8 marks) (b) Outline the steps needed to set-up a client–server application using connection–oriented sockets. You are required to set-up a server that will allow job vacancies to be advertised on the Internet. For each job the server will contain – jobreference, job title, specialty, base qualification, date to apply, email. A client may request a list of all jobs, a list of jobs by title or by specialty. In each case the server will provide an appropriate list or an error reply in case of error. A client may request greater detail on any specific job and if the server has same it will send it to the client otherwise it will send an error message. The client may terminate the dialogue at any point. The server must be capable of multiple concurrent connections. Sketch the application level protocol for the above scenario. Sketch a solution to the above problem using connection oriented sockets. (12 marks) (c) With the advent of the wireless age, IP based sockets are old and obsolete technology. Discuss. (5 marks)