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. Which of the following is used for reading in saved workspaces ?
a) unserialize
b) load
c) get
d) none of the mentioned

View Answer

Answer: b [Reason:] unserialize is used for reading single R objects in binary form.

2. Point out the wrong statement :
a) write.table is used for for writing tabular data to text files (i.e. CSV) or connections
b) writeLines is used for for writing character data line-by-line to a file or connection
c) dump is used for for dumping a textual representation of multiple R objects
d) all of the mentioned

View Answer

Answer: d [Reason:] There are analogous functions for writing data to files.

3. ________ is used for outputting a textual representation of an R object
a) dput
b) dump
c) dget
d) all of the mentioned

View Answer

Answer: a [Reason:] dump is used for dumping a textual representation of multiple R objects.

4. Which of the following argument denotes if the file has a header line ?
a) header
b) sep
c) file
d) all of the mentioned

View Answer

Answer: a [Reason:] sep is a string indicating how the columns are separated.

5. Point out the correct statement :
a) unserialize is used for converting an R object into a binary format for outputting to a connection
b) save is used for saving an arbitrary number of R objects in binary format to a file
c) The read.data() function is one of the most commonly used functions for reading data
d) all of the mentioned

View Answer

Answer: b [Reason:] read.table reads a file in table format and creates a data frame from it.

6. Which of the following statement would read file “foo.txt” ?
a) data <- read.table(“foo.txt”)
b) read.data <- read.table(“foo.txt”)
c) data <- read.data(“foo.txt”)
d) none of the mentioned

View Answer

Answer: a [Reason:] R will automatically skip lines that begin with a #.

7. Which of the following function is identical to read.table ?
a) read.csv
b) read.data
c) read.tab
d) None of the mentioned

View Answer

Answer: a [Reason:] The read.csv() function is identical to read.table except that some of the defaults are set differently (like the sep argument).

8. Which of the followin code would read 100 rows ?
a) initial <- read.table(“datatable.txt”, nrows = 100)
b) tabAll <- read.table(“datatable.txt”, colClasses = classes)
c) initial <- read.table(“datatable.txt”, nrows = 99)
d) all of the mentioned

View Answer

Answer: a [Reason:] You can use the Unix tool wc to calculate the number of lines in a file.

9. What is the result of the following code ?

> y <- data.frame(a = 1, b = "a")
> dput(y)

a)

structure(list(a = 1, b = list(1L, .Label = "a", class = "factor")), .Names
= c("a",
"b"), row.names = c(NA, -1L), class = "data.frame")

b)

list(list(a = 1, b = list(1L, .Label = "a", class = "factor")), .Names
= c("a",
"b"), row.names = c(NA, -1L), class = "data.frame")

c)

structure(list(a = 1, b = structure(1L, .Label = "a", class = "factor")), .Names
= c("a",
"b"), row.names = c(NA, -1L), class = "data.frame")

d) None of the mentioned

View Answer

Answer: c [Reason:] dput() output is in the form of R code and that it preserves metadata like the class of the object, the row names, and the column names.

10.Which of the following is used for reading tabular data ?

> y <- data.frame(a = 1, b = "a")
> dput(y, file = "y.R")
> new.y <- dget("y.R")
> new.y

a)

a b
1 1 a

b)

a b
1 2 b

c)

a b
2 1 a

d) None of the mentioned

View Answer

Answer: a [Reason:] Multiple objects can be deparsed at once using the dump function and read back in using source.

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