Exams Knowledge Hub

MCQs for Competitive Exams, School & College Exams

Module: | Base R Data Structures & Subsetting

Q8: Consider the following statements regarding compression and file connections in R 4.4.0:

1. R uses connection objects such as file() and gzfile() to read and write directly from compressed data streams without needing to uncompress the files to disk first.
2. The R 4.4.0 release officially added native system support for zstd compression via the newly implemented zstdfile() function.
3. While zstd generally offers slightly worse compression ratios than xz under default tuning parameters, it executes read and write operations significantly faster.

Which of the above statements is/are correct?
A
Only 1 and 2
B
Only 2 and 3
C
Only 1 and 3
D
1, 2, and 3
✅ Correct Answer: D
🎯 Quick Answer:
D. All three statements accurately describe the compression updates in R.
Concept Definition: Connections in R are specialized interfaces used for flexible I/O operations (input/output) across various network protocols, local files, and compression algorithms. zstd (Zstandard) is a fast, lossless compression algorithm originally developed by Facebook.
Structural Breakdown: Users can route serialized R objects (like standard .rds files) directly through gzfile() for GZIP, bzfile() for BZIP2, xzfile() for LZMA/XZ, and now natively through zstdfile() for Zstandard compression.
Historical/Related Context: Handling massive datasets locally in R heavily taxes local disk I/O. The traditional xz format offered excellent compression but was notoriously slow to decompress, heavily hampering data pipeline efficiency.
Causal Reasoning: To dramatically accelerate read/write speeds for large data objects, the R 4.4.0 update natively integrated the zstd library.
By leveraging zstdfile(), data scientists can compress files with speeds rivaling uncompressed writes while maintaining reasonable file sizes, highly optimizing storage-bound workflows.