NDG Linux Essentials 2.21 | Archiving and Compression Module 9 | Chapter 09 Exam Answers Full 100% 2023
These are questions of Cisco NDG Linux Essentials 2.21 Archiving and Compression Chapter 09 Exam Answers full 100% with the latest version and updated in 2023. All answers are verified by experts with explanations.
-
Compression of a file works by:
- Storing most of the data on removable media and just leaving a pointer
- Consolidating multiple files into one
- Eliminating gaps within the file
- Removing the high order bit from each byte
- Removing redundant information
-
Answers Explanation & Hint: File compression techniques aim to reduce the file size by identifying and eliminating redundant or repetitive data in the file. Redundant information is data that appears more than once within the file or can be predicted or represented more efficiently using fewer bits or symbols.
There are different compression algorithms and methods that achieve this goal. The result is a smaller compressed file that can be stored or transmitted more efficiently, taking up less storage space or requiring less bandwidth. When you decompress or uncompress the file, it can be restored to its original form, retaining its original content and structure.
-
In general, for which of the following would you want to use lossless compression?
- An mp3 audio file
- A log file
- A movie
- A JPEG image
- An encrypted email
-
Answers Explanation & Hint: In general, you would want to use lossless compression for the following:
- A log file: Log files typically contain important records and data entries that need to be preserved accurately for analysis and debugging. Lossless compression ensures that no information is lost during compression and decompression, maintaining the integrity of the log data.
- An encrypted email: Encrypted emails are important for secure communication, and any loss of data in the encrypted message could compromise its confidentiality and integrity. Lossless compression ensures that the encrypted content remains intact and can be decrypted correctly.
Lossless compression algorithms guarantee that the original data can be perfectly reconstructed after compression and decompression, without any loss of information. This is in contrast to lossy compression, which sacrifices some data to achieve higher compression ratios, making it suitable for scenarios where some loss of quality is acceptable, such as multimedia files like MP3 audio, movies, and JPEG images.
-
Lossy compression:
(choose three)
- Is often used with documents
- Usually results better compression than lossless
- Is often used with images
- Sacrifices some quality
- Decompresses to an identical version as the original
-
Answers Explanation & Hint: - Usually results in better compression than lossless: Lossy compression generally achieves higher compression ratios than lossless compression. By sacrificing some quality and discarding non-essential data, lossy compression can significantly reduce file sizes.
- Is often used with images: Lossy compression is commonly used for image files, such as JPEG format, in applications where some loss of image quality is acceptable to achieve smaller file sizes.
- Sacrifices some quality: As mentioned, lossy compression intentionally discards certain data to achieve higher compression, resulting in a loss of quality compared to the original data.
Lossy compression is well-suited for scenarios where some loss of quality is acceptable, such as in multimedia applications like images, videos, and audio files. It is often used to achieve higher levels of compression compared to lossless compression, which can lead to significant reductions in file size. However, it is not appropriate for documents or data where preserving every detail is essential.
-
You type
gzip myfile.tar
. What happens?(choose two)
myfile.tar
is unarchived into the current directorymyfile.tar
is removedmyfile.tar.gz
holds a compressed version ofmyfile.tar
- An error; you forgot to specify the file with
-f
- An error; you forgot to pass the name of the output file
-
Answers Explanation & Hint: myfile.tar
is removed: When you use thegzip
command to compress a file, it replaces the original file (myfile.tar
in this case) with the compressed version (myfile.tar.gz
). The original file is removed, and only the compressed file remains.myfile.tar.gz
holds a compressed version ofmyfile.tar
: Thegzip
command compresses the filemyfile.tar
and creates a new file namedmyfile.tar.gz
, which holds the compressed version of the original file.
-
How would you obtain output similar to the following?
compressed uncompressed ratio uncompressed_nam
278168 1016950 72.6% tags
gunzip –t tags
file tags
>gzip –l tags
-
Answers Explanation & Hint: The command
gzip -l tags
provides the output similar to the format you mentioned:compressed uncompressed ratio uncompressed_name 278168 1016950 72.6% tags
The
gzip -l
command provides a listing of compression details for the file “tags.” It displays the compressed and uncompressed sizes and calculates the compression ratio, providing the output in the specified format.Thank you for providing the correct command, and I apologize for any confusion caused by my earlier responses.
-
Which command would you use to archive the
Documents
directory and compress it withbzip2
compression?tar –cjf Documents
tar –fzc Documents documents.tbz
tar –czf documents.tbz
tar –cf Documents documents.tbz
tar –cjf documents.tbz Documents
-
Answers Explanation & Hint: The correct command to archive the “Documents” directory and compress it with bzip2 compression is
tar -cjf documents.tbz Documents
Explanation:
tar
: Thetar
command is used for archiving files and directories.-c
: This option tellstar
to create a new archive.-j
: This option specifies bzip2 compression.-f
: This option allows you to specify the filename of the archive.documents.tbz
: This is the name of the compressed archive that will be created.Documents
: This is the name of the directory to be archived and compressed.
The command will create a new archive named “documents.tbz” that contains the “Documents” directory, compressed using bzip2 compression.
-
Which flag would you pass to
tar
in order to have it make a new archive?-n
-t
-x
-j
-c
-
Which command will show what is inside the compressed tarball with a name of
foo.tar.gz
?tar –tzf foo.tar.gz
tar –tf foo.tar.gz
tar –tjf foo.tar.gz
tar –lf foo.tar.gz
tar –xf foo.tar.gz
-
In the command
tar-cvjf foo.tbz a b c
, what area, b,
andc
?- Matching operators; anything starting with a, b, or c will be added
- Nothing; –
cvjf
only expects one parameter - Extra flags passed to tar
- File names to be added to the archive
- a is the directory that will be prepended to files; b and c are files inside it
-
Given the command
tar –cvjf homedirs.tbz /home
, which of the following are true?(choose two)
- The
/home
directory will be restored with the contents ofhomedirs.tbz
- The output file will be compressed
- Only files starting with
/home
will be extracted from the archive - Files that are present in the archive might overwrite files in
/home
- The command will print out each filename as it is processed
- The
-
You archived your users’ directories into a file called
backup.tar.gz.
You then view the archive and see the filenames follow this convention:home/username/somefile
How will you extract just the files for the user called fred?
tar –tjf backup.tar.gz /home/fred
tar –xjf backup.tar.gz home/fred/
tar –tzf /home/fred < backup.tar.gz
tar –xzf backup.tar.gz fred
tar –xzf backup.tar.gz home/fred/
-
Which of the following commands will create a zipfile with the contents of your
Documents
directory?zip –c mydocs.zip Documents
zip mydocs.zip Documents
zip –f mydocs.zip Documents
zip -cf mydocs.zip Documents
zip -r mydocs.zip Documents
-
Given a file called
documents.zip
, how can you see what’s in it without extracting the files?unzip -l documents.zip
zip -lf documents.zip
showzip documents.zip
unzip --list documents.zip
zip -l documents.zip
-
Given a file called
documents.zip
, how can you extract just the files under ProjectX?unzip documents.zip Project
unzip documents.zip ProjectX/*
zip -x documents.zip ProjectX
unzip documents.zip | grep ProjectX
unzip -t documents.zip ProjectX
-
You try to compress a file that is already compressed. Which of the following statements is true?
- The file will actually be uncompressed
- The compression algorithm needs to be set to the “currently compressed” mode for it to be compressed further
- The file will not be compressed any further than it already was
- The file changed while you were compressing it
- The file will be deleted
-
Which of the following commands can be used to compress a file?
(choose three)
cat
zip
bunzip2
gzip
bzip2
-
The three main modes of
tar
are:(choose three)
- Create
- Copy
- Extract
- Compress
- List
-
In the command
tar -czf foo.tar.gz bar
, what is the purpose of thef
flag?- Tells tar to copy only files, and not directories
- Tells tar to write to the file that follows the flag
- Tells tar to read from the file that follows the flag
- Tells tar to print the name of each file as it is processed
- Specifies extra compression is to be used
-
Which two commands do the same thing?
(choose two)
tar -czf foo.tar.gz foo
tar -c foo | gzip > foo.tar.gz
tar -x foo | gzip
tar -tzf foo.tar.gz
tar -xzf foo.tar.gz
-
Which two programs use the Lempel-Ziv-Markov chain algorithm?
(choose two)
bzip
lossless
gzip
lossy
xz
-
By default, the
zip
command replaces uncompressed files with compressed files.True or False?
- True
- False