R Programming Questions and Answers – Textual Data Formats – 2

This set of R Programming Language Multiple Choice Questions & Answers (MCQs) focuses on “Textual Data Formats – 2”.

1. Unlike writing out a table or CSV file, dump() and dput() preserve the ______ so that another user doesn’t have to specify the all over again.
a) metadata
b) backup data
c) attribute data
d) normal data
View Answer

Answer: a
Explanation: The read.table() function is one of the most commonly used functions for reading data. The help file with read.table() is worth reading in its entirety if only because the function gets used a lot.

2. One way to pass data around is by de parsing the R object with _________
a) dput()
b) write()
c) read()
d) dget()
View Answer

Answer: a
Explanation: dput is used for outputting a textual representation of an R object. The dump() and dput() functions are useful because the resulting textual format is editable, and in the case of corruption, potentially recoverable.

3. Main way to read the data back in (parsing it) using the function.
a) dput()
b) write()
c) read()
d) dget()
View Answer

Answer: d
Explanation: One way to pass data around is by deparsing the R object with dput() and reading it back in (parsing it) using dget(). dget is used for reading in R code files (inverse of dput).
advertisement
advertisement

4. dput() output is in the form of ___________
a) R code
b) text file code
c) binary code
d) both binary and text
View Answer

Answer: a
Explanation: dput is used for outputting a textual representation of an R object. The dump() and dput() functions are useful because the resulting textual format is editable, and in the case of corruption, potentially recoverable.

5. Multiple objects can be de parsed at once using the ______ function.
a) dput()
b) write()
c) dump()
d) dget()
View Answer

Answer: a
Explanation: dput is used for outputting a textual representation of an R object. The dump() and dput() functions are useful because the resulting textual format is editable, and in the case of corruption, potentially recoverable.

6. Multiple objects can be de parsed at once and read back using function _____
a) source()
b) read()
c) dget()
d) dput()
View Answer

Answer: a
Explanation: Martin Machler made an important contribution by making Ross and Robert use the GNU General Public License to make R free software. This was critical because this allowed for the source code for the entire R system to be accessible to anyone who wanted to tinker with it.

7. We can dump() R objects to a file by passing _____
a) character vector of their names
b) object name
c) arguments
d) file name
View Answer

Answer: a
Explanation: Dump is used for dumping a textual representation of multiple R objects. Descriptive representation of an R object by using the dput() or dump() functions. The dump() and dput() functions are useful because the resulting textual format is editable, and in the case of corruption, potentially recoverable.
advertisement

8. If we want to save individual R objects to a file, we use the _______ function.
a) save()
b) save.image()
c) serialize()
d) deserialize()
View Answer

Answer: a
Explanation: Save is used for saving an arbitrary number of R objects with a binary format (possibly compressed) to a file. The output of dput() can also be saved directly to a file.

9. If you have a lot of objects that you want to save to a file, we use ________ function.
a) save()
b) save.image()
c) serialize()
d) deserialize()
View Answer

Answer: b
Explanation: Save is used for saving an arbitrary number of R objects with a binary format (possibly compressed) to a file. The output of dput() can also be saved directly to a file. Save.Image can be used mostly in R.
advertisement

10. .rda extension used when saving data with function __________
a) save()
b) save.image()
c) save and save.image functions
d) serialize()
View Answer

Answer: c
Explanation: Save is used for saving an arbitrary number of R objects with a binary format (possibly compressed) to a file. The output of dput() can also be saved directly to a file. Save.Image can be used mostly in R.

11. .RData extension used when we save data using the functions ___________
a) save()
b) save.image()
c) save and save.image functions
d) serialize()
View Answer

Answer: c
Explanation: Save is used for saving an arbitrary number of R objects with a binary format (possibly compressed) to a file. The output of dput() can also be saved directly to a file. Save.Image can be used mostly in R.

12. When you call serialize() on an R object, the output will be ____ coded in hexadecimal format.
a) raw vector
b) character vector
c) integer vector
d) binary vector
View Answer

Answer: a
Explanation: When you call serialize() on an R object, the output will be raw vector coded in hexadecimal format. Serialize is used for converting an R object into a binary format for outputting to a connection.

13. The benefit of the _____ function is that it is the only way to perfectly repressed an R object in an exportable format, without losing precision or any metadata.
a) save()
b) save.image()
c) unserialize()
d) serialize()
View Answer

Answer: d
Explanation: Unserialize is used for reading single R objects in the binary form. Serialize is used for converting an R object into a binary format for outputting to a connection (or file).

14. load() is used for _______
a) reading
b) loading
c) working
d) not exist
View Answer

Answer: a
Explanation: Load is used for reading in saved workspaces. After installing the package it is important that you load it into your R session with the library() function. you can load the data into R using the readRDS() function.

15. readlines is used for ____________
a) working on data
b) reading files
c) reading lines in files
d) not exist
View Answer

Answer: b
Explanation: ReadLines is used for reading lines of a text file. you can load the data into R using the readRDS() function. Text files can be read line by line using the readLines() function. This function is useful for reading text files that may be unstructured or contain non-standard data.

Sanfoundry Global Education & Learning Series – R Programming Language.

Here’s the list of Best Books in R Programming Language .

To practice all areas of R Programming Language, Here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.