R Programming Language Multiple Choice Questions on “Textual Data Formats”.
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
Answer: a
Clarification: 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()
Answer: a
Clarification: 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()
Answer: d
Clarification: 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).
4. dput() output is in the form of ___________
a) R code
b) text file code
c) binary code
d) both binary and text
Answer: a
Clarification: 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()
Answer: a
Clarification: 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()
Answer: a
Clarification: 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
Answer: a
Clarification: 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.
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()
Answer: a
Clarification: 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()
Answer: b
Clarification: 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.
10. .rda extension used when saving data with function __________
a) save()
b) save.image()
c) save and save.image functions
d) serialize()
Answer: c
Clarification: 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()
Answer: c
Clarification: 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
Answer: a
Clarification: 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()
Answer: d
Clarification: 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
Answer: a
Clarification: 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
Answer: b
Clarification: 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.