Page 1 of 18 UNIX Programming
Page 1 of 18 UNIX Programming
9. Close function _ _ _ _ _ _ _ _ _ _
a. returns 1 on failure
b. holds all locks
c. retuns 1 on success
d. returns 0 on success
12. The system call that is used to change the terminal characteristics like baud rate, parity, number
of bits per character, etc.. is
a. umask
b. ioctl
c. fork
d. dup
16. Each process has a file mode creation mask. It is set with the _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
system call.
a. mask
b. umask
c. ioctl
d. dup
20. In UNIX system lets us read and write anywhere in the file known as random access, this
capability is made possible with _ _ _ _ _ _ _ system call.
a. dup
b. fcntl
c. lseek
d. stat
21. The function _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ writes the null terminated string to the specified stream.
a. fputs
b. fread
c. fwrite
d. fopen
32. If a sticky bit is set for a directory, a file in the directory can be removed only if the user has _ _ _
_ _ _ _ _ _ _ _ _ _ permission for the directory.
a. read
b. write
c. execute
d. no
b. hard link
c. user link
d. process link
36. The _ _ _ _ _ _ _ _ _ function that allows us to change the file access permissions for existing
file.
a. chown
b. chmod
c. chgrp
d. chusr
37. To change the file access permissions, the process must have
a. normal user permission
b. group permission
c. super user permission
d. other permission
42. mkdir creates a dot -dot file in the new directory, dot-dot specifies
a. current directory
b. child directory
c. it is not a file
d. parent directory
45. The function to fill in the buffer with the current directory
a. mkdir
b. gets
c. getcwd
d. puts
46. dir creates a dot file in the new directory, dot specifies
a. current directory
b. child directory
c. it is not a file
d. parent directory
47. rm file
a. removes file from file system
b. reduces link count for a file
c. reduce link count of a file, if it is zero the file be removed from file system
d. link the file
48. We can change the current working directory of a calling process by calling the _ _ _ _ _ _ _ _ _ _
function.
a. chown
b. chdir
c. chmod
d. chgrp
51. In the process structure, the _ _ _ _ _ _ _ _ _ _ _ _ _ _ data contains data elements that are not
initialized by the program but are set to zero before the process starts execution.
a. initialized read-write
b. initialized read-only
c. uninitialized
d. initialized write-only
52. In the process structure, the _ _ _ _ _ _ _ _ _ _ _ _ _ _ data contains data elements that are
initialized by the program and may have their values modified during execution of the process.
a. initialized read -write
b. initialized read -only
c. uninitialized
d. initialized write-only
53. A process can obtain its effective user ID by calling the _ _ _ _ _ _ system call.
a. getpid
b. geteuid
c. getppid
d. getpuid
55. In the process structure, the _ _ _ _ _ _ _ data contains data elements that are initialized by the
program and are read-only while the process is executing.
a. initialized read-write
b. initialized read-only
c. uninitialized
d. initialized write-only
56. The kernel context of a process is maintained and accessible only to the _ _ _ _ _ _ _ _ _ _ _ _ _
_.
a. shell
b. kernel
c. user
d. operating system
58. A process can obtain its PID using the _ _ _ _ _ _ _ _ _ _ _ system call.
a. int pid( );
b. int ppid( );
c. int getpid( );
d. int getppid( );
59. The kernel assigns the parent process ID when a new process is created and a process can obtain
its value using the _ _ _ _ _ _ _ _ _ system call.
a. int pid( );
b. int ppid( );
c. int getpid( );
d. int getppid( );
60. A process can obtain the real user ID of the user executing the process by calling the _ _ _ _ _ _ _
_ _ _ _ system call.
a. pid( );
b. getuid( );
c. getpid( );
d. getppid( );
61. _ _ _ _ _ _ _ _ _ _ _ data structure is used while a unix process is running to allocate more data
space dynamically to the process.
a. stack
b. linked list
c. heap
d. union
62. The _ _ _ _ _ _ _ data structure is used dynamically while the unix process is running to contain
the stack frames that are used by many programming languages.
a. stack
b. linked list
c. heap
d. union
63. The process which is dead but not removed from the process table is
a. zoombie
b. orphan
c. init
d. swapper
64. If the parent process of the exiting process is not executing a wait, the terminating process is
marked as a
a. zoombie
b. orphan
c. init
d. swapper
65. If the parent process has not executed a wait, then the child process becomes a
a. zoombie
b. orphan
c. init
d. swapper
66. The process with process ID 0 is a special process called the _ _ _ _ _ _ _ process.
a. swapper
b. init
c. pagedaemon
d. kernel
67. The process with process ID 2 is a special process called the _ _ _ _ _ _ _ process.
a. swapper
b. init
c. pagedaemon
d. kernel
69. _ _ _ _ _ _ _ _ _ _ _ _ _ feature allows the system administrator to specify both the minimum and
maximum number of days between password changes for a user.
a. password shadow
b. passwordmin
c. passwordmax
d. password aging
70. The process with process ID 1 is a special process called the _ _ _ _ _ _ _ process.
a. swapper
b. init
c. kernel
d. shell
71. We refer to the process that issues the exec system call as _ _ _ _ _ _ _ .
a. calling process
b. zombie process
c. orphan process
d. init process
72. The attribute that can change when a new program is exceed are
a. process ID
b. terminal group ID
c. real group ID
d. effective user ID
75. The _ _ _ _ _ _ _ _ _ system call replaces the current process with the new program.
a. fork
b. exit
c. exec
d. kill
77. The _ _ _ _ _ _ _ _ system call creates a copy of the process that was executing.
a. fork
b. exit
c. exec
d. kill
78. The fork system call is called _ _ _ _ _ _ _ _ _ by the parent process, but it returns _ _ _ _ _ _ _ _
_ _ _ _ once in the parent and once in the child.
a. once, once
b. once, twice
c. twice, twice
d. twice, once
81. By pressing Ctrl - key causes the system to send an _ _ _ _ _ _ _ _ _ to the running process.
a. SIGTSTP
b. SIGABRT
c. SIGINT
d. SIGPID
84. By pressing Ctrl - C key causes the system to send an _ _ _ _ _ _ _ _ _ to the running process.
a. SIGTSTP
b. SIGABRT
c. SIGINT
d. SIGPID
85. By pressing Ctrl - Z key causes the system to send an _ _ _ _ _ _ _ _ _ to the running process.
a. SIGTSTP
b. SIGABRT
c. SIGINT
d. SIGPID
d. hangup
91. In kill system call, if the pid argument is -1 and sender is not the superuser
a. the signal is sent to all processes, other than the system processes
b. the signal is sent to all processes in the senders process group
c. the signal is sent to all processes whose process group ID equals to absolute value of pid.
d. The signal is sent to all processes whose real user ID equals the effective user ID of the
sending process.
92. In kill system call, if the pid argument is -1 and sender is the superuser
a. the signal is sent to all processes, other than the system processes
b. the signal is sent to all processes in the senders process group
c. the signal is sent to all processes whose process group ID equals to absolute value of pid.
d. The signal is sent to all processes whose real user ID equals the effective user ID of the sending process.
94. The kill command sends the message to all processes of the callers process group if the pid is
equal to
a. 0
b. 1
c. -1
d. >0
100. In kill system call, if the pid argument is greater than zero, then
a. the signal is sent to all processes, other than the system processes
b. the signal is sent to the process whose process ID is pid
c. the signal is sent to all processes whose process group ID equals to absolute value of pid.
d. Error checking is done but no signal is sent.
101. The _ _ _ _ _ _ _ _ _ _ _ function cause the calling process to be suspended until a signal caught
by process and signal handle returns.
a. kill
b. raise
c. sleep
d. abort
102. In alarm function, if the timer expire or dont catch the signal, its default action is
a. to create a process
b. to block a process
c. to suspend a process
d. to terminate the process
103. The _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ function suspends the calling process until a signal is caught.
a. pause
b. kill
c. raise
d. abort
105. The _ _ _ _ _ _ _ _ _ _ _ function causes the calling process to be suspended until the amount of
clock time specified has elapsed.
a. kill
b. raise
c. sleep
d. abort
106. The alarm function causes a _ _ _ _ _ _ _ _ _ _ _ to be sent to the calling process after a specified
number of real time seconds have passed.
a. SIGABRT
b. SIGALRM
c. SIGKILL
d. SIGTERM
108. The _ _ _ _ _ _ _ _ _ _ system call sends SIGABRT to the process which calls this function.
a. raise
b. kill
c. alarm
d. abort
109. The abort system call sends _ _ _ _ _ _ _ _ _ _ _ _ _ to the process which calls this function.
a. SIGABRT
b. SIGALRM
c. SIGKILL
d. SIGTERM
110. The _ _ _ _ _ _ _ _ _ _ _ function causes a SIGALRM to be sent to the calling process after a
specified number of real time seconds have passed.
a. raise
b. kill
c. alarm
d. abort
111. The process memory manager allocates space to the running process from the _ _ _ _ _ _ _ _
data area.
a. static
b. logical
c. unused logical
d. dynamic
112. The data area that are allocated when the program is loaded into memory and remain allocated
the whole time the program is running is
a. dynamic data area
b. static data area
c. logical address space
d. unused logical address space
118. In a system, the only time memory is requested is when a process is created.
a. memory allocation
b. dynamic memory management
c. static memory management
d. memory deallocation
121. The malloc( ) function calls _ _ _ _ _ _ _ _ _ _ _ _ function first time and gets a chunk of free
memory.
a. free
b. alloca
c. realloc
d. sbrk
124. The _ _ _ _ _ _ _ _ _ function allocates space for an array elements of specified size, and the
space is initialized to zero.
a. malloc
b. calloc
c. realloc
d. free
125. The _ _ _ _ _ _ _ _ _ _ function allocates size bytes of space in the stack frame of the caller, and
returns a pointer to the allocated block.
a. malloc
b. calloc
c. alloca
d. realloc
128. The _ _ _ _ _ _ _ _ _ _ function changes the size of the block pointed to by ptr to size bytes and
returns pointer to the block.
a. malloc
b. free
c. calloc
d. realloc
130. The calloc( ) function allocates space for an array elements of specified size, and the space is
initialized to
a. empty
b. zero
c. one
d. two
c. unique locks
d. exclusive locks
136. _ _ _ _ _ _ _ _ _ _ _ is the ability of a process to prevent other processes for modifying a region
of a file.
a. record blocking
b. record locking
c. record filing
d. record packing
143. _ _ _ _ _ _ _ _ _ _ occurs when two processes are each waiting for a resource that the other has
locked.
a. encounter
b. deadlock
c. accident
d. blocking
d. advisory locking
149. write request to verify that the operation doesnot interfere with a lock held by a process.
a. file locking
b. record locking
c. mandatory locking
d. advisory locking
151. A _ _ _ _ _ _ _ _ _ _ object remains in existence until the kernel reboots or until the object is
explicitly deleted.
a. Kernel - persistent IPC
b. Filesystem - Persistent IPC
c. Process - Persistent IPC
d. Persistent IPC
153. A _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ object remains in existence until the last process that holds
the object open close the object.
a. Kernel - persistent IPC
b. Filesystem - Persistent IPC
c. Process - Persistent IPC
d. Persistent IPC
d. Persistent IPC
162. Once a FIFO is created, it must be opened for reading or writing using _ _ _ _ _ _ _ _ _ _ _ _ _ _
system call.
a. read
b. write
c. open
d. close
172. In the semaphore function semget(key, nsem, IPC _ PERM ; nsem argument specifies _ _ _
_____
a. key of semaphore
b. permissions of semaphores
c. number of sub semaphores
d. number of flags in the semaphore
175. To see the list of semaphores already existing in the system, the command is
a. ipcs - p
b. ipcs - s
c. ipcs - q
d. ipcs - r
a. resource is locked
b. resource is available
c. resource is removed
d. resource is not available
183. When message queue is created, the fields of message queue msg _ qnum, msg _ lspid, msg _
lrpid, msg _ stime and msg _ rtime are set to
a. 1
b. 0
c. 2
d. infinity
193. For every shared memory segment , the kernel maintains the _ _ _ _ _ _ _ _ _ _ _ _ structure
a. msqid _ ds
b. shmid _ ds
c. shmmem _ ds
d. memsh _ ds
194. If shmid= shmget(key, 10, IPC _ CREAT | 0666); in this the size of shared segment is
a. 10 bytes
b. 0666
c. 10 Kilobytes
d. 10 Megabytes
196. _ _ _ _ _ _ _ _ _ _ _ _ is a way of allowing two or more processes to work on the same area in
memory.
a. pipe
b. shared memory
c. semaphore
d. message queue
198. The function to attach the shared segment to the user process is
a. shmget
b. shmat
c. shmdt
d. shmput
199. The function to detach the shared segment from the user process is
a. shmget
b. shmat
c. shmdt
d. shmput
200. For using a shared memory segment the header file to be include is
a. <sys/msg.h>
b. <sys/sem.h>
c. <sys/pipe.h>
d. <sys/shm.h>