Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

1. Individual R objects can be saved to a file using the _____ function.
a) save
b) put
c) save_image
d) none of the mentioned

View Answer

Answer: a [Reason:] The key functions for converting R objects into a binary format are save(), save.image(), and serialize().

2. Point out the correct statement :
a) The complement to the textual format is the binary format
b) If you have a lot of objects that you want to save to a file, you can save all objects in your workspace using the save.image() function
c) The serialize() function is used to convert individual R objects into a binary format that can be communicated across an arbitrary connection
d) All of the mentioned

View Answer

Answer: d [Reason:] It’s better to stick with a binary format for efficiency and accuracy.

3. Which of the following statement will save the output to the file for following code ?

> a <- data.frame(x = rnorm(100), y = runif(100))
> b <- c(3, 4.4, 1 / 3)

a) save(a, b, file = “mydata.rda”)
b) save_image(a, b, file = “mydata.rda”)
c) keep(a, b, file = “mydata.rda”)
d) all of the mentioned

View Answer

Answer: a [Reason:] You can save all objects in your workspace using the save.image() function.

4. Which of the following statement will load the objects to the file named “mydata.RData” ?
a) save(“mydata.RData”)
b) load(“mydata.RData”)
c) loadAll(“mydata.RData”)
d) all of the mentioned

View Answer

Answer: b [Reason:] .rda and .RData are fairly common extensions and you may want to use them because they are recognized by other software.

5. Point out the wrong statement :
a) When you call unserialize() on an R object, the output will be a raw vector coded in hexadecimal format
b) serialize() function is the only way to perfectly represent an R object in an exportable format
c) .rda extension is used when save() function is incorporated
d) All of the mentioned

View Answer

Answer: a [Reason:] Output may get sent to a file, but it could get sent over a network or other connection.

6. ________ opens a connection to a file compressed with gzip.
a) url
b) gzfile
c) bzfile
d) file

View Answer

Answer: b [Reason:] “file” opens a connection to a file.

7. Connections to text files can be created with the ________ function.
a) url
b) gzfile
c) bzfile
d) file

View Answer

Answer: d [Reason:] The file() function has a number of arguments that are common to many other connection functions.

8. Which of the followin code creates a connection to ‘foo.txt’ ?
a) con <- file(“foo.txt”)
b) open(con, “r”)
c) opencon(con, “r”)
d) all of the mentioned

View Answer

Answer: a [Reason:] Open is used for opening connection to ‘foo.txt’ in read-only mode.

9. Which of the following code opens a connection to the file foo.txt, reads from it, and closes the
connection when its done ?
a) data <- read.csv(“foo.txt”)
b) data <- read.csvo(“foo.txt”)
c) data <- readonly.csv(“foo.txt”)
d) none of the mentioned

View Answer

Answer: a [Reason:] Connections must be opened, then the are read from or written to, and then they are closed.

10.Which of the following opens connection to gz-compressed text file ?
a) con <- gzfiles(“words.gz”)
b) con <- gzfile(“words.gz”)
c) con <- gzfile2(“words.gz”)
d) none of the mentioned

View Answer

Answer: b [Reason:] For more structured text data like CSV files or tab-delimited files, there are other functions like read.csv() or read.table().

Synopsis and Project Report

You can buy synopsis and project from distpub.com. Just visit https://distpub.com/product-category/projects/ and buy your university/institute project from distpub.com