LPI 010-160 Practice Test 88
Question 870
A script `greet.sh` receives a person's name as its first argument. Select TWO statements that together form an appropriate implementation and validation plan.
- The script uses the value supplied as its first command-line argument.
- Assume arguments can be read only from environment variables.
- Use `$0` as the first user-supplied argument.
- Refer to `$1` in the script for the first positional argument.
- Use `$?` to obtain the first filename.
Explanation
Correct Answers
A:The script uses the value supplied as its first command-line argument. This provides direct evidence of the intended Positional command-line arguments behavior.
D:Refer to `$1` in the script for the first positional argument. This is the actual implementation for Positional command-line arguments.
Incorrect Answers
B:Assume arguments can be read only from environment variables. This does not contribute a sound implementation or validation step for Positional command-line arguments. Confusing parameter indexes can print the wrong input.
C:Use `$0` as the first user-supplied argument. This does not contribute a sound implementation or validation step for Positional command-line arguments. Confusing parameter indexes can print the wrong input.
E:Use `$?` to obtain the first filename. This does not contribute a sound implementation or validation step for Positional command-line arguments. Confusing parameter indexes can print the wrong input.
Question 871
A Linux VM appears to be under memory pressure and an operator wants available RAM figures. Select TWO statements that together form an appropriate implementation and validation plan.
- Use `grep /etc/passwd` to measure memory.
- Treat `touch` output as the swap usage report.
- Run `df` as the direct summary of physical RAM.
- The output reports memory and swap figures in the selected units.
- Run `free -h` or `free` to inspect memory and swap totals.
Explanation
Correct Answers
D:The output reports memory and swap figures in the selected units. This provides direct evidence of the intended free memory statistics behavior.
E:Run `free -h` or `free` to inspect memory and swap totals. This is the actual implementation for free memory statistics.
Incorrect Answers
A:Use `grep /etc/passwd` to measure memory. This does not contribute a sound implementation or validation step for free memory statistics. A disk listing cannot distinguish RAM from swap usage.
B:Treat `touch` output as the swap usage report. This does not contribute a sound implementation or validation step for free memory statistics. A disk listing cannot distinguish RAM from swap usage.
C:Run `df` as the direct summary of physical RAM. This does not contribute a sound implementation or validation step for free memory statistics. A disk listing cannot distinguish RAM from swap usage.
Question 872
A script needs to save the output of `date` to a variable for later use. Select TWO statements that together form an appropriate implementation and validation plan.
- Use `echo date` to obtain a live date string.
- Set `stamp='date'` expecting the command's current output.
- Use command substitution such as `stamp=$(date)` and quote the result when needed.
- Use `$?` to capture stdout rather than an exit status.
- The variable contains the command's stdout value.
Explanation
Correct Answers
C:Use command substitution such as `stamp=$(date)` and quote the result when needed. This is the actual implementation for Command substitution in scripts.
E:The variable contains the command's stdout value. This provides direct evidence of the intended Command substitution in scripts behavior.
Incorrect Answers
A:Use `echo date` to obtain a live date string. This does not contribute a sound implementation or validation step for Command substitution in scripts. Writing a command name as a string does not execute it.
B:Set `stamp='date'` expecting the command's current output. This does not contribute a sound implementation or validation step for Command substitution in scripts. Writing a command name as a string does not execute it.
D:Use `$?` to capture stdout rather than an exit status. This does not contribute a sound implementation or validation step for Command substitution in scripts. Writing a command name as a string does not execute it.
Question 873
A small web application needs persistent relational tables and SQL queries. Select TWO statements that together form an appropriate implementation and validation plan.
- Use only GIMP image layers to store structured application records.
- SQL queries retrieve stored records through the configured database service.
- Set a Firefox browser profile as the relational database.
- Install MariaDB or MySQL and create the required schema and user permissions.
- Use NFS exports instead of SQL tables.
Explanation
Correct Answers
B:SQL queries retrieve stored records through the configured database service. This provides direct evidence of the intended MariaDB and MySQL data stores behavior.
D:Install MariaDB or MySQL and create the required schema and user permissions. This is the actual implementation for MariaDB and MySQL data stores.
Incorrect Answers
A:Use only GIMP image layers to store structured application records. This does not contribute a sound implementation or validation step for MariaDB and MySQL data stores. Choosing an HTTP server alone does not provide relational tables.
C:Set a Firefox browser profile as the relational database. This does not contribute a sound implementation or validation step for MariaDB and MySQL data stores. Choosing an HTTP server alone does not provide relational tables.
E:Use NFS exports instead of SQL tables. This does not contribute a sound implementation or validation step for MariaDB and MySQL data stores. Choosing an HTTP server alone does not provide relational tables.
Question 874
A student wants to combine a project directory into one archive without removing the original files. Select TWO statements that together form an appropriate implementation and validation plan.
- Run `tar -cf project.tar project/` to create an uncompressed archive.
- Run `tar -xf project.tar project/` expecting to create a new archive.
- Use `unzip project/` to create a tar file.
- The archive lists the intended files when inspected.
- Use `gzip project/` to collect an entire directory into one tar archive.
Explanation
Correct Answers
A:Run `tar -cf project.tar project/` to create an uncompressed archive. This is the actual implementation for Creating a tar archive.
D:The archive lists the intended files when inspected. This provides direct evidence of the intended Creating a tar archive behavior.
Incorrect Answers
B:Run `tar -xf project.tar project/` expecting to create a new archive. This does not contribute a sound implementation or validation step for Creating a tar archive. Compression is not automatically enabled by every tar archive creation.
C:Use `unzip project/` to create a tar file. This does not contribute a sound implementation or validation step for Creating a tar archive. Compression is not automatically enabled by every tar archive creation.
E:Use `gzip project/` to collect an entire directory into one tar archive. This does not contribute a sound implementation or validation step for Creating a tar archive. Compression is not automatically enabled by every tar archive creation.
Question 875
A script is readable but not marked executable, and a user wants to run it explicitly. Select TWO statements that together form an appropriate implementation and validation plan.
- Use `./script.sh` and assume executable permissions are never checked.
- Invoke `bash script.sh` to have Bash read the script when permitted.
- Use `chmod -r` as the method for making a script runnable.
- The Bash process executes the script contents.
- Run `echo script.sh` expecting the script to execute.
Explanation
Correct Answers
B:Invoke `bash script.sh` to have Bash read the script when permitted. This is the actual implementation for Script invocation via bash.
D:The Bash process executes the script contents. This provides direct evidence of the intended Script invocation via bash behavior.
Incorrect Answers
A:Use `./script.sh` and assume executable permissions are never checked. This does not contribute a sound implementation or validation step for Script invocation via bash. Confusing direct `./script.sh` execution with `bash script.sh` changes permission requirements.
C:Use `chmod -r` as the method for making a script runnable. This does not contribute a sound implementation or validation step for Script invocation via bash. Confusing direct `./script.sh` execution with `bash script.sh` changes permission requirements.
E:Run `echo script.sh` expecting the script to execute. This does not contribute a sound implementation or validation step for Script invocation via bash. Confusing direct `./script.sh` execution with `bash script.sh` changes permission requirements.
Question 876
A trainee connects a removable USB drive and must identify the correct device before working on it. Select TWO statements that together form an appropriate implementation and validation plan.
- Assume every USB stick is always `/dev/sda`.
- Copy files directly into `/proc` as the USB filesystem.
- Treat the device's vendor label as a shell executable.
- Identify the USB storage block device and its mounted filesystem before copying data.
- The correct mounted volume contains the expected files.
Explanation
Correct Answers
D:Identify the USB storage block device and its mounted filesystem before copying data. This is the actual implementation for Removable USB block storage.
E:The correct mounted volume contains the expected files. This provides direct evidence of the intended Removable USB block storage behavior.
Incorrect Answers
A:Assume every USB stick is always `/dev/sda`. This does not contribute a sound implementation or validation step for Removable USB block storage. Writing to the wrong block device can damage another disk's data.
B:Copy files directly into `/proc` as the USB filesystem. This does not contribute a sound implementation or validation step for Removable USB block storage. Writing to the wrong block device can damage another disk's data.
C:Treat the device's vendor label as a shell executable. This does not contribute a sound implementation or validation step for Removable USB block storage. Writing to the wrong block device can damage another disk's data.
Question 877
A student needs a copy of a directory and all nested files. Select TWO statements that together form an appropriate implementation and validation plan.
- Use `cp -r project project-backup` to copy the directory tree.
- The destination includes the nested files while the original remains.
- Use `cp project project-backup` expecting every nested directory on standard cp.
- Use `mv` while expecting the source tree to remain.
- Run `touch project-backup` to clone nested files.
Explanation
Correct Answers
A:Use `cp -r project project-backup` to copy the directory tree. This is the actual implementation for cp -r directory trees.
B:The destination includes the nested files while the original remains. This provides direct evidence of the intended cp -r directory trees behavior.
Incorrect Answers
C:Use `cp project project-backup` expecting every nested directory on standard cp. This does not contribute a sound implementation or validation step for cp -r directory trees. Copying only one file will not preserve child directories.
D:Use `mv` while expecting the source tree to remain. This does not contribute a sound implementation or validation step for cp -r directory trees. Copying only one file will not preserve child directories.
E:Run `touch project-backup` to clone nested files. This does not contribute a sound implementation or validation step for cp -r directory trees. Copying only one file will not preserve child directories.
Question 878
A student sees `-rw-r-----` and needs to identify owner, group and other access. Select TWO statements that together form an appropriate implementation and validation plan.
- Read the three user/group/other triples in `ls -l` output.
- Treat the initial `-` in the listing as a write bit.
- The displayed permissions indicate the intended read, write and execute rights per class.
- Infer file ownership solely from the filename extension.
- Assume `rwx` applies to everyone regardless of its position.
Explanation
Correct Answers
A:Read the three user/group/other triples in `ls -l` output. This is the actual implementation for ls -l permission string interpretation.
C:The displayed permissions indicate the intended read, write and execute rights per class. This provides direct evidence of the intended ls -l permission string interpretation behavior.
Incorrect Answers
B:Treat the initial `-` in the listing as a write bit. This does not contribute a sound implementation or validation step for ls -l permission string interpretation. Misreading a group bit as an owner bit can lead to wrong access decisions.
D:Infer file ownership solely from the filename extension. This does not contribute a sound implementation or validation step for ls -l permission string interpretation. Misreading a group bit as an owner bit can lead to wrong access decisions.
E:Assume `rwx` applies to everyone regardless of its position. This does not contribute a sound implementation or validation step for ls -l permission string interpretation. Misreading a group bit as an owner bit can lead to wrong access decisions.
Question 879
A trainee needs an open-source graphical browser for researching Linux documentation. Select TWO statements that together form an appropriate implementation and validation plan.
- Install Apache HTTP Server to obtain a graphical browser.
- Run dpkg as if it rendered websites.
- Use LibreOffice Impress to browse HTTP pages.
- The expected web pages render in a browser with visible URL and connection information.
- Use Firefox to visit HTTPS sites and adjust browser privacy settings as required.
Explanation
Correct Answers
D:The expected web pages render in a browser with visible URL and connection information. This provides direct evidence of the intended Firefox web browsing behavior.
E:Use Firefox to visit HTTPS sites and adjust browser privacy settings as required. This is the actual implementation for Firefox web browsing.
Incorrect Answers
A:Install Apache HTTP Server to obtain a graphical browser. This does not contribute a sound implementation or validation step for Firefox web browsing. Confusing an HTTP server with a browser reverses the client/server roles.
B:Run dpkg as if it rendered websites. This does not contribute a sound implementation or validation step for Firefox web browsing. Confusing an HTTP server with a browser reverses the client/server roles.
C:Use LibreOffice Impress to browse HTTP pages. This does not contribute a sound implementation or validation step for Firefox web browsing. Confusing an HTTP server with a browser reverses the client/server roles.
Question 880
A parent shell sets `API_MODE=test` and wants a child process to receive it. Select TWO statements that together form an appropriate implementation and validation plan.
- Run `unset API_MODE` to publish the variable.
- Run `export API_MODE=test` or export an existing variable before launching the child.
- A child process displays the inherited value from its environment.
- Assume every local variable is automatically exported.
- Store the variable only in a terminal's title bar.
Explanation
Correct Answers
B:Run `export API_MODE=test` or export an existing variable before launching the child. This is the actual implementation for Exported environment variables.
C:A child process displays the inherited value from its environment. This provides direct evidence of the intended Exported environment variables behavior.
Incorrect Answers
A:Run `unset API_MODE` to publish the variable. This does not contribute a sound implementation or validation step for Exported environment variables. A nonexported shell-only variable is not automatically inherited by child programs.
D:Assume every local variable is automatically exported. This does not contribute a sound implementation or validation step for Exported environment variables. A nonexported shell-only variable is not automatically inherited by child programs.
E:Store the variable only in a terminal's title bar. This does not contribute a sound implementation or validation step for Exported environment variables. A nonexported shell-only variable is not automatically inherited by child programs.