Quiz Module 4 - Process Management
Instructions
This quiz contains 30 multiple-choice questions to validate your understanding of Module 4.
Tip: Answer each question before revealing the answer. The answers are hidden just after each question.
Question 1
What is a process in Linux?
See explanation
Correct answer: An instance of a running program with its own PID
Explanation: A process is an instance of a running program. Each process has a unique PID (Process ID), its own memory, and its own resources.
Question 2
What is the PID of the init (or systemd) process?
See explanation
Correct answer: 1
Explanation: The init process (or systemd on modern systems) always has PID 1. It is the first process launched at startup and the parent of all other processes.
Question 3
Which command allows you to see the running processes?
See explanation
Correct answer: ps
Explanation: ps (process status) displays running processes. Common options: ps aux (all processes), ps -ef (extended format), ps -e (all processes).
Question 4
Which command displays processes in real-time with CPU and memory usage?
See explanation
Correct answer: top or htop
Explanation: top displays processes in real-time with CPU and memory usage. htop is an improved and more interactive version. You can also use vmstat or iostat.
Question 5
What is a PID?
See explanation
Correct answer: Process ID - Unique identifier of a process
Explanation: The PID (Process ID) is a unique number assigned to each process upon creation. It allows identifying and managing processes.
Question 6
What is a PPID?
See explanation
Correct answer: Parent Process ID - PID of the parent process
Explanation: The PPID (Parent Process ID) is the PID of the process that created this process. Processes form a tree hierarchy with init (PID 1) as the root.
Question 7
Which command allows you to kill a process?
See explanation
Correct answer: kill
Explanation: kill sends a signal to a process. Syntax: kill PID (TERM by default), kill -9 PID (KILL, forced), kill -15 PID (TERM, graceful).
Question 8
Which signal forces the termination of a non-responsive process?
See explanation
Correct answer: SIGKILL (9)
Explanation: SIGKILL (signal 9) forces the immediate termination of a process and cannot be ignored or intercepted. Use it as a last resort: kill -9 PID or kill -KILL PID.
Question 9
Which command allows you to kill a process by its name?
See explanation
Correct answer: killall or pkill
Explanation: killall process_name kills all processes with that name. pkill pattern kills processes matching the pattern. Examples: killall firefox, pkill -9 python.
Question 10
Which command displays the process tree?
See explanation
Correct answer: pstree
Explanation: pstree displays processes in a tree format, showing parent-child relationships. Options: pstree -p (with PIDs), pstree -u (with users).
Question 11
What is a zombie process in Linux?
See explanation
Correct answer: A terminated process whose parent has not yet read its exit status
Explanation: A zombie process (state "Z") is a process that has terminated but whose entry in the process table has not yet been cleaned up because the parent process has not called wait() to read its exit status.
Question 12
What is an orphan process in Linux?
See explanation
Correct answer: A process whose parent process has terminated before it
Explanation: An orphan process is adopted by init (PID 1) when its parent terminates. Init becomes its new parent and reaps the zombie process when it terminates.
Question 13
How to launch a process in the background?
See explanation
Correct answer: command &
Explanation: Adding & at the end of a command launches it in the background. Example: sleep 60 &. The shell displays the process PID and immediately returns to the prompt.
Question 14
Which command allows you to see background jobs?
See explanation
Correct answer: jobs
Explanation: jobs displays the background jobs of the current shell. Options: jobs -l (with PIDs), jobs -a (including completed). Jobs are numbered: [1], [2], etc.
Question 15
Which command brings a job to the foreground?
See explanation
Correct answer: fg
Explanation: fg brings a job to the foreground. Syntax: fg (last job), fg %1 (job number 1), fg %name (job by name). Use bg to send to the background.
Question 16
Which command allows you to launch a process that continues after disconnection?
See explanation
Correct answer: nohup
Explanation: nohup (no hang up) allows a process to continue after terminal disconnection. Syntax: nohup command &. Output is redirected to nohup.out by default.
Question 17
Which command allows you to change the priority of a process?
See explanation
Correct answer: nice and renice
Explanation: nice launches a process with a modified priority: nice -n 10 command (priority +10). renice changes the priority of an existing process: renice 10 PID (priority +10). Values range from -20 (high priority) to +19 (low priority).
Question 18
What is the range of nice values in Linux?
See explanation
Correct answer: -20 to +19
Explanation: Nice values range from -20 (highest priority) to +19 (lowest priority). By default, processes have a priority of 0. Only root can use negative values (higher priority).
Question 19
Which signal is sent by default with Ctrl+C in the terminal?
See explanation
Correct answer: SIGINT
Explanation: Ctrl+C sends SIGINT (signal 2) to the foreground process. It is an interrupt signal that can be intercepted by the process. To force termination, use Ctrl+\ (SIGQUIT) or kill -9.
Question 20
Which signal is sent by Ctrl+Z in the terminal?
See explanation
Correct answer: SIGSTOP
Explanation: Ctrl+Z sends SIGSTOP (signal 19) to the foreground process, suspending it. The process can be resumed with fg (SIGCONT) or bg (in the background).
Question 21
Which command allows you to suspend a process?
See explanation
Correct answer: kill -STOP or kill -19
Explanation: kill -STOP PID or kill -19 PID suspends a process (SIGSTOP). The process can be resumed with kill -CONT PID or kill -18 PID (SIGCONT).
Question 22
Which command allows you to resume a suspended process?
See explanation
Correct answer: kill -CONT or kill -18
Explanation: kill -CONT PID or kill -18 PID resumes a suspended process (SIGCONT). You can also use fg to bring a suspended job to the foreground or bg to send it to the background.
Question 23
Which ps option displays all processes with full details?
See explanation
Correct answer: ps aux
Explanation: ps aux displays all processes (a = all users, u = user-oriented format, x = processes without controlling terminal) with full details: PID, CPU, memory, command, etc.
Question 24
Which command allows you to see the processes of a specific user?
See explanation
Correct answer: ps -u username or ps aux | grep username
Explanation: ps -u username displays the processes of a specific user. You can also use ps aux | grep username to filter by user. ps -u $USER displays the processes of the current user.
Question 25
Which command in top allows you to kill a process?
See explanation
Correct answer: k
Explanation: In top, pressing k allows you to kill a process. It will ask for the PID and the signal (default SIGTERM). Other useful commands: q (quit), r (renice), M (sort by memory), P (sort by CPU).
Question 26
Which command in top allows you to sort by CPU usage?
See explanation
Correct answer: P
Explanation: In top, pressing P sorts processes by CPU usage (from highest to lowest). M sorts by memory, T by CPU time, N by PID.
Question 27
Which command allows you to see processes sorted by memory usage?
See explanation
Correct answer: ps aux --sort=-%mem
Explanation: ps aux --sort=-%mem sorts processes by decreasing memory usage (the - indicates descending). ps aux --sort=%cpu sorts by CPU. You can also use ps aux | sort -k4 -rn to sort by column.
Question 28
What is htop compared to top?
See explanation
Correct answer: An improved and more interactive version with a graphical interface
Explanation: htop is an improved version of top with a more user-friendly interface, mouse navigation, colors, and better visualization. It is not always installed by default: sudo apt install htop on Ubuntu.
Question 29
Which command allows you to see processes with their parent-child relationships?
See explanation
Correct answer: ps auxf or pstree
Explanation: ps auxf displays processes in a tree format. pstree is specifically designed to display the process tree. Options: pstree -p (with PIDs), pstree -u (with users), pstree -h (highlight the current process).
Question 30
What is the difference between kill and killall?
See explanation
Correct answer: kill uses a PID, killall uses a process name
Explanation: kill PID kills a specific process by its PID. killall process_name kills all processes with that name. Examples: kill 1234, killall firefox. Be careful: killall can kill multiple processes at once!
Quiz Result
Congratulations on completing the Module 4 quiz!
Score:
- 25-30 correct answers: Excellent! You master Linux process management.
- 20-24 correct answers: Very good! Review the concepts where you had difficulties.
- 15-19 correct answers: Good! Review the chapters on process management.
- Less than 15: Recommended to review the module before continuing.
Next Steps
Now that you have validated your knowledge:
Module 5: User and Permissions Management
Practical Labs: Practice process management with Module 4 labs
Quiz created on: December 2024 - Tested on Ubuntu 24.04