Unix Questions and Answers – Process Control System Calls – 2

This set of Tricky Unix Questions and Answers focuses on “Process Control System Calls – 2”.

1. ___ system call behaves in an identical manner to the kill command.
a) alarm
b) kill
c) pause
d) signal
View Answer

Answer: b
Explanation: kill system call behaves in an identical manner to the kill command. kill sends a signal but doesn’t necessarily kill a process.

2. Which library function uses kill to send any signal to the current process?
a) getc
b) raise
c) catch
d) try
View Answer

Answer: b
Explanation: kill sends a signal but doesn’t necessarily kill a process. Kill system call is used by the library function raise to send any signal to the current process.

3. Which system call is used to set a timer that generates the SIGALARM signal?
a) pause
b) alarm
c) read
d) signal
View Answer

Answer: b
Explanation: The alarm call is used to set a timer that generates the SIGALRM signal after the timeout period.
advertisement
advertisement

4. If two users execute the same program, the memory requirements are doubled.
a) True
b) False
View Answer

Answer: b
Explanation: If two users execute the same program then memory requirements are not doubled, the text segment in the virtual address space is shared.

5. Address space of a process is virtual.
a) True
b) False
View Answer

Answer: a
Explanation: We say that the address space of a process is virtual because the address specified in the executable doesn’t point to the actual memory location. The virtual addresses are translated into a physical address at runtime by memory management unit (MMU).

6. Which of the following system calls returns one or more file descriptors?
a) dup, dup2
b) fcntl
c) pipe
d) dup, dup2, fcntl and pipe
View Answer

Answer: d
Explanation: dup, dup2, fcntl and pipe are the system calls which returns one or more file descriptors when invoked.

7. The environment variables are available in _____
a) *environ[ ]          
b) env[ ]          
c) env          
d) pipe          
View Answer

Answer: a
Explanation: The environment variables transmitted from parent process to child are available in environ[ ] variable.
advertisement

8. Which of the following functions are used for obtaining and setting the value of environment variables?
a) getenv
b) setenv
c) env
d) getenv and setenv
View Answer

Answer: d
Explanation: The environment variables transmitted from parent process to child are available in environ[ ] variable. POSIX specifies two functions, getenv and setenv to obtain and set these values.

9. Which of the following action can be taken by a process upon receiving a signal?
a) ignore the signal
b) terminate the process
c) suspend the process
d) ignore the signal, terminate and suspend the process
View Answer

Answer: d
Explanation: How a process responds to a signal depends on how things are set up in the program representing the process. However, there are mainly three actions that a program can take upon receiving a signal i.e. ignore the signal and continue execution normally, terminate the process, suspend (stop) the program.
advertisement

10. What is the default disposition of most signals?
a) ignore the signal
b) terminate the process
c) suspend the process
d) kill the signal
View Answer

Answer: b
Explanation: The action that a signal takes on receipt of a signal is called disposition. The default disposition of most signals is to terminate the process.

Sanfoundry Global Education & Learning Series – Unix.

To practice tricky questions and answers on all areas of Unix, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

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.