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

Stage 3 Exam Questions for BSc (Hons) in Software Development and Computer Networking, Exams of Computer Engineering and Programming

The instructions and questions for an exam in the bachelor of science (honours) in software development and computer networking – stage 3 program at cork institute of technology. The exam covers topics such as pipe usage, network daemons, rpc, shared memory, and sockets. Students are required to answer five questions, each carrying equal marks.

Typology: Exams

2012/2013

Uploaded on 03/28/2013

duraid
duraid 🇮🇳

4.3

(3)

75 documents

1 / 4

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 3
(Bachelor of Science in Software Development and Computer Networking – Stage 3)
(NFQ – Level 8)
Autumn 2005
PROGRAMMING 3
(Time: 3 Hours)
Instructions
Answer FIVE questions.
All questions carry equal marks.
Method declarations are on the last page
Examiners: Ms. Helen Fagan
Dr. D. Chambers
Mr. P. O’Connor
Mr. E. A. Parslow
Question 1
(a) Write a program to show how a pipe can be used to send a message from a child process to
its parent. The child process should take input from the user and send it to the parent. The
parent process should then print this message. (8 marks)
(b) Explain when you would use the dup system call. (4 marks)
(c) Explain the significance of the return value of the wait and the fork system call. (4 marks)
(d) Write a program that receives and prints a message whenever it receives a
SIGQUIT. (4 marks)
Question 2
(a) What is a network daemon? (2 marks)
(b) Describe the purpose of the super server process inetd on Linux. (4 marks)
(c) Describe the basic architecture of the super server program. (6 marks)
(d) Describe with the aid of an example the format of an entry in the inetd.conf file and the
/etc/services file. (8 marks)
pf3
pf4

Partial preview of the text

Download Stage 3 Exam Questions for BSc (Hons) in 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 3

(Bachelor of Science in Software Development and Computer Networking – Stage 3)

(NFQ – Level 8)

Autumn 2005

PROGRAMMING 3

(Time: 3 Hours)

Instructions Answer FIVE questions. All questions carry equal marks. Method declarations are on the last page

Examiners: Ms. Helen Fagan Dr. D. Chambers Mr. P. O’Connor Mr. E. A. Parslow

Question 1 (a) Write a program to show how a pipe can be used to send a message from a child process to its parent. The child process should take input from the user and send it to the parent. The parent process should then print this message. (8 marks)

(b) Explain when you would use the dup system call. (4 marks)

(c) Explain the significance of the return value of the wait and the fork system call_._ (4 marks)

(d) Write a program that receives and prints a message whenever it receives a SIGQUIT. (4 marks)

Question 2 (a) What is a network daemon? (2 marks)

(b) Describe the purpose of the super server process inetd on Linux. (4 marks)

(c) Describe the basic architecture of the super server program. (6 marks)

(d) Describe with the aid of an example the format of an entry in the inetd.conf file and the /etc/services file. (8 marks)

Question 3

(a) Explain the role of the port mapper in RPC. (4 marks)

(b) Describe with the aid of a diagram the sequence of events that occur from the point where a remote procedure is called until the procedure returns. (6 marks)

(c) Write a file student.x that you would use as a basis for an RPC program. The program should allow a client to:

  • register a students result for a specific subject with the server
  • retrieve a result for a student in a specific subject
  • retrieve a student’s average result for all subjects (10 marks)

Question 4

(a) Write a program that creates a block of shared memory to store an array of 1024 characters. The shared memory block should have permissions (rw-rw-rw-). The agreed key is the filename ‘file.txt’and the letter ‘x’. The program should take a string from the user and write it into the start of the shared memory block. (14 marks) (b) What is the purpose of a semaphore? (2 marks)

(c) What information does the operating system store for each semaphore group created? (4 marks)

Question 5

(a) What information identifies a specific socket? (2 marks)

(b) Write the code for an iterative connectionless server that waits continually for requests from clients. For each request it

  • Prints out the IP address of the client on the server.
  • Sends back the IP address to the client. (12 marks)

(c) Explain the effect of the following system call where socket_fd is a socket file descriptor.

fcntl( socket_fd, F_SETFL, O_NONBLOCK); (6 marks)

Method Declarations

int accept(int sockfd, void *addr, int *addrlen)

int alarm(int seconds) int bind(int sockfd, struct sockaddr *my_addr, int addrlen) int close(int fd) int execlp(const char * file , const char * arg , ...) int execv (const char filename, char const argv [] ) key_t ftok(char filenamae, char c) int fork() int fprintf (FILE stream, char* message); uint16_t htons(uint16_t hostshort ); char inet_ntoa(struct in_addr in ); _int kill(int processId, int signal) int listen(int sockfd, int backlog) int memcpy (char * dest, char string, int size)_ int pclose( FILE* fp) FILE* popen(char* command, char mode); int pipe (int* fileDescirptorArray) int read (int fileDescriptor, char* string, int n) int recv(int sockfd, void *buf, int len, unsigned int flags) int recvfrom(int sockfd, void *buf, int len, unsigned int flags struct sockaddr * address , socklen_t address_len ) int send(int sockfd, const void *msg, int len, int flags) int sendto(int sockfd, const void *msg, int len, int flags const struct sockaddr * dest_addr , socklen_t dest_len )

void shmat(int shmid, void shmaddr, int shmflg) int shmdt(void *shmaddr) int shmget(key_t key, size_t size, int shmflg) int signal (int signalNumber, void (func) (int)) int socket(int domain, int type, int protocol) _int strcpy (char * dest, char* string) int wait(int status) int write (int fileDescriptor, char string, int n)_