Quiz Module 10 - Package Management
Instructions
This quiz contains 30 multiple-choice questions to validate your understanding of Module 10.
Tip: Answer each question before revealing the answer. The answers are hidden just after each question.
Question 1
Which command updates the list of available packages on Ubuntu 24.04?
See explanation
Correct answer: apt update
Explanation: sudo apt update updates the list of available packages from the repositories. It does not update installed packages, only the list. apt upgrade updates installed packages. Always do update before upgrade.
Question 2
Which command installs a package on Ubuntu 24.04?
See explanation
Correct answer: apt install
Explanation: sudo apt install package-name installs a package. sudo apt install package1 package2 installs multiple packages. apt is the modern command, apt-get is the older one (still available). Example: sudo apt install htop.
Question 3
Which command updates all installed packages?
See explanation
Correct answer: apt upgrade
Explanation: sudo apt upgrade updates all installed packages to their latest available versions. sudo apt full-upgrade performs a full upgrade (may remove packages if necessary). Always do apt update before.
Question 4
Which command removes a package?
See explanation
Correct answer: apt remove or apt purge
Explanation: sudo apt remove package removes a package but keeps configuration files. sudo apt purge package also removes configuration files. sudo apt autoremove removes unused packages (orphaned dependencies).
Question 5
Which command searches for a package?
See explanation
Correct answer: apt search
Explanation: apt search term searches for packages containing the term in their name or description. apt list --installed lists installed packages. apt show package displays package details.
Question 6
Which command shows detailed information about a package?
See explanation
Correct answer: apt show
Explanation: apt show package displays detailed information about a package: version, description, dependencies, size, etc. Useful before installing to see what the package does and its dependencies.
Question 7
Which file lists the APT repositories on Ubuntu 24.04?
See explanation
Correct answer: /etc/apt/sources.list and /etc/apt/sources.list.d/
Explanation: /etc/apt/sources.list contains the main repositories. /etc/apt/sources.list.d/ contains additional repository files (one per file). After modification, run sudo apt update.
Question 8
Which command adds a PPA (Personal Package Archive) repository?
See explanation
Correct answer: add-apt-repository
Explanation: sudo add-apt-repository ppa:user/repo adds a PPA. sudo add-apt-repository --remove ppa:user/repo removes it. After adding, run sudo apt update to update the package list.
Question 9
Which command lists installed packages?
See explanation
Correct answer: apt list --installed
Explanation: apt list --installed lists all installed packages. dpkg -l does the same (dpkg is the low-level tool). apt list --upgradable shows packages that can be upgraded.
Question 10
Which command shows a package's dependencies?
See explanation
Correct answer: apt depends or apt show
Explanation: apt depends package shows a package's dependencies. apt show package also shows dependencies in the "Depends" section. apt rdepends package shows packages that depend on it (reverse dependencies).
Question 11
Which command cleans the package cache?
See explanation
Correct answer: apt clean or apt autoclean
Explanation: sudo apt clean removes all files from the cache. sudo apt autoclean removes only obsolete files from the cache. Useful for freeing up disk space. The cache is located in /var/cache/apt/archives/.
Question 12
Which command compiles software from source?
See explanation
Correct answer: make (after ./configure)
Explanation: Typical process: ./configure (configures the build), make (compiles), sudo make install (installs). Requires development tools: sudo apt install build-essential. Alternative: cmake for some projects.
Question 13
Which command installs a .deb package directly?
See explanation
Correct answer: dpkg -i or apt install
Explanation: sudo dpkg -i file.deb installs a .deb package. sudo apt install ./file.deb does the same and automatically resolves dependencies. dpkg is the low-level tool, apt is higher level.
Question 14
Which command shows files installed by a package?
See explanation
Correct answer: dpkg -L
Explanation: dpkg -L package lists all files installed by a package. dpkg -S /path/file finds which package installed a specific file. Useful to see where a package installs its files.
Question 15
Which command shows which package installed a file?
See explanation
Correct answer: dpkg -S
Explanation: dpkg -S /path/file finds which package installed a specific file. Useful to identify the package owner of a file. which finds the location of a command, dpkg -S finds the package.
Question 16
Which command installs Snap on Ubuntu 24.04?
See explanation
Correct answer: snap is already installed, or sudo apt install snapd
Explanation: Snap is generally already installed on Ubuntu 24.04. Otherwise: sudo apt install snapd. snap install package installs a Snap package. snap list lists installed Snap packages.
Question 17
Which command installs a Snap package?
See explanation
Correct answer: snap install
Explanation: sudo snap install package installs a Snap package. snap install package --classic installs in classic mode (without confinement). snap remove package removes. snap list lists installed packages.
Question 18
Which command installs Flatpak on Ubuntu 24.04?
See explanation
Correct answer: sudo apt install flatpak
Explanation: sudo apt install flatpak installs Flatpak. Then, add the Flathub repository: flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo. flatpak install package installs afterward.
Question 19
Which command shows packages that can be upgraded?
See explanation
Correct answer: apt list --upgradable
Explanation: apt list --upgradable shows all installed packages that have a newer version available. Useful before doing apt upgrade to see what will be updated.
Question 20
Which command shows orphaned packages (unused dependencies)?
See explanation
Correct answer: apt autoremove --dry-run
Explanation: apt autoremove --dry-run shows packages that would be removed (orphaned dependencies) without actually removing them. sudo apt autoremove actually removes them. Useful for cleaning up unused dependencies.
Question 21
Which command fixes broken dependencies?
See explanation
Correct answer: apt --fix-broken install or apt install -f
Explanation: sudo apt --fix-broken install or sudo apt install -f fixes broken dependencies. Useful after a manual .deb installation that caused dependency issues. Automatically resolves conflicts.
Question 22
Which command shows the package installation history?
See explanation
Correct answer: cat /var/log/apt/history.log or journalctl -u apt
Explanation: /var/log/apt/history.log contains the history of apt commands (installations, upgrades, removals). journalctl -u apt also shows apt logs via systemd. Useful to see what was installed and when.
Question 23
Which command shows packages that depend on a specific package?
See explanation
Correct answer: apt rdepends
Explanation: apt rdepends package shows packages that depend on the specified package (reverse dependencies). Useful before removing a package to see which other packages depend on it. apt depends shows direct dependencies.
Question 24
Which command updates a specific package?
See explanation
Correct answer: apt install --only-upgrade package
Explanation: sudo apt install --only-upgrade package updates only that specific package (and its dependencies if necessary). apt upgrade updates all packages. Useful for updating one package without affecting others.
Question 25
Which command shows available versions of a package?
See explanation
Correct answer: apt policy package or apt-cache policy package
Explanation: apt policy package or apt-cache policy package shows available versions of a package from all configured repositories, indicating the installed version and the candidate version. Useful for seeing version options.
Question 26
Which command downloads a package without installing it?
See explanation
Correct answer: apt download package
Explanation: apt download package downloads the .deb file without installing it. The file is downloaded to the current directory. Useful for installing later or on another system. apt install ./file.deb installs afterward.
Question 27
Which command shows configured repositories?
See explanation
Correct answer: apt-cache policy or cat /etc/apt/sources.list
Explanation: cat /etc/apt/sources.list and ls /etc/apt/sources.list.d/ show configured repositories. apt-cache policy also shows repositories for each package. Useful for checking repository configuration.
Question 28
Which command shows installed Snap packages?
See explanation
Correct answer: snap list
Explanation: snap list shows all installed Snap packages with their versions. snap info package shows details of a Snap package. snap find term searches for available Snap packages.
Question 29
Which command updates all Snap packages?
See explanation
Correct answer: snap refresh
Explanation: sudo snap refresh updates all installed Snap packages. sudo snap refresh package updates a specific package. Snap packages update automatically, but you can force it with refresh.
Question 30
Which command installs a Flatpak package?
See explanation
Correct answer: flatpak install
Explanation: flatpak install flathub package installs a Flatpak package from Flathub. flatpak list lists installed packages. flatpak uninstall package removes. flatpak update updates all Flatpak packages.
Quiz Result
Congratulations on completing the Module 10 quiz!
Score:
- 25-30 correct answers: Excellent! You master Linux package management.
- 20-24 correct answers: Very good! Review the concepts where you had difficulties.
- 15-19 correct answers: Good! Review the chapters on package management.
- Less than 15: Recommended to review the module before continuing.
Next Steps
Now that you have validated your knowledge:
Module 11: Monitoring and Logs
Practical Labs: Practice package management with Module 10 labs
Quiz created on: December 2024 - Tested on Ubuntu 24.04