Unix Questions and Answers – Process Control System Calls – 1

«
»

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.
a) True
b) False
View Answer

Answer: a
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?
a) dup
b) decr
c) exec
d) execv
View Answer

Answer: a
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 ___
a) dup1
b) dup2
c) exevr
d) exec
View Answer

Answer: b
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.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!
advertisement
advertisement

4. Which of the following system call is preferred over dup and dup2 for replicating file descriptor?
a) dup3
b) fcn
c) fcntl
d) exec
View Answer

Answer: c
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?
a) fork
b) pipe
c) fcntl
d) exec
View Answer

Answer: b
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.
Check this: MCA Books | MCA MCQs

6. We can use pipe with fork system call.
a) True
b) False
View Answer

Answer: a
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 ____
a) reposition
b) disposition
c) composition
d) event
View Answer

Answer: b
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.
advertisement

8. The sources from where the signals can be generated are:
a) keyboard
b) hardware
c) a C program
d) keyboard, hardware, a C program
View Answer

Answer: d
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.
a) 2
b) 3
c) 1
d) 5
View Answer

Answer: b
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.
advertisement

10. Which of the following signals are generated from the hardware?
a) SIGFPE
b) SIGILL
c) SIGSEGV
d) SIGPE, SIGILL, SIGSEGV
View Answer

Answer: d
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.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.