Unit 8: Process Management - Practice Quiz
1 What is a process in an operating system?
2 Which of the following best describes the difference between a program and a process?
3 What does PID stand for?
4 Which statement about a Process ID (PID) is correct?
5 In Linux, which process is traditionally assigned the PID of 1?
6
What is the primary purpose of the ps command?
7 Which command displays a snapshot of processes at the moment it is run, rather than updating continuously?
8
Which ps option combination is commonly used to display all processes on the system with full details?
9
What does the top command do?
10
Which key is commonly pressed to quit the top command?
11
The top command is mainly used to monitor which of the following?
12
What does the jobs command display?
13 In the shell, a job typically refers to which of the following?
14
What does the bg command do?
15
Which key combination is typically used to suspend a foreground job before sending it to the background with bg?
16
What is the purpose of the fg command?
17 If you have a job running in the background and want to interact with it directly in the terminal, which command should you use?
18
What is the main purpose of the kill command?
19
The kill command identifies which process to signal by using its __.
20
How does pkill differ from kill?
pkill can only stop the shell itself
pkill lets you terminate processes by name or other attributes instead of requiring a specific PID like kill does
pkill restarts processes instead of stopping them
pkill works only on the top process
21
A running program creates a child process using fork(). Which statement best describes the relationship between the two processes immediately after fork() returns?
22 A process that has finished execution but still has an entry in the process table because its parent has not read its exit status is called a:
23 A child process continues running after its parent terminates. Which process typically adopts this orphaned child on a modern Linux system?
init/systemd process (PID 1)
24 Which command displays the PID of the currently running shell?
echo $#
echo $!
echo $$
echo $?
25
After launching a command in the background with &, which shell variable holds the PID of that most recently backgrounded process?
$$
$!
$?
$-
26 On a standard Linux system, which process always has a PID of 1?
init/systemd process
swapper task
27
Which ps command lists every process on the system with detailed information in the BSD-style format?
ps -p
ps -l
ps t
ps aux
28
You want to find the PID of a process named nginx using ps. Which pipeline achieves this?
ps -kill nginx
ps -ef | grep nginx
ps -name nginx
ps -find nginx
29
In the output of ps -ef, which column shows the parent process ID of each listed process?
TTY
PPID
UID
PID
30
While top is running interactively, which key sorts the process list by memory usage?
q
k
M
P
31
The load average shown in top reports three numbers. What do these three values represent?
32
In top, a process shows a state of R in the status column. What does this indicate?
33
You run jobs and see [2]+ Stopped vim file.txt. What does the + symbol next to the job number indicate?
fg/bg
34 Which command lists the active jobs of the current shell along with their PIDs?
jobs -l
jobs -r
jobs -s
jobs -p
35
You pressed Ctrl+Z to suspend a long-running command. Which command resumes it in the background so the terminal is freed?
kill -CONT
jobs -r
fg
bg
36
You have two stopped jobs [1] and [2]. Which command resumes job 1 specifically in the background?
bg -1
bg job1
bg 1
bg %1
37 A command is running in the background and you want to bring it back to the foreground to interact with it. Which command does this?
kill -STOP
top
fg
bg
38
A process ignores the default kill signal. Which command forcibly and unconditionally terminates the process with PID 4521?
kill -1 4521
kill -15 4521
kill -9 4521
kill -19 4521
39
Which signal number does the kill command send by default when no signal is specified?
9 (SIGKILL)
1 (SIGHUP)
15 (SIGTERM)
19 (SIGSTOP)
40
Which command terminates all running processes whose name matches firefox in a single step?
pkill -p firefox
kill -name firefox
pkill firefox
kill firefox
41
A process ignores SIGTERM because it has installed a custom handler that only logs the signal. Which signal number should you send to force termination that the process cannot catch, block, or ignore?
SIGTERM)
SIGINT)
SIGHUP)
SIGKILL)
42
A process calls fork() which returns 0 in one context and a positive integer in another. What do these two return values indicate respectively?
0 is returned to the parent; the positive value (parent's PID) is returned to the child
0 indicates failure; the positive value indicates success in both processes
0 is returned to the child; the positive value (child's PID) is returned to the parent
0 is the thread ID; the positive value is the process group ID
43 A parent process terminates before its child completes. Which process becomes the new parent of the orphaned child, and what is that process's typical PID?
init/systemd with PID 1 adopts the orphan
44
You run sleep 100 &, then sleep 200 &, then sleep 300 &. Running jobs shows job [3] marked with a +. What does the + sign specifically denote?
nice
fg and bg act on when no job spec is given
45
You run pkill -9 -f "python.*server". Which processes are targeted for SIGKILL?
python.*server
python.*server
python.*server
python.*server
46
A foreground process is stopped with Ctrl+Z. You then run bg. What is the sequence of signals delivered that resumes the job in the background?
Ctrl+Z sends SIGTSTP; bg sends SIGCONT to resume it in the background
Ctrl+Z sends SIGCONT; bg sends SIGTSTP to resume it
Ctrl+Z sends SIGINT; bg sends SIGHUP to resume it
Ctrl+Z sends SIGSTOP; bg sends SIGTERM to resume it
47
In top, a process shows %CPU of 150.0 on a 4-core system. How is this value possible and what does it indicate?
top sums usage across cores (max would be 400%)
%CPU cannot exceed 100%
48
Which ps command reliably lists processes sorted by memory usage in descending order, showing the top memory consumers?
ps aux --sort=%mem
ps -ef --order mem
ps aux --memsort=desc
ps aux --sort=-%mem
49
A defunct (zombie) process appears in ps output. Why does kill -9 <PID> fail to remove it?
SIGKILL using a signal mask
kill -9 requires root privileges for zombies
wait() clears the entry
50
You have jobs [1], [2], and [3] in the background. Which command brings job 2 specifically to the foreground?
fg 2
fg -2
fg #2
fg %2
51
What is the key behavioral difference between pkill firefox and killall firefox?
pkill only kills the oldest matching process; killall kills all matches
pkill matches process names as a substring/pattern by default; killall requires an exact name match
pkill sends SIGKILL by default; killall sends SIGTERM
pkill works only on the current user's processes; killall works system-wide
52
A process in the D state shown by ps cannot be terminated even with SIGKILL. What does the D state represent?
53
In a shell, $$ expands to 4821 and $! expands to 4835. What do these two variables represent?
$$ is the foreground job's PID; $! is the number of running jobs
$$ is the last exit status; $! is the last background exit status
$$ is the parent shell's PID; $! is the current shell's PID
$$ is the current shell's PID; $! is the PID of the most recent background process
54
In top, the summary line shows %wa (iowait) at 45% while %us and %sy are low. What does this most likely indicate?
55
What does the STAT column value Ss mean in the output of ps aux?
S = sleeping; s = scheduled for the next quantum
S = system process; s = single-threaded
S = interruptible sleep; s = the process is a session leader
S = stopped; s = swapped out to disk
56
Running kill -0 <PID> produces no output and returns exit status 0. What is the purpose of signal 0?
57
A backgrounded job (via bg) attempts to read from the terminal (stdin). What happens to the job?
SIGTTIN and appears as stopped in jobs until brought to the foreground
SIGKILL and terminates immediately
58
You want to send SIGTERM only to processes named nginx owned by user www-data. Which command is correct?
pkill -u www-data nginx
pkill nginx --owner www-data
pkill -U nginx www-data
pkill --user=www-data --name=nginx --all
59
After running jobs -l, what additional information is shown compared to plain jobs?
60
A daemon process is created by double-forking. Why is the second fork() performed after the first child calls setsid()?
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →