Linux Basic Practice Multiple Choice Questions – 11

51. Question: What is the main purpose of the groupmod command in Linux?

Option 1: Modify group attributes

Option 2: Add a new group

Option 3: Remove a user from the group

Option 4: Create a new group

Correct Answer: 1

Explanation: In Linux, the main purpose of the groupmod command is to modify group attributes. You can use groupmod to change the attributes of an existing group, such as its name or GID (Group ID). It is not used to create new groups or remove users from groups; it focuses on modifying group attributes.

52. Question: What is the command used to lock a user account in Linux?

Option 1: passwd -l

Option 2: usermod -L

Option 3: lockuser -u

Option 4: userlock -a

Correct Answer: 1

Explanation: In Linux, the correct command to lock a user account is passwd -l. This command adds a “!” in front of the user’s password hash in the /etc/shadow file, preventing them from logging in. This is a security measure to temporarily or permanently disable a user account.

53. Question: What is the command to update all installed packages in Red Hat-based distributions?

Option 1: yum update

Option 2: apt-get update

Option 3: dnf upgrade

Option 4: pacman -Syu

Correct Answer: 1

Explanation: In Red Hat-based distributions (such as CentOS and Fedora), you would use the yum update command to update all installed packages. This command fetches and installs the latest updates for system software packages.

54. Question: Which file defines the default settings when creating a new user account?

Option 1: /etc/default/user.conf

Option 2: /etc/useradd.conf

Option 3: /etc/default/useradd

Option 4: /etc/login.defs

Correct Answer: 4

Explanation: In Linux, the file that defines the default settings when creating a new user account is /etc/login.defs. This file contains various parameters and settings related to user account creation, password policies, etc. Modifying this file will affect the behavior of the useradd and adduser commands.

55. Question: In the context of package management, what does the term “repository” refer to?

Option 1: A centralized location for storing and maintaining software packages.

Option 2: A virtual environment for package testing.

Option 3: A command used to remove packages from a Linux system.

Option 4: A file containing package metadata.

Correct Answer: 1

Explanation: In package management, a “repository” refers to a centralized location for storing and maintaining software packages. These repositories contain packages that can be downloaded, installed, or updated using package management tools.

Leave a Comment