Unix Module 5 MCQ

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Module-5

Introduction to UNIX System process:


MCQ’S
1. Each process in the system has a unique ________.

A. pidentity
B. processidentity
C. pid
D. proid

2. When you start a process (run a command), how many ways you can run it?

A. 2
B. 3
C. 4
D. 5

3. By default, every process that you start runs in the __________.

A. Foreground
B. Background
C. Both A and B
D. None of the above

4. A process is an instance of _______ program.

A. waiting
B. executing
C. terminated
D. halted
5. Which data structure is used to store information about a process?

A. process control block


B. stack
C. queue
D. program control block

6. Which of the following command doesn't create a process?

A. pwd
B. fork
C. cd
D. Both A and C

7. ____ command will bring the background jobs to the foreground.

A. bg
B. gd
C. fg
D. kill

8. What is cron?

A. a simple process
B. an orphan process
C. a daemon
D. a zombie process

9. What is a daemon?

A. process whose parent has died


B. process who has completed its execution but still has an entry in the
process table
C. process which is running infinitely
D. process which runs automatically without any user interaction

10. Which command shows some attributes of a process?


a) pid
b) $$
c) ps
d) HOME

11. Which of the following attribute is not shown by ps command?


a) PID
b) PPID
c) tty
d) size

12. Which option is used by ps command to get a detailed listing of process attributes?
a) -u
b) -f
c) -l
d) –x

13. Which option is used by the system administrator for displaying processes of a user?
a) -f
b) -u
c) -a
d) –e

14. The -a option when used with ps command lists processes of all users but doesn’t
display the system processes.
a) True
b) False

15. Which option is used with ps command to list system processes?


a) -A
b) -a
c) -e
d) –A and –e
16. There are ___ distinct phases of a process.
a) 2
b) 5
c) 4
d) 3

17. Which of the following system call is used for creating a new process?
a) read
b) fork
c) wait
d) new

18. When fork() is invoked, the child process created gets a new PID.
a) True
b) False

19. Which system call is used to run a new program?


a) fork
b) wait
c) exec
d) exit

20. The cron tab is a table having a list of commands that are scheduled to be run at
regular intervals.
a) True
b) False

21. Which of the following command will remove the current crontab?
a) crontab -p
b) crontab -l
c) crontab -e
d) crontab –r

22. To find out how efficiently a program a used the system resources, which command
is used?
a) sys
b) time
c) crontab
d) daemon

23. Where are user crontab files stored?

A. /etc/crontab
B. /var/spool
C. /var/spool/cron
D. ~/.cron

Answers
1. Ans : C

Explanation: Each process in the system has a unique pid.

2. Ans : A

Explanation: When you start a process (run a command), there are two ways you
can run it : Foreground Processes and Background Processes.
3. Ans : A

Explanation: By default, every process that you start runs in the foreground.
4. Ans : B

Explanation: A process is simply an instance of a running program. A process


passes through many states throughout its life cycle i.e. when it is born until it is
executed. After the process has completed it is said to be terminated.
5. Ans : A

Explanation: A process control block is a data structure which is used for storing
information about a process.
6. Ans : D
Explanation: When we run a command, a process representing the command is
started by the shell process but all commands don't set up processes. Built-in
commands of the shell like pwd, cd etc do not create processes.

7. Ans : C

Explanation: We can use the fg command to bring any of the background jobs to
the foreground.

8. Ans : C

Explanation: cron is a daemon which runs on UNIX systems.

9. Ans : D

Explanation: Process which runs automatically without any user interaction is


known as daemon.

10. Answer: c
Explanation: ps command is used to show some attributes of a process. This
command reads through the kernel’s data structures and process tables to fetch the
characteristics of a process. By default, ps command displays the processes owned
by the user running the command.

11. Answer: d
Explanation: ps command displays the processes owned by the user running the
command. If we execute the command immediately after logging in,

12. Answer: b
Explanation: ps is a highly variant command; its actual output varies across
different flavours. To get a detailed listing of process attributes along with PPID
and owner (UID), we have to use the -f option with ps command.

13. Answer: b
Explanation: The system administrator needs to use the -u (user) option to know
the activities of a user
14. Answer: a
Explanation: The -a (all) option lists processes of all users but doesn’t display the
system processes

15. Answer: d
Explanation: Apart from processes a user generates, a number of system processes
keep running all the time. Most of them are not associated with any terminal. To
list all process on our machine, we can use either -A or -e option with ps
command. But beware, this list could be very long on a busy system.

16. Answer: d
Explanation: There are three distinct phases of a process which uses three different
system calls or functions. A process can be in its initial state when it is created,
after that, the process is in execution state when the instructions of a process are
being executed. The third phase of a process is waiting for state when the process
is waiting for some action to be taken.

17. Answer: b
Explanation: A process in UNIX is created using fork() system call. It creates an
exact copy of the process that invokes it. Now there will be two processes, one
parent process and one child process. The process which invokes the fork system
call is called parent process and the new process created is called child process.

18. Answer: a
Explanation: The process created using fork is practically identical to that of
calling process except for a few parameters like PID. When a process is forked in
this manner, the child process gets a new PID.

19. Answer: c
Explanation: Forking creates a new process but it is not enough to run a new
program. To do so, the forked child needs to overwrite its own images with the
code and data of the new program. This mechanism is called exec and the child
process is said to exec a new program.
20. Answer: a
Explanation: The cron-tab or cron table is a list of commands that are scheduled to
be run at regular intervals. The crontab command opens the crontab for
scheduling, editing, removing, modify scheduled tasks

21. Answer: d
Explanation: We can see the contents of our crontab file using crontab -l command
and can remove them with crontab -r. We can also enter cron commands using
crontab -e command.

22. Answer: b
Explanation: When there are multiple versions of a program and we want to find
out how efficiently they’ve used the system resources we can use the time
command. The time command accepts the entire command line to be timed as its
argument. It executes the command and also displays the time usage on the
terminal.

23. Answer – – C
Description – User crontab files are stored in /var/spool/cron.

You might also like