This set of Unix Multiple Choice Questions & Answers (MCQs) focuses on “Process Management – 1”.
1. What is a job?
a) group of tasks
b) group of commands
c) group of processes
d) group of signals
View Answer
Explanation: A job is a name given to a group of processes. The easiest way of creating a job is to run a pipeline of two or more commands. If we are using C, Korn or Bash shell we can use the job control commands to manipulate jobs.
2. Which of the following command is used to suspend a job?
a) ctrl-Z
b) ctrl-Q
c) bg
d) $
View Answer
Explanation: Suppose we invoke a command and the prompt hasn’t returned even after a long time then we can suspend that job by pressing Ctrl-Z. The point needed to be focused here is, the job hasn’t terminated yet; it’s only suspended or stopped.
3. Which command will push the current foreground job to the background?
a) bg
b) fg
c) ctrl-Z
d) kill
View Answer
Explanation: If we’d suspended a job using ctrl-Z then after that we can use the bg command to push the current foreground job to the background. For example,
$ bg [1] sort abd.index > mash.index & // this job has been sent to the background. [1] // indicates job number 1.
4. ____ command will bring the background jobs to the foreground.
a) bg
b) fg
c) ctrl-Z
d) kill
View Answer
Explanation: We can use the fg command to bring any of the background jobs to the foreground. To bring the most recent background job to the foreground we can use the following command:
$ fg
5. The command fg %1 will bring the first background job to the foreground.
a) True
b) False
View Answer
Explanation: fg command can be used with the job number, job name or a string as arguments prefixed with the % symbol. For example,
$ fg %3 // brings the third job to foreground
6. The command bg %2 is valid.
a) True
b) False
View Answer
Explanation: bg command can also be used with the job number, job name or a string as arguments prefixed with the % symbol. For example, if we’ve suspended two jobs but now we want to send the second job to the background, use the following command:
$ bg %2
7. What does the following command do?
$ kill %2
a) kills job number 2
b) kills the second background job
c) invalid command
d) kill all foreground & background jobs
View Answer
Explanation: We can use the identifiers like job number, job name or a string of arguments with kill command to terminate a job. Thus kill %2 will kill the second background job.
8. Which of the following is not a part of job control facilities?
a) relate a job to the background
b) bring it back to the foreground
c) kill a job
d) create a new job
View Answer
Explanation: If we are using the C, Korn or Bash shell then we can use their job control facilities to manipulate jobs. Job control in these shells means that we can :
• Relate a job to the background (bg)
• bring it back to the foreground (fg)
• kill a job (kill)
• list the active jobs (jobs)
• suspend a foreground job (ctrl-Z)
9. POSIX shell provides job control facilities like bg or fg.
a) True
b) False
View Answer
Explanation: If we are using the C, Korn or Bash shell then we can use their job control facilities to manipulate jobs like killing a job, pushing to background or foreground, suspending a foreground job. We cannot use these job control commands in any other shell except the above mentioned.
10. Which command is used to list the status of jobs?
a) fg
b) JOBS
c) jobs
d) fg
View Answer
Explanation: We can use the jobs command to list the status of the jobs. This command tells the state of the job along with job number. For example,
$ jobs [3] Running wc -l fitr?? > word_count & [2] Running sort abd.index > mash.index &
11. We can schedule a job to run at a specified time of day using _______ command.
a) batch
b) at
c) cron
d) jobs
View Answer
Explanation: UNIX provides sophisticated facilities to schedule a job to run at a specified time of day using at command. at command takes as its arguments the time the job is to be executed and displays the > prompt. The input then has to be supplied from standard input. For example,
$ at 19:07 at> file02.sh [Ctrl-D] Commands will be executed using usr/bin/bash Job 1016171818.a at Sun Jan 15 19:07:00 2018 In the above command the script file named file02.sh goes to the queue and it will be executed at the specified time.
12. We can use the _____ symbol with at command to redirect our output to a specified file.
a) >
b) <
c) >>
d) %
View Answer
Explanation: The standard output and standard error of the program scheduled using at command are mailed to the user who can use any mail reading program to view it. Alternatively, we can use the > symbol to redirect our output to a specified file for viewing it later. For example,
$ at 19:07 file02.sh > file02.txt // output will be recorded in file02.txt
13. Which of the following keyword is not supported by at command?
a) now
b) noon
c) tomorrow
d) evening
View Answer
Explanation: at command offer keywords like now, noon, midnight, today, tomorrow to schedule jobs according to our convenience. We can also use the + operator with at command. The words that can be used with + operator include hours, days, month, years, weeks.
14. Which one of the following forms used with at command is invalid?
a) at noon
b) at now +2 years
c) at 3:07 + 1 day
d) at morning
View Answer
Explanation: at command offer keywords like now, noon, midnight, today, tomorrow to schedule jobs according to our convenience. For example,
at noon // at 12:00 hours today at now + 2 years // at current time after 2 years at 3:07 + 1 da // at 3:07pm tomorrow at 15 // 24 hrs format assumed
Sanfoundry Global Education & Learning Series – Unix.
To practice all areas of Unix, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Practice Computer Science MCQs
- Check Unix Books
- Check MCA Books
- Practice MCA MCQs
- Check Computer Science Books