LPI 101-500 Practice Test Questions and Exam Dumps Part 12 Q221-240

View Full LPI 101-500 Exam Dumps and Practice Test Dumps

 

Question: 221. Which file commonly lists the shells that are recognized as valid login shells on a Linux system?

  1. /etc/profile
    2. /etc/bashrc
    3. /etc/shells
    4. /etc/login.conf

Correct Answer: 3. /etc/shells

Explanation:

The /etc/shells file contains a list of valid login shells available on the system. Programs can consult this file when determining whether a particular shell is permitted as a user’s login shell. Common entries may include paths such as /bin/bash, /bin/sh, or other installed shells. It is different from /etc/passwd, which stores each user’s configured login shell as part of the account information. /etc/profile is instead a shell startup configuration file used by login shells. Understanding /etc/shells is important when working with user accounts and shell configuration on Linux systems.

Question: 222. What is the primary purpose of /etc/nologin when it exists on a Linux system?

  1. It prevents ordinary users from logging in while allowing appropriate administrative access
    2. It permanently deletes all user accounts
    3. It disables networking during system startup
    4. It changes the default command shell for every user

Correct Answer: 1. It prevents ordinary users from logging in while allowing appropriate administrative access

Explanation:

The /etc/nologin file is commonly used to temporarily prevent non-privileged users from logging into a Linux system. If the file exists, login programs may display its contents as a message explaining why logins are currently unavailable. This can be useful during maintenance, shutdown, or other administrative activities. Its presence does not mean that user accounts have been deleted or permanently disabled. The exact behavior can depend on the authentication and login mechanisms in use, but the standard concept tested in Linux administration is that /etc/nologin temporarily blocks ordinary user logins.

Question: 223. Which directory commonly contains programs intended primarily for system administration that are not normally needed by ordinary users?

  1. /home
    2. /usr/sbin
    3. /tmp
    4. /var/cache

Correct Answer: 2. /usr/sbin

Explanation:

The /usr/sbin directory commonly contains system-administration commands, particularly programs intended for use by administrators rather than ordinary users. Examples can include utilities involved in system services, account management, networking, and other administrative tasks. On modern Linux distributions, the traditional distinction between /bin, /sbin, /usr/bin, and /usr/sbin can be affected by filesystem unification, where some directories are symbolic links or merged into /usr. Nevertheless, understanding the conventional purpose of /usr/sbin remains relevant for Linux certification exams. It should not be confused with /home, which normally contains users’ personal directories.

Question: 224. What is the typical purpose of the /lib64 directory on a 64-bit Linux system?

  1. It stores temporary files created by applications
    2. It contains users’ home directories
    3. It stores system log files
    4. It commonly contains 64-bit shared libraries required by programs

Correct Answer: 4. It commonly contains 64-bit shared libraries required by programs

Explanation:

On systems that use a traditional filesystem layout, /lib64 commonly contains 64-bit shared libraries and related runtime components required by 64-bit programs. Shared libraries provide reusable code that applications can load instead of carrying separate copies of the same functionality. The exact directory structure varies between distributions and architectures, and some modern systems may use a unified /usr layout. Nevertheless, the conventional meaning of /lib64 is associated with 64-bit libraries. It should not be confused with /var/log, which stores logs, or /home, which normally contains users’ personal data and configuration files.

Question: 225. Which directory is commonly used for cached application or package data that can generally be regenerated if necessary?

  1. /var/cache
    2. /var/spool
    3. /boot
    4. /dev

Correct Answer: 1. /var/cache

Explanation:

The /var/cache directory is conventionally used for cached data generated by applications and system services. Cached information is generally stored to improve performance or avoid repeatedly downloading or generating the same information. A key characteristic of cache data is that it can often be regenerated when necessary, although deleting cache files may affect performance temporarily. This differs from /var/spool, which holds queued data waiting for processing, such as print or mail queues. /boot contains files involved in booting the system, while /dev provides device-related filesystem entries. These distinctions are useful when understanding Linux filesystem organization.

Question: 226. What type of data is conventionally stored under /var/spool?

  1. Kernel source code
    2. Files waiting in queues for later processing
    3. User home directories
    4. Bootloader configuration only

Correct Answer: 2. Files waiting in queues for later processing

Explanation:

The /var/spool directory is traditionally used for data that is waiting to be processed by a system service or application. Examples include print jobs waiting for a printer, mail waiting for delivery, or other queued tasks. Spooling allows a producer and consumer to operate at different times or speeds. This differs from /var/cache, where data is stored primarily for performance and can generally be regenerated. /var/spool is part of the variable-data hierarchy because its contents can change frequently as queued jobs are created, processed, and removed. Understanding these directory purposes helps administrators locate service-related data.

Question: 227. Which directory is intended for temporary files that may need to remain available longer than files in /tmp?

  1. /boot
    2. /etc
    3. /var/tmp
    4. /usr

Correct Answer: 3. /var/tmp

Explanation:

The /var/tmp directory is designed for temporary files that may need to persist across system reboots. In contrast, /tmp is intended for temporary data and may be cleaned more aggressively, depending on system configuration. The exact cleanup policy is distribution- and configuration-dependent, but the traditional distinction is that /var/tmp provides a more persistent location for temporary data. Neither directory should be treated as permanent storage for important user files. /var/tmp belongs under /var because its contents can change frequently. This distinction is useful when selecting an appropriate temporary storage location for scripts and applications.

Question: 228. Which command option causes ls to display file sizes in a human-readable format such as K, M, or G?

  1. ls -R
    2. ls -a
    3. ls -F
    4. ls -h

Correct Answer: 4. ls -h

Explanation:

The -h option of ls requests human-readable file sizes, typically when used together with a long listing such as ls -lh. Instead of displaying large byte counts that may be difficult to interpret quickly, the output can use units such as K, M, or G. The -a option displays hidden entries, -R recursively lists subdirectories, and -F adds indicators to certain filenames. Therefore, when the goal is specifically to make file sizes easier for humans to read, ls -h is the relevant option. Combining options is common when inspecting files interactively.

Question: 229. What does ls -R do?

  1. It displays only hidden files
    2. It recursively lists the contents of directories and their subdirectories
    3. It reverses filename sorting only
    4. It displays file sizes in gigabytes

Correct Answer: 2. It recursively lists the contents of directories and their subdirectories

Explanation:

The -R option tells ls to list directories recursively. When a directory contains subdirectories, ls -R enters those subdirectories and displays their contents as well, continuing through nested directory levels. This can be useful when you need a quick textual overview of an entire directory tree. It differs from ls -a, which reveals hidden entries, and ls -h, which makes file sizes human-readable. The recursive option can produce a large amount of output when used on a directory tree containing many files, so it should be used carefully on large filesystem hierarchies.

Question: 230. What does ls -F commonly add to directory listings?

  1. File type indicators such as / for directories
    2. Full inode tables for every file
    3. File contents after each filename
    4. Detailed ownership information

Correct Answer: 1. File type indicators such as / for directories

Explanation:

The -F option causes ls to append indicators to certain filenames so that users can more easily recognize file types. For example, a directory is commonly displayed with a trailing /, while an executable file may receive an asterisk. Symbolic links can also receive an appropriate indicator. This does not display file contents or provide the complete ownership and permission information associated with ls -l. The purpose of -F is visual identification of file types within a directory listing. It can be particularly convenient when working interactively at a shell prompt.

Question: 231. Which command can resolve a symbolic link to its final target path, following links recursively?

  1. echo
    2. basename
    3. readlink -f
    4. dirname

Correct Answer: 3. readlink -f

Explanation:

The readlink -f command can resolve a pathname by following symbolic links and producing a canonicalized absolute path when the relevant target path exists. This is useful in scripts when the actual location behind a symbolic link needs to be determined. basename extracts the final component of a pathname, while dirname extracts the directory portion. echo simply writes arguments to standard output and does not resolve links by itself. The exact behavior of canonicalization can depend on whether components of the path exist, but readlink -f is the standard command associated with fully resolving symbolic-link paths.

Question: 232. What is an important property of a hard link compared with a symbolic link?

  1. A hard link normally cannot cross filesystem boundaries
    2. A hard link always points to a different inode
    3. A hard link can reference any directory on another filesystem
    4. A hard link becomes broken whenever the original filename is removed

Correct Answer: 1. A hard link normally cannot cross filesystem boundaries

Explanation:

A hard link is another directory entry referring to the same inode as an existing file. Because the inode belongs to a particular filesystem, hard links normally cannot be created across different filesystem boundaries. Removing one filename does not destroy the underlying file as long as another hard link still references the inode. This differs from a symbolic link, which stores a pathname pointing to another object and can generally cross filesystem boundaries. Hard links also have restrictions, such as the normal prohibition against creating hard links to directories for ordinary users, helping prevent filesystem structures from becoming cyclic.

Question: 233. What is an inode in a Unix-like filesystem?

  1. A network address assigned to a computer
    2. A kernel process identifier
    3. A data structure containing filesystem metadata about a file
    4. A shell variable containing the current directory

Correct Answer: 3. A data structure containing filesystem metadata about a file

Explanation:

An inode is a filesystem data structure that stores metadata about a filesystem object, such as ownership, permissions, timestamps, file type, and information used to locate the file’s data blocks. The filename itself is generally stored in a directory entry that maps the name to an inode number. This is why multiple hard links can reference the same inode while having different filenames. Inodes are fundamental to understanding Unix-like filesystems and file identity. The exact inode structure and allocation details vary by filesystem implementation, but the general concept remains central to Linux filesystem administration.

Question: 234. What is the purpose of the du -sh command when used with a directory?

  1. It displays all running processes
    2. It shows the total disk usage of the directory in a human-readable form
    3. It changes the directory permissions
    4. It removes unused files from the directory

Correct Answer: 2. It shows the total disk usage of the directory in a human-readable form

Explanation:

The du -sh command is commonly used to obtain a concise, human-readable summary of disk usage. The -s option requests a summary rather than listing usage for every nested item, while -h formats sizes in units that are easier for humans to interpret. For example, a directory might be reported using megabytes or gigabytes rather than a large number of filesystem blocks. du measures space associated with files and directories, whereas df reports filesystem-level space usage. Therefore, du -sh is especially useful when identifying how much space a particular directory hierarchy consumes.

Question: 235. What does the -h option commonly do when used with df?

  1. It hides mounted filesystems
    2. It displays filesystem space values in human-readable units
    3. It deletes unused filesystem blocks
    4. It changes the filesystem type

Correct Answer: 2. It displays filesystem space values in human-readable units

Explanation:

The -h option of df requests human-readable filesystem size information. Instead of displaying large values primarily as raw blocks, the command can present values using units such as K, M, G, or T. For example, df -h is commonly used when administrators want a quick overview of filesystem capacity, used space, available space, and utilization percentages. This option does not modify the filesystem or delete data. It only changes how the reported values are presented. Understanding the distinction between presentation options and filesystem-modifying commands is important when working safely from the Linux command line.

Question: 236. What is a mount point in Linux?

  1. A process that automatically mounts every disk
    2. A special type of executable file
    3. A directory where a filesystem is attached and made accessible
    4. A user account used for mounting devices

Correct Answer: 3. A directory where a filesystem is attached and made accessible

Explanation:

A mount point is a directory in the existing filesystem hierarchy where another filesystem is attached and made accessible. Once mounted, the contents of the mounted filesystem appear through that directory. For example, a separate filesystem might be mounted at /mnt/data or another appropriate directory. The mount point itself is not a special executable program or user account. Linux presents filesystems through a unified directory tree, so mounting provides the connection between a filesystem device or source and a location in that tree. Understanding mount points is essential for managing disks and filesystems.

Question: 237. What does mount -a generally do?

  1. It attempts to mount all appropriate filesystems listed in /etc/fstab
    2. It removes all existing mounts
    3. It formats every available disk
    4. It lists only unmounted devices

Correct Answer: 1. It attempts to mount all appropriate filesystems listed in /etc/fstab

Explanation:

The mount -a command tells the mount utility to attempt mounting all filesystems listed in /etc/fstab that are configured for automatic mounting. Entries that are marked with the appropriate options are considered, while entries such as those using noauto are excluded from automatic mounting. This command is often useful after editing /etc/fstab to test or activate configured mounts without rebooting. It does not format disks or remove existing mounts. Administrators should verify /etc/fstab carefully before using mount -a, because incorrect entries can cause mounting errors.

Question: 238. In the output of ps, what does a process state of Z generally indicate?

  1. The process is actively running on a CPU
    2. The process is sleeping normally
    3. The process is stopped by a terminal
    4. The process is a zombie waiting for its parent to collect its exit status

Correct Answer: 4. The process is a zombie waiting for its parent to collect its exit status

Explanation:

A process with a Z state is generally a zombie process. A zombie has already terminated, so it is no longer executing, but an entry remains in the process table because its parent has not yet collected its termination status through an appropriate wait operation. Zombies therefore do not consume CPU time like active processes, although they occupy process-table resources. The appropriate solution is usually to address the parent process or the software responsible for failing to reap child processes. Simply sending ordinary termination signals to a process that has already exited does not make the zombie execute again.

Question: 239. Which signal is sent by kill -9?

  1. SIGTERM
    2. SIGKILL
    3. SIGSTOP
    4. SIGCONT

Correct Answer: 2. SIGKILL

Explanation:

The command kill -9 sends signal number 9, which is SIGKILL on standard Linux systems. SIGKILL requests immediate termination and cannot be caught, blocked, or handled by the target process. This makes it significantly different from SIGTERM, which allows a program an opportunity to perform cleanup before exiting. Because SIGKILL prevents normal cleanup handling, it should generally not be the first choice when a process can be terminated gracefully. SIGSTOP stops a process, while SIGCONT resumes a stopped process. Understanding these signal differences is important for process management.

Question: 240. Which shell parameter represents the number of positional parameters supplied to a shell script or function?

  1. $?
    2. $0
    3. $#
    4. $PWD

Correct Answer: 3. $#

Explanation:

The special shell parameter $# contains the number of positional parameters supplied to a shell script or function. For example, if a script is executed with three arguments, $# evaluates to 3. $0 generally represents the name used to invoke the script or function context, while $? contains the exit status of the most recently executed command. $PWD normally contains the current working directory maintained by the shell. Positional parameters such as $1, $2, and so on contain individual arguments, making $# useful for checking how many arguments were supplied.