250+ TOP MCQs on Compressing and Archiving Files and Answers

Unix Multiple Choice Questions on “Compressing and Archiving Files”.

1. Which of the following is used to compress files?
a) cmp
b) gzip
c) gunzip
d) comm

Answer: b
Clarification: To conserve disk space we need to compress a file. gzip is a very popular program used with one or more filenames for compression.

2. Which one of the following extension is provided by gzip to the compressed filename?
a) .cm
b) .gz
c) .zip
d) .zp

Answer: b
Clarification: gzip adds an extension to the filename after compressing it and removes the original file. For example, if we compress a file named file01.txt using gzip then the new filename will be file01.txt.gz.

3. Which option is used with gzip command to check compression ratio for files?
a) -l
b) -c
c) -e
d) -x

Answer: a
Clarification: Compression ratio is the ratio of, size of the original file to the size of a compressed file. We can check how much compression ratio is achieved using -l option with gzip.

$ gzip -l abd.txt.gz  file01.txt.gz
Compressed    Uncompressed        Ratio    	Uncompressed name
788096        3875302             79.6%    	 abd.txt
128341        372267              65.5%    	 file01.txt
916437        4247569             78.9%    	 (totals)

4. We can provide original filenames without .gz extension while checking compression ratio using gzip – l?
a) True
b) False

Answer: a
Clarification: Specifying the .gz extension is an optional feature which may be neglected. The command will work properly even without the extension.

5. Which option is used with gzip command for recursive compression?
a) -c
b) -l
c) -d
d) -r

Answer: d
Clarification: Like many other UNIX commands, we can perform recursive compression. Through this process, we can compress all files in the directory. To perform this operation, -r option is used with gzip command.

$ gzip  -r  dir_01        		// compress all files  in dir_01

6. Which of the following is used for decompressing files?
a) GZIP
b) gunzip
c) uncmp
d) cmp

Answer: b
Clarification: To restore our original and uncompressed file we can use gunzip with filename as an argument.

7. We cannot uncompress files using gzip.
a) True
b) False

Answer: b
Clarification: gzip can also be used to uncompress files, all we have to do is to use -d option with gzip command.

8. We can provide multiple filenames as arguments to gunzip.
a) True
b) False

Answer: a
Clarification: Multiple files can be unzipped using gunzip command by providing multiple filenames as arguments to the command.

9. Which of the following is a better agent than gzip?
a) bzip2
b) bzip2 and bunzip2
c) bunzip2
d) allzip

Answer: b
Clarification: For many years, gzip remained as the most favorite compression utility but now we have a better one called bzip2 (bzip2 and bunzip2). bzip2 is slower than gzip and it creates files with .bz2 extension.

10. Which of the following is an archival program?
a) arch
b) archive
c) ar
d) tar

Answer: d
Clarification: For archiving files to the disk we use tar. It can be used to archive a group of files or an entire directory structure. tar program provides a handful of utilities like creating, maintaining, modifying and extracting files that are in tar format. Tar stands for ‘tape archival’.

Leave a Reply

Your email address will not be published. Required fields are marked *