This set of Unix Multiple Choice Questions & Answers (MCQs) focuses on “Process Control System Calls – 1”.
1. ____ exec is responsible for executing programs on a UNIX system.
Explanation: If we want to run a separate program in a forked process, it is done by exec. This operation replaces the entire address space with that of a new program. In other words, the fork is responsible for creating a process but it actually the exec that executes the program on a UNIX system.
2. Which of the following system call is used for duplicating file descriptor?
Explanation: The dup system call supplicates the file descriptor fields and returns the lowest number available for allocation.
3. We can also duplicate the file descriptor using ___
Explanation: Sometimes, dup call can fail in duplicating a file descriptor. In that case, the dup2 system call is used which provides a better way of replicating file descriptor.
4. Which of the following system call is preferred over dup and dup2 for replicating file descriptor?
Explanation: POSIX calls dup and dup2 “redundant” functions and advocates the use of fcntl system call.
5. Which of the following system call is used for inter-process communication?
Explanation: UNIX has a very elaborative scheme for two processes to communicate with each other. Pipe is a system call which provides a half-duplex communication channel. Pipe takes an array of two integers as its only argument, which it populates with two file descriptors.
6. We can use pipe with fork system call.
Explanation: To make pipe work in tandem with fork, the usual procedure is to create the pipe before forking the process.
7. The action that a signal takes on receipt of a signal is called ____
Explanation: A signal is represented by an integer and its symbolic name. A signal is a mechanism used by the kernel to communicate the occurrence of an event to a process. The action that a signal takes on receipt of a signal is called disposition.
8. The sources from where the signals can be generated are:
c) a C program
d) keyboard, hardware, a C program
Explanation: The event that generates the signal can take place in the hardware, in the OS or elsewhere. It can be generated from the keyboard eg; SIGINT signal or it can be generated from the hardware eg; SIGILL.
9. There are _____ signals that are generated from the keyboard.
Explanation: There are 3 signals that have their origin in the keyboard and all these three signals affect the foreground job. For example, ctrl-c generates the SIGINT signal (terminates the process), ctrl-\ generates the SIGQUIT signal which directs a process to produce a core dump, ctrl-z sends SIGSTOP to all the processes of foreground process group.
10. Which of the following signals are generated from the hardware?
d) SIGPE, SIGILL, SIGSEGV
Explanation: Signals can be generated from hardware too like SIGFPE is generated on account of an arithmetic operation, SIGILL is generated for illegal instruction and SIGSEGV is generated for memory access violation. All these signals result in the termination of the process.
Sanfoundry Global Education & Learning Series – Unix.
To practice all areas of Unix, here is complete set of 1000+ Multiple Choice Questions and Answers.