Sunteți pe pagina 1din 23

Dr.

NNCE

MCA
MC9241 NETWORK PROGRAMMING

NP-QB

UNIT I INTRODUCTION

Introduction Overview of UNIX OS - Environment of a UNIX process - Process control Process relationships Signals Interprocess Communication- overview of tcp/ip protocols UNIT II ELEMENTARY TCP SOCKETS 9

Introduction to Socket Programming Introduction to Sockets Socket address Structures Byte ordering functions address conversion functions Elementary TCP Sockets socket, connect, bind, listen, accept, read, write , close functions Iterative Server Concurrent Server. UNIT III APPLICATION DEVELOPMENT 9

TCP Echo Server TCP Echo Client Posix Signal handling Server with multiple clients boundary conditions: Server process Crashes, Server host Crashes, Server Crashes and reboots, Server Shutdown I/O multiplexing I/O Models select function shutdown function TCP echo Server (with multiplexing) poll function TCP echo Client (with Multiplexing) UNIT IV SOCKET OPTIONS, ELEMENTARY UDP SOCKETS 9

Socket options getsocket and setsocket functions generic socket options IP socket options ICMP socket options TCP socket options Elementary UDP sockets UDP echo Server UDP echo Client Multiplexing TCP and UDP sockets Domain name system gethostbyname function Ipv6 support in DNS gethostbyadr function getservbyname and getservbyport functions. UNIT V ADVANCED SOCKETS 9

Ipv4 and Ipv6 interoperability threaded servers thread creation and termination TCP echo server using threads Mutexes condition variables raw sockets raw socket creation raw socket output raw socket input ping program trace route program. TOTAL = 45 REFERENCES: 1. W. Richard Stevens, Advanced Programming in The UNIX Environment, Addison Wesley, 1999. 2. W. Richard Stevens, UNIX Network Programming - Volume 1, Prentice Hall International, 1998.

Dr.NNCE

MCA

NP-QB

MC 9241 UNIX AND NETWORK PROGRAMMING

UNIT I INTRODUCTION
PART- A (1 MARK) 1.The File that contains a set of instructions which are performed when a user logs in, is A.exrc B.profile C.autoexec D.autoexe.bat E.None of the above

2.The octal representation 652 indicates A.Execute permission for the owner C.Read and write permission of groups B.Write permission for others D.All of the above E.None of the above

3.Which of the following command is used to count just the number of lines contained in a file? A.wc -1 B.wc-c C.wc w D.wc r E.None of the above

4.Which of the following command is used togo to home directory? A.cd.. B.cd/ C.cd D.cd Home E.None of the above

5.Which command is used to move all files to the bin sub-directory of the parent directory? A.mv *. .*/bin/ B.mv */bin/* C.mv *.. /bin D.mv*../bin*.* E. None of the above

6.which command is used to save the standard output in file ,as well as diplay it on terminal? A. more B.cat C.haltD.sleepE.none of these above 7. The command that can be used to restrict incoming message to a user is A.mesgB.grepC.haltD.sleepE.None of the above 8.Which of the following commands is used to copy directory structures in and out A.cpB.cpioC.cp-p D.copyE.None of the above

9.Which of the following commands is used for an automatic reminder service? A.writeB.mesgC.calenderD.mailE.None of the above 10.Which command allows you toview your file 24 lines at a time? A.more B.pg C.cat D.lpE.none of the above

11.Which of the following special shell variables is used to process number of the current shell? A.$! B.$$ C.$0 D.$* E.None of the above 12.which option is used with cmp command to give a detailed list of the byte number and the differing bytes In octal for each character that differs in both the files? A.-1 B.-d C.-r D.-b E.None of the above

Dr.NNCE

MCA

NP-QB

13.which command is used with vi editor scroll half page backward? A.[control-d] B.[control u] C.[control-c] D.[control p] E.None of the above 14.Which command is used with vi editor to move cursor forward to first occurrence of character ch in the Current line? A.tchB.fchC.rchD.echE.None of the above 15.Which of the following keys is used to delete the character beneath the cursor ? A.x B.X C.dd D.D E.None of the above 16.which command is used to assign only read permission to all three categories of the file note? A.chmodgo+r note above 17.Which command will be used with vi editor to append text at end of line? A.A B.aC.i D.I E.None of the above B.chmod a-rwC.chmodugo=r note D.chmod x note E.None of the

18.The first set of the three permissions(rw) pertains to the owner of the file, indicating that the owner has A. executable permission only B. write and executable permissions D. both read and write permissions

C. both read and executable permissions

19.Which of the following commands is used to save the output of the who command in a file nameduser.lst, as well as display it? A. who|teeuser.lst B. who>user.lstC.who>>user.lst D.who<user.lste

20.Which of the following shells wildcards are used to match any number of characters including none? A.[ijk] Answer: 1 B 2 B 3 A 4 C 5 C 6 D 7 A 8 B 9 C 10 11 12 13 14 15 16 17 18 19 20 B B A B B A C A D A D B.[!ijk] C.? D.* E. None of the above

PART - B 21. Define directory and filename. (NOV/DEV-2012)

(2 MARKS)

A directory is a file that contains directory entries. The directory entry containing a file name along with structure of information describing the attributes of the file. The names in a directory are called filename. The only two characters that cannot appear in a file name are / and null character.

Dr.NNCE

MCA

NP-QB

22. Define file descriptor.(MAY/JUNE-2013) File descriptors are nonnegative integers that the kernel uses to identify the file being accessed by a particular process. Whenever the kernel opens an existing file or creates a new file it returns the file descriptor. 23. Define program and process. A program is a executable file residing in a disk file. An executing instance of a program is called a process. Every UNIX process have a unique numeric identifier called the process ID. The process ID is always a non negative integer. 24. What are the two different time values supported by UNIX? Calendar time: This value counts the number of seconds which is 00 : 00 : 00 January 1, 1970, coordinated universal time. The data type time_t hold this time values. Process time: It is also called CPU time and measures the central processor resources used by process. Process time is measured inc clock ticks. The data type clock_t hold these time values. 25. Define user CPU time, system CPU time. The time attributed to user instructions are referred as user CPU time. The time attributed to kernel, when it executes an behalf of th process is called system CPU time. 26. What are the kernel data structures are used for open files? Process table entry , File table entry , V node structure 27. Define atomic operation. (NOV/DEV-2012) An operation composed of multiple steps. If the operation is performed atomically either all the steps are performed or none is performed. 28. How will you retrieve the file status? The file status information are retrieved by using the functions stat, fstat, lstat. The stat function returns a structure of information about the named file. The fstat function obtains information about the file that is already open. The lstat function similar to stat but when the named file is a symbolic link. 29. List down the different file types o Regular file o Directory file o Character special file o Block special file o FIFO o Symbolic link o Socket 30. What are the macros available for identifying the file type? S_ISREG() for regular file, S_ISDIR() for directory file,

S_ISCHR() for character special file S_ISBLK() for block special file,

Dr.NNCE S_ISFIFO() For FIFO file, socket file

MCA S_ISLNK() for symbolic link

NP-QB S_ISOCK() for

The argument to these macros is the st_mode member from the stat structure. 31. What are the options available to determine the group ID of the new file? The group ID of the new file can be the effective group ID of the process .The group ID of the new file can be the group ID of the directory in which the file is being created. 32. What are the different time fields maintained for each file . Last access time of file data .Last modification time of file data .Last change time of i_node status 33. Define symbolic link. A symbolic link is an indirect pointer to a file unlike the hard links. There are no file system limitations on a symbolic link and what it points to and any one can create a symbolic link to a read directory. Symbolic links are typically used to move a file or an entire directory hierarchy to some other location on a system. 34. Define sticky bit.Give its usefulness. The bit S_ISVTX is known as sticky bit. If this bit is set for an executable program file, then the first time the program was executed a copy of the programmers text was saved in the swap area when the process terminated. The advantage of using this is the program is loaded into memory faster the next time. 35. Define the purpose and format of utimefunction The access time and modification time of a file can be changed with the utimefunction. The general format is # include <sys/types.h> # include <utime.h> intutime (const char * pathname, conststructutimbuf *times);Returns 0 if OK 1 on Error 36. What are the directory routines available in POSIX . # include <sys/types.h> #include <dirent.h> DIR *opendir( const char *pathname) Returns pointer if OK NULL on error structdirent *readdir(DIR *dp); Returns pointer if OK , Null at end of directory or error voidrewinddir(DIR *dp); intclosedir(DIR *dp); Returs 0 if OK 1 on error 37. What is the major goal of buffering?

Dr.NNCE

MCA

NP-QB

To use the minimum number of read and write calls. It tries to do its buffering automatically for each I/O stream 38. What are the different types of buffering is supported by UNIX? Fulybuffered : In this case the actual I/ O takes place when the standard I/ O buffer is filled Line buffered: In this case the standard I/O library performs I/O when a new line character is encountered on input or output. Un buffered: The standard I/O library does not buffer the characters. 39. What are the different types of unformatted I/O? Character at a time I/O, Line at a time I/O, Direct I/O

40. How will you position a standard I/O stream? By using the functions ftell ,fseek and fgetpos and fsetpos. ftell, fgetpos: to retrieve the current byte position fseek ,fsetpos: to move the file pointer to specified place PART C (16 MARKS)

41. Explain the architecture of UNIX in detail.Explain about chmod and fchmod functions in UNIX. (MAY/JUNE-2013) 42. Explain in detail about directory functions. (MAY/JUNE-2013) 43. Write note on (a) Password file (b) Shadow passwords (c) Login accounting(MAY/JUNE-2013) 44. Explain in detail about system Data files. (NOV/DEV-2012) 45. Explain in detail about Binary I/O and formatted I/O . (NOV/DEV-2012)

UNIT II ELEMENTARY TCP SOCKETS PART- A (1 MARK)

46.Which of the following commands is used to display the filenames in multiple columns? A.ls B.ls-l C.ls-x D.lc E. None of the above

47.Which command is used with file named note to remove the executable permission from the user and assign read permission to the group and others? A. chmod u-x, go +r note C. chmod g-x, uo+r note B. chmodgo+r,u+x note D. chmodgo+x, u-x note E. None of the above

48.Which of the following is invalid filename? A. shutry B. TRY C. trial D. my .file E. None of the above

Dr.NNCE

MCA

NP-QB

49.Which command is used to assign executable permission to all of the files named letter A. chmodugo+r letter B. chmodugo+rw letter D. chmodugo+x letter E. None of the above 50. Which of the following shells wildcards are used to match any number of characters including none? A.[ijk] B.[!ijk] C.? D.* E. None of the above C.chmodu+x letter

51.Which command is used with vi editor to save file and remain in the editing mode? A. :q B.:w C. q! D. :x E. None of the above

52. You can append to a file instead of overwriting by using the A. > symbol above 53. The [line number G] key allows you A.to move cursor left by one position C. to move cursor down by one position specified by the number B. to move cursor right by one position D. to move cursor to the beginning of the line E. None of the above B.>> symbol C. <symbol D.<<symbol E.None of the

54.Which set option is used with vi editor to display line numbers on screen? A. nm B. nu C. ic D. li E. None of the above

55.Which command is used with vi editor to move the cursor to the left? A. I B. j C. k D. h E. None of the above

56. Which command is used to print a file? A. print B. prn C. pg D. lp E. None of the above

57.The special shell variables $* is used A.to exit status of ast command executed. C.to list the positional parameters E.none of the above 58.The cat command is used to A.capture a file B.display a file C.print a file D.copy a file E.none of the above B.to process number of the current shell D.to name the command being executed

59.The UNIX file system stores a date in physical blocks of A.1024 bytes B.2048 bytes C.512 bytes D.256 bytes E.None of the above

60.Which command is used to terminate all processes in your own system except the login shell? A.kill 1 B. kill 0 C. cancel all D.cancel 1 E. none of the above

61.which operator will be used with chmod command to assign absolute permission?

Dr.NNCE A.+ B.C.= D=%

MCA E. none of the above

NP-QB

62. Which command is used to link the files? A.lk b.Inc.cp D.tar E. none of the above

63.Which of the following signs is used to back up over typing errors in vi? A.@ B.# C.$ D.! E. none of the above

64.Major expressions used with find command to select file is it has been accessed in more than 375 days,is A.-a time +365 B.-mtime +365 C.-a. time -365 D.e user-list E. none of the above

65.Which of are following internal commands is used in mail to forward mail to user in user-list? A.r user-list Answer: 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 C A E D D B B D B D D C B C B C B B A B B.m user-list C.d user-list D.e user-list E. none of the above

PART B 66. List down the contents of password file. (MAY/JUNE-2013) User name,

(2 MARKS)

Encrypted password, Numerical user ID and group ID, Initial working directory, Initial shell

Comment field,

67. what do you mean by shadow password? The duplicate copy of password file is called password file. Minimally this file has the user name and the encrypted password. Other information relating to the password is also stored here. 68. What are the different functions for systems data file? A get function that reads the next record, opening the file if necessary. These functions normally return a pointer to the structure. A null pointer is returned when the end of file is reached. A set function opens the file and rewinds the file. An end entry that closes the data file. 69. How will you identify the system in POSIX.1? The system is identified by using the function uname. This function return information on the current host and OS. 70. List down the different time conversion functions? (NOV/DEV-2012) Gmtime, local time, mktime, asctime, ctime, strftime

71. List down the functions for process termination

Dr.NNCE

MCA

NP-QB

The normal terminations are return from main, calling exit, calling _ exit. The abnormal terminations are by calling abort, terminated by a signal 72. Write down the contents of C program in memory layout. Text segment, initialized Data segment, uninitialized, stack, heap 73. What is the purpose of memory allocation functions and what are the functions available for memory allocation. The memory allocation functions are used to allocate, reallocate, and deallocate memory locations. The functions available for memory allocation are malloc, calloc, reallo and free. 74. What are the rules govern the changing of resource limits? A soft limit can be changed by any process to a value less than are equal to its hard limit.Any process can lower its hard limit to a value greater than are equal to its soft limit.Only a super user process can raise a hard limit. 75. Write down the functions those who are return a process ID The functions return process ID is Getpid, getppid, getuid, geteuid, getgid, getegid 76. Define zombie process The process that has terminated but whose parent has not yet waited for it called zombie process. 77. What is the difference between wait and waitpidfunctions Wait can block the caller until a child process terminates while waitpid has no option that prevents it from blocking. Waitpid doesnt wait for the first child to terminate- it has a number of options that control which process it waitsfor. 78. What are the additional features available for waitpid comparing to wait ? Waitpid function waits for one particular process.Waitpid provides a non blocking version of wait.Waitpid supports job control 79. Write down the rules for changing user ID? The process must have super user privileges .If the process does not have super user privileges, but uid equals either the real user ID or the saved set user ID 80. What is the purpose of exec functions? (NOV/DEV-2012) When a process calls one of the exec functions that process is completely replaced by the new program. The new program stats execution from main function. The processed does not change across an exec because a new process is not created. But this function replaces the current process with new program from disk.

Dr.NNCE

MCA

NP-QB

81. What is the role of signals in UNIX OS? Interpreter files hide the fact that certain programs are scripts in some other language. Interpreter scripts provide an efficiency gain.Interpreter scripts let us write shell scripts using shells other than / bin/ sh 82. What is fork()? A process group is a collection of one or more processes. Each process group has a unique process ID. A function getpgrp returns the process group id of the calling process. Each process group have a leader. The leader is identified by having its process group ID equal its process ID. A process joins an existing process group or creates a new process group by calling setpgid. 83. Define session. A session is a collection of one or more process groups. A process establishes a new session by calling setsid function. This function returns process group id if OK. 84. What do you mean by signal? (MAY/JUNE-2013) Signals are software interrupts. Signals provide a way of handling asynchronous events: a user at a terminal typing the interrupt key to stop a program or the next program in the pipeline terminating prematurely. 85. What are the conditions to generate a signal? The terminal generated signals occur when users press some terminal keys.The hardware exceptions generate signals The kill(2) function allows a process to send any signal to another process or process group. The kill(1) function allows a process to send Software conditions generate signals PART C (16 MARKS)

86. Explain in detail about process control. Explain the memory layout of a C program. 87. Define signals .Explain in detail about signals . 88. Explain in detail about terminal I/O (MAY/JUNE-2013) 89. Explain (a)Signals (b)thread (c)System ()function(NOV/DEV-2012) 90. Explain in detail about the UNIX process Environment . (NOV/DEV-2012)

Dr.NNCE

MCA

NP-QB

UNIT III APPLICATION DEVELOPMENT PART- A (1 MARK)

91.Which command will be used with vi editor to replace single character under cursor with any number of characters? A.s B.S C.aD.i E. none of the above

92.Which of the following set options is used with vi editor to ignore case while searching for patterns? A.ic B.ai C.sm D.ts E. none of the above

93.Which of the following commands is used to absolutely assign all permissions to the owner,read and write permissions to the group and only executable permissions to the others of the file note? A.chmod 761 note note E.none of the above 94.Thechmodugo+rw note command can be represented in octal notation as A. chmod 555 note B. chmod 666 note C. chmod 444 note D. chmod 333 note B.chmod 671 note C.chmod 167 note D.chmod 4=rwx,g=rw

95.Which command is used with vi editor to search a pattern in the forward direction? A./ above 96.Which of the following commands is used to view your file 24 lines at a time? A. pg B. cat C. lp D. /p E. None of the above B.? C.// D.?? E. none of the

97.whichshellswild card is used to match a single character? A .* B.? C.[ijk] D.[IJK] E.none of these above

98. In bourneshell ,which file sets the unix environment for the user when the logs into his home directory A. d B.a C.-rrr D.r-x r-x E. None of the above

99. if the file doesnt have any permission for any category,then this expression takes the form A.d B.a C.-r-x r-x D.None of the above

100.Which command is used to copy the three files wb,collect and mon into the miscdirectory,under the same,when you were currently in the programs directory? A.copywb../misc collect../miscmon../misc C. copy wb collect mon / misc E. None of the above B. cpwb collect mon../misc D. tar wb collect mon / misc

Dr.NNCE

MCA

NP-QB

101.The command chmd 761 note is equivalent to A.chmod167 note B.chmod u=rwx, g=rw.o=x note C. chmo a=761 note

102. The commonly used UNIX commands like date ,ls,cat, etc. are stored A. /devdirectory B. /bin and /user /bin directories C./temp directory D./unix directory E.none of these directories 103. Which of the following commands is used to remove files with confirmation prompt from the user file system which have neither been accessed nor modified i the last one year? A. find-mtime+365|rm C.find-name-mtime+365/=ok rm E.none of the above 104.Which of the following commands is used to summarize the disk usage? A.chkdsk B.fdisk C.du D.disk E none of the above B.grep(/user/*)-mtime+365|-ok rm D.find/user/*\(-mtime+365-a-atime+365\)-ok rm{}\;

105.If a file has read and write permissions for the owner ,then the octal representation of the permissions will be A.1 B.6 C.5 D.3 E.none of the above

106. Which is the earliest and most widely used shell that came with UNIX system? A. C shell B.Korn shell C.Bourne shell D.Smith shell E.None of the above 107. The seventh field of /etc/password is A. password B.login C.shell D.home E.None of the above

108. Which command is used to create a directory ? A.head-r B.tail C.eof D.bof E.None of the above

109. Which command is used to create a directory? A.crdir B.md C.mkdir D.cr E None of the above

110.Which command is used to diplay the device name the terminal you are using ? A. Who Answer: 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 A A A B A A B B B A B B D C B C C B C C B.Is C.tty D.stty E. None of the above

Dr.NNCE PART B 111. Define pending signal.

MCA (2 MARKS)

NP-QB

A signal is generated for a process when a process event that causes the signal occurs. The signal is delivered to a process when the action for a signal is taken. During the time between the generation of signal and its delivery is referred as pending. 112. Define the purpose of kill and raise functions. The kill function sends a signal to a process or a group of processes. The raise function allows the process to send a signal to itself. 113. What is the purpose of alarm and pause functions? The alarm function allows to set a timer that will expire at a specific time in the future. When the timer expires the SIGALRM signal is generated. If we ignore or dont catch this signal its default action is terminate the process. The pause function suspends the calling function until signal is caught. 114. Define the different modes of terminal I/ O. Canonical mode input processing. In this mode terminal input is processed as lines. The terminal driver returns at most one line per read request. Default mode Non canonical mode input processing. The input characters are not assembled into lines. Used by programs that manipulate the screen. 115. What are the different problems used in fork function? Fork is expensive. Because memory and all descriptors are duplicated in the child. Inter process communication is required to pass information between the parent and the child after the fork. 116. What do you mean by thread? Threads are light weight processes. All threads with in the process share same global memory. This makes communication simple but necessitates synchronization. All threads with in a process share process instructions, data, open files, signal handlers and signal descriptors, current working directory, user and group Ids. 117. Define pipe. (MAY/JUNE-2013) Pipe were the first widely used inter process communication method available both within programs and from the shell. The problem with pipe is that they are usable only between processes that have a ancestor, this problem is solved with the named pipes or FIFOs 118. List down the types of IPC. Message Queues, Semaphore, Shared memory

119. Explain the purpose of ftok function with format

Dr.NNCE

MCA

NP-QB

This function used to generate a IPC key. The general format for this function is # include<sys/ipc.h>key_tftok(const char *pathname, int id); This function takes information derived from the pathname, the files inode number and the lower order 8 bits of id. 120. Explain the purpose of popen and pclose functions with format The popen function creates a pipe and initiates another process that either reads from the pipe or writes to the pipe. 121. Define message queue Message queue is a linked list of messages. It is used to make a communication between the related or unrelated processes 122. What are the attributed in the message on the message queue. An unsigned integer priority , The length of the data portion of the message, The data

123. What are the differences between POSIX message queue and system V message queue? (NOV/DEV-2012) POSIX message queue always returns the oldest message of the highest priority , But the system V message queue can return a message of any desired priority. Posix message queues allow the generation of a signal or the initiation of a thread when a message is place onto an empty queue, where as nothing similar is provided by system V message queues. 124. what is the purpose of mq_open, mq_close functions? The mq_open functions open an existing Posix message queue or create a new message queue. The mq_closefunction is used to close the opened message queue. 125. What is the purpose of mq_unlinkfuncton? The mq_unlink function is used to delete a Posix massage queue permanently from the system. But the message queue is deleted only the reference count for the queue reached 0. 126. How will you send and receive an message to the POSIX message queue? The posix message queue can pass a message to the queue by calling the function mq_send with the parameters are the descriptor,character array pointer, length of the message and priority of a message. The posix message queue can retrieve a message to the queue by calling the function mq_receive with the parameters are the descriptor, character array pointer, length of the message and priority of a message. 127. What are the information available in system V message queue? Read write permissions, pointer to first message, pointer to last message, number of bytes currently in queue, Number of messages in the queue, maximum number of bytes

Dr.NNCE

MCA

NP-QB

allowed, process id of last message send, process id of last message receive, process time of last message send, time of last message receive, time of last message control function called. 128. List down the system calls related to system V message queue with desription. msgget- to create a new message queue or open an existing message queue. msgsnd to send a message to a queue msgrcv to receive a message from a message queue. msgctl to provide a variety of control operations in a message queue. 129. what are the features provided by type field in the system V message queue? Used to identify message allowing multiple processes to multiplex messages onto single queue.Used as priority field 130. What is shared memory?How do you create a shared memory segment in UNIX OS? Synchronization normally needed to allow the sharing of data between threads and processes. Mutexes and condition variables are the building blocks of synchronization. PART C 131. Explain in detail about system V message queues 132. Illustrate the operation of pipe with an example. (NOV/DEV-2012) 133. Explain in detail about semaphores. (MAY/JUNE-2013) 134. Explain in detail about shared memory or fastest IPC mechanism. (MAY/JUNE-2013) 135. Explain in detail about record locking & Shared memory. (NOV/DEV-2012) (16 MARKS)

UNIT IV SOCKET OPTIONS, ELEMENTARY UDP SOCKETS PART- A 136. The Is-I command tells A. who the owner of the file is B. the name of the group owner of the file (1 MARK)

C. how large the file is and when the file was last modified D. All of the above E. None of the above

137. Which option will be used with disk free command to include the total amount of disk space in the file System? A. t B. tt C. -4 D. i E. None of the above

138. Which command is used to set the three permission form all the three categories of a file? A. chgrp B. chownC.chmod D. chusr E. None of the above

139. Which of the following command can be used to get information about yourself?

Dr.NNCE A. Who am i above B. i/4

MCA C. pwd D. Which E. None of the

NP-QB

140. Which of the following keys is used to overstrike a whole line? A. R B. v C. C D. u E. None of the above

141. Which command is used to locate all the .profile files in the system? A. Is profile above 142. In vi editor, forward search is performed using the command. A. :pat B. :pat C. /pat D. All of the above E. None of the above B. find/-name profile print C. cd /. profile D. l-u. profile E. None of the

143. Which of the following special shell variable is used to process number4 of the last background job? A. $! B. $# C. $0 D. $* E. None of the above

144. Which option will be used with ps command to slow the entire command line of the process being run? A. -4 B. -f C. -1 D. -4 E. None of the above

145. Which of the following directories contain all the Ales created by a user, including his login directory? A. /tmp B. /etc C. /usr D. /dev E. None of the above

146. The % key allows you A. to move the cursor to a matching delimiter , when a delimiter a parenthesis , a bracket, a brace. B. to move the cursor the upper left corner of the screen. C. to move the cursor backward to the beginning of a word D.to move the cursor to the first column in the current line E. None of the above 147. Which command is used to display the characteristic of the process? A. pid B. du C. ps D. au E. None of the above

148. Which of the following command is used to identify the type of file by context? A. Is B. cat C. file D. more E. None of the above

149. The field separator in cut command is specified with A. a option B. d option C. r option D. x option E. None of the above

150. Which of the following options will be used to display number of blocks used by a file? A. c B. i C. t D. s E. None of the above

151. Which option will be used with touch command to change the access time?

Dr.NNCE A. a B. b C. t

MCA D. h E. None of the above

NP-QB

152. Which command is used to make all files and sub-directories in the directory (progs) executable by all users? A. chmod R a+xprogs D. chmod x a+xprogs B. chmod R 222 progs E. None of the above C. chmod -1 a+xprogs

153. Which command is used to count just the number of character in a file? A. wc -1 B. wc c C. wc w D. wc r E. None of the above

154. Which command is used to display a file contents in octal form? A. cd B. od C. of D. oct E. None of the above

155. The agency that site between the user and the UNIX system is called the A. logic Answer: 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 B 155 C B. profile C. shell D. erxc E. None of the above

A A

PART B 156. What is the use of Mutex? (NOV/DEV-2012)

(2 MARKS)

Mutex is used to protect a critical region, to make certain that only one thread at a time executes the code with in the region. 157. List down the function formats for lock and unlock a region. #include<pthread.h> intpthread_mutex_lock(pthread_mutex_t *mptr); intpthread_mutex_trylock(pthread_mutex_t *mptr); intpthread_mutex_unlock(pthread_mutex_t *mptr); 158. Define bounded buffer problem or producer- consumer problem. One or more produces are creating data items are then processed by one or more consumers. 159. What are the rules for allocating read- write locks? Any number of threads can hold a given read-write lock for reading as long as no thread holds the read write lock for writing.A read-write lock can be allocated for writing only if no thread holds the readwrite lock for reading or writing. 160. What do you mean by critical region?

Dr.NNCE

MCA

NP-QB

The critical region access or update one or more pieces of data that are shared between threads. 161. What is meant by well known port number? List down different types of semaphore. .Semaphore is a primitive used to provide synchronization between various processes or between the various threads in a given process. The types of semaphore are .Posix named semaphores Posix memory based semaphore .System V semaphores. 162. List down the operations performed on a semaphore by semaphore. Create a semaphore , Wait for a semaphore, Post to a semaphore 163. Write down the differences between the semaphore and mutexes and condition variables. The thread that locked the mutex, where as a semaphore the same thread that did the semaphore wait need not perform post, must always unlock a mutex. A mutex is either locked or unlocked. 164. Define shared memory. (NOV/DEV-2012) It is the fastest form of IPC. It is a memory shared by unrelated processes. Once the memory is mapped into the address space of the process that are sharing the memory region no kernel involvement occurs in placing data between the processes 165. List down the purpose for using the function mmap. To provide a memory mapped I/O, To provide anonymous memory mappings To provide shard memory between unrelated processes 166. What are the different ways to share memory between unrelated processes? By using memory mapped files, 167. Define sockets. (MAY/JUNE-2013) A socket is a construct to provide a communication between computers. It hides the underlying networking concepts and provides us with an interface to communicate between computers. 168. Define value result arguments The way in which the length of the structure passed is depends on which direction the structure is being passed from process to kernel or vice versa. The size parameter is passed by value when the function is called and passed by result when the function returns. This type of argument is called value result argument. 169. Define little byte endian order,big byte endian order By using shared memory objects

Dr.NNCE

MCA

NP-QB

Little byte endian order: in sixteen bit integer number the low order byte at the starting address. Big byte endian order: in sixteen bit integer number the high order byte at the starting address. 170. Write down the different byte manipulation functions. Bzero,bcopy,bcmp,memset,memcpy,memcmp 171. What is the purpose of address conversion functions? (NOV/DEV-2012) The functions inet_aton,inet_ntoa and inet_addr convert IPv4 address between dotted decimal string and its 32-bit network byte ordered binary value. The functions inet_pton,inet_ntop handle both IPv4 and IPv6 address. The letters p and n stands for numeric and presentation. 172. Why we use MX,AAAArecord in DNS resource record? The different option values are AF_INET, AF_INET6, AF_LOCAL, AF_ROUTE, AF_KEY. The different type values are SOCK_STREAM, SOCK_DGRAM, SOCK_RAW 173. What is the purpose of connect and bind function. The connect function is used by a TCP client to establish a connection with a TCP server. The bind function assigns a local protocol address to a socket. 174. What are the actions performed by listen function. The listen function is called by TCP server and it performs the following actions .It converts the unconnected socket into a passive socket, indicating that the kernel should accept incoming connection requests directed to this socket .It specifies the maximum number of connections that the kernel should queue for this socket. 175. Define concurrent servers and iterative servers. The servers that can handle multiple clients simultaneously are called concurrent servers. The servers that can handle multiple clients serially are called concurrent servers. PART C 176. Explain in detail about TCP communication. (MAY/JUNE-2013) 177. Explain in detail about I/O multiplexing. (NOV/DEV-2012) 178. Explain in detail about socket options. (NOV/DEV-2012) 179. Explain in detail about UDP sockets. (MAY/JUNE-2013) 180. Explain IPV4,IPV6 socket address structure and generic socket address structure. (16 MARKS)

Dr.NNCE UNIT V ADVANCED SOCKETS PART- A 181.What is Ps command for? A. prints the status C. prints the execution status

MCA

NP-QB

(1 MARK)

B. prints the process status D. none

182.which command is used to terminate the process? A. wait B. sleep C.kill D.none

183.what is the stand for IPC? A.inter procedure communication C. inter part compare 184.what is the stand for FIFO? A. first in frist out B.file in file out C. first inter first out D.none B. inter process communication C.none

185.Which one data structure is used for Demand paging? A.Page table entries C.page frame data table (pfdata) 186.what is stand for BBS in unix? A. block started by symbol C.blacksarted by symbol B.blackstortedby symbol D.none B. disk block descriptor D. swap-use table E. mail

187.which one is best in action between fork() and vfork()? A. fork() B.vfork C. both D.none

188.who developed UNIX? A. ken Thompson B. dennis Ritchie

C.douglasmacllroy, ruddcanaday and tom Blakeley D. ken thompsan,dennis Ritchie 189.what are staes that the page can be in,after causing a page fault? A. on a swap device and not in memory C. in an executable file D. all B. on the free page list in the main memory

190.which command is used to sort the lines of data in a file in reverse order A. sort B sh C. st D.sort-r E.none of the above

191.which command is used to display the to of the file? A. cat B. head C. more D. grep E. none of the above

192.which of the following keys is used to replace a charcter with new text? A. s B. s C. r D. c E. none of the above

193.which command seds the word count of the file infile to the newfile

Dr.NNCE A. wcinfile>newfile D. wcinfile| newfile

MCA B. wc<infile>newfile E. none of the above C. wcinfile - newfile

NP-QB

194.which command sends the word count of the file new to the infile. A.wcinfile>newfile D.wcinfile |newfile B.wc<infile>newfile E.None of the above C.wcnewfile infile

195.which command is used to display the bottom of the file? A.cat B.head C.moreD.tail E.none

196.which command is used to display the botton of the file? A. sort B. sh C. st D.sort-r E.none of the above

197.which is used for create a new child process from a parent process? A.fork() B. vfork() C.fork() &vfork() D.child() E.none

198.which command is used for display a current month? A.date B.date-m C.date-yY D.date-m-y E.none

199.which command is used for display a current month? A.date B.date-m C.date-Y D.date-m-y E.none

200.which command is used for display a current year? A.date B.date-m Answer: 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 A B be 200 D C.date-Y D.date-y E.none

PART B 201. What are the uses of fork functions. (NOV/DEV-2012)

(2 MARKS)

A process makes a copy of itself so that one copy can handle one operation does another task. A process wants to execute another program, that is done by one of the processes by calling exec to replace itself with the new program. 202. List down the different I/O models Blocking I/O,Nonblocking I/OI/O multiplexing,Signal driven I/O, Asynchronous I/O 203. Define synchronous and asynchronous I/O operations A synchronous I/ O operations causes the requesting process to be blocked until I/ O operations complete An asynchronous I/O operation does not cause the requesting process to blocked.

Dr.NNCE

MCA

NP-QB

204. Write down any 8 generic socket options SO_BROADCAST, SO_DEBUG, SO_ERROR, SO_DONTROUTE, SO_KEEPALIVE, SO_LINGER, SO_RCVBUF, SO_SNDBUF 205. Define UDP sockets. UDP is a connection less unreliable, datagram protocol. In UDP the client does not establish connection with a server. Instead the client just sends a datagram to the server. 206. What is the purpose of DNS? The domain name system or DNS is used primarily to map between host names and IP addresses. DNS entries are known as resource records (RRs) 207. What is the purpose of resolvers? The client and server applications contact a DNS server by calling functions in a library known as resolver. The common resolver functions are gethostbyname and gethostbyaddr. 208. What are the different Resource records(RR)? The different RR format are A, AAAA, PTR, MX, CNAME 209. Define TCP sockets. (NOV/DEV-2012) TCP sockets provide a simple and effective way to provide connection oriented client server networking. 210. What are the additional facilities supported by raw sockets? Raw sockets are used to read and write ICMPv4, IGMPv4, and ICMPv6 packets. With the raw socket a process can read and write IPv4 data grams with an IPv4 protocol field that is not processed by kernel. With a raw socket a process can build its own IPv4 header using the IP_HDRINCL socket option 211. What are the differences between raw IPv6 sockets with ordinary raw output? All fields in the protocol send or received on a raw IPv6 socket are in network byte order.There is no equivalent of IP_HDRINCL socket option with IPv6. Checksums on raw Ipv6 sockets are handled differently using the IPv6socket option 212. What are the different level constants are available for socket option functions? SQL-SOCKET, IPPROTO_TCP. 213. What are the functions available for set and retrieve the socket options? The functions for set and retrieve socket options are getsockopt and setsockopt 214. What are the different system tracing tools are available? SVR streams based socket library, BSD kernel sockets, Solaris 2.6 kernel sockets IPPROTO_IP, IPPROTO_ICMPV6, IPPROTO_IPV6,

Dr.NNCE 215. Describe different TCP/IP services.

MCA

NP-QB

echo server return whatever the client sends discard server discards whatever the client sends daytime server returns the date and time in a human readable form 216. What is the purpose of sock program It is used to generate special case conditions that can help us visualize various scenarios without writing individual test programs. 217. List down the different operation modes for sock program. Standard input, standard output client ,Standard input, standard output

server,Sourceclient,Sink server 218. What are the different functions done by TCP echo client server program? The client reads a line of text from its standard input and writes it to the server.The server reads line from network input and echoes the line back to the client.The client reads the echoed line and prints it on its standard output 219. What is the purpose of trace route program? The trace route program allows us to determine the path that IP datagrams follow from our host to some other destination. 220. What is the purpose of ping program? (MAY/JUNE-2013) The ping program is a utility program that is used to fetchecho replies from the server. 221. What is the purpose of netstat program? It shows the status of networking endpoints.It shows the multicast groups that a host belongs to on each interface .It shows the pre protocol statistics with the s option.It displays the routing table with the r option and the interfaceinformation with the i option PART C 222. Explain in detail about raw sockets 223. Explain in detail about debugging techniques. (MAY/JUNE-2013) 224. Explain the operation of ping and tracerout. 225. Explain TCP echo client server. (MAY/JUNE-2013) 226. Explain in detail about ping and trace route program 227. Explain about file system.(NOV/DEV-2012) 228. Explain in detail about file sharing &Explain the data structures needed for file sharing (16 MARKS)

S-ar putea să vă placă și