Question 1:
Which of the following 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.
initial <- read.table("datatable.txt", nrows = 101)
Answer: _________
Question 2:
Point out the correct statement?
A.
The data frame is a key data structure in statistics and in R
B.
R has an internal implementation of data frames that is likely the one you will use most often
C.
There are packages on CRAN that implement data frames via things like relational databases that allow you to operate on very very large data frames
D.
All of the mentioned
E.
unserialize is used for converting an R object into a binary format for outputting to a connection
F.
save is used for saving an arbitrary number of R objects in binary format to a file
G.
The read.data() function is one of the most commonly used functions for reading data
H.
save is not used for saving an arbitrary
I.
The complement to the textual format is the binary format
J.
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
K.
The serialize() function is used to convert individual R objects into a binary format that can be communicated across an arbitrary connection
L.
All of the mentioned
M.
You can also omit variables using the select() function by using the negative sign
N.
The arrange() function also allows a special syntax that allows you to specify variable names based on patterns
O.
Reordering rows of a data frame is normally easier to do in R
P.
The dplyr package provides any "new" functionality to R
Q.
There are three operators that can be used to extract subsets of R objects
R.
The [ operator is used to extract elements of a list or data frame by literal name
S.
The [[ operator is used to extract elements of a list or data frame by string name
T.
There are five operators that can be used to extract subsets of R objects
U.
Times use the POSIXct and POSIXlt class
V.
Dates and times have special classes in R that allow for numerical and statistical calculations
W.
Character strings can be coerced to Date/Time classes using the strptime function
X.
All of the mentioned
Y.
You can also use the $ operator to extract elements by name
Z.
$ operator can be used with computed indices
[.
The [[ operator can only be used with literal names
\.
$ operator semantics are similar to that of [[
Answer: _________
Question 3:
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.
data <- getonly.csv("foo.txt")
Answer: _________
Question 4:
Point out the wrong statement?
A.
Dates are represented by the Date class
B.
Times are represented by the POSIXct or the POSIXlt class
C.
Dates are represented by the DateTime class
D.
Times can be coerced from a character string
E.
Very less operations in R are vectorized
F.
Vectorization allows you to write code that is efficient, concise, and easier to read than in non-vectorized languages
G.
vectorized means that operations occur in parallel in certain R objects
H.
Matrix operations are also vectorized
I.
When you call unserialize() on an R object, the output will be a raw vector coded in hexadecimal format
J.
serialize() function is the only way to perfectly represent an R object in an exportable format
K.
.rda extension is used when save() function is incorporated
L.
The complement to the textual format is the binary format
M.
POSIXct is just a very large integer under the hood
N.
POSIXlt stores a bunch of other useful information like the day of the week, day of the year, month, day of the month
O.
There are a number of generic functions that work on dates and times to help you extract pieces of dates and/or times
P.
None of the mentioned
Q.
Renaming a variable in a data frame in R is surprisingly hard to do
R.
The mutate() function exists to compute transformations of variables in a data frame
S.
mute() function, which does the same thing as mutate() but then drops all non-transformed variables
T.
The data frame is a key data structure in statistics and in R
U.
write.table is used for for writing tabular data to text files (i.e. CSV) or connections
V.
writeLines is used for for writing character data line-by-line to a file or connection
W.
dump is used for for dumping a textual representation of multiple R objects
X.
all of the mentioned
Y.
$ operator semantics are similar to that of [[
Z.
The [ operator always returns an object of the same class as the original
[.
The $ operator is used to extract elements of a list or a data frame
\.
There are three operators that can be used to extract subsets of R objects
].
The dplyr package was developed by Hadley Wickham of RStudio
^.
The dplyr package is an optimized and distilled version of his plyr package
_.
The dplyr package provides any "new" functionality to R
`.
The dplyr package does not provide any "new" functionality to R
Answer: _________
Question 5:
What will be the output of the following R code? > x <- c(1, 2, NA, 4, NA, 5)
> bad <- is.na(x)
> print(bad)
A.
FALSE FALSE FALSE FALSE TRUE FALSE
B.
FALSE TRUE TRUE FALSE TRUE FALSE
C.
FALSE FALSE TRUE FALSE TRUE FALSE
D.
FALSE TRUE TRUE TRUE TRUE FALSE
Answer: _________
Question 6:
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.
put("mydata.RData")
Answer: _________
Question 7:
. . . . . . . . opens a connection to a file compressed with gzip.
A.
url
B.
gzfile
C.
bzfile
D.
file
Answer: _________
Question 8:
What will be the output of the following R 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.
Error
Answer: _________
Question 9:
Which of the following is example of vectorized operation as far as subtraction is concerned? > x <- 1:4
> y <- 6:9
A.
x+y
B.
x-y
C.
x/y
D.
y/x
Answer: _________
Question 10:
Which of the following code represents internal representation of a Date object?
A.
class(as.Date("1970-01-02"))
B.
unclass(as.Date("1970-01-02"))
C.
unclassint(as.Date("1970-01-02"))
D.
classint(as.Date("1970-02-02"))
Answer: _________
Question 11:
What will be the output of the following R code? > x <- matrix(1:6, 2, 3)
> x[1, ]
A.
1 3 5
B.
2 3 5
C.
3 3 5
D.
file
Answer: _________
Question 12:
Which of the following extracts first four element from the following R vector? > x <- c("a", "b", "c", "c", "d", "a")
A.
x[0:4]
B.
x[1:4]
C.
x[0:3]
D.
x[4:3]
Answer: _________
Question 13:
The . . . . . . . . function is used to generate summary statistics from the data frame within strata defined by a variable.
A.
groupby()
B.
group()
C.
group_by()
D.
arrange
Answer: _________
Question 14:
Main way to read the data back in (parsing it) using the function.
A.
dput()
B.
write()
C.
read()
D.
dget()
Answer: _________
Question 15:
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: _________
Question 16:
load() is used for . . . . . . . .
A.
reading
B.
loading
C.
working
D.
not exist
Answer: _________
Question 17:
What will be the output of the following R code? > x <- 1:4
> y <- 6:9
> z <- x + y
> z
A.
7 9 11 13
B.
7 9 11 13 14
C.
9 7 11 13
D.
NULL
Answer: _________
Question 18:
Which of the following extracts first element from the following R list? > x <- list(foo = 1:4, bar = 0.6)
A.
x[[1]]
B.
x[1]
C.
x[[0]]
D.
x[0]
Answer: _________
Question 19:
How do you check the structure of a data frame named my_data in R?
A.
struct(my_data)
B.
str(my_data)
C.
structure(my_data)
D.
check_structure(my_data)
Answer: _________
Question 20:
In R, what is the purpose of the names() function?
A.
Retrieve the number of elements in an object
B.
Set or retrieve names of an object
C.
Assign names to the elements
D.
Remove names from an object
Answer: _________
Question 21:
What function is used to convert a factor to a character vector in R?
A.
as.factor()
B.
as.character()
C.
to.character()
D.
factor_to_char()
Answer: _________
Question 22:
How is a data frame column named Age selected in R?
A.
data$Age
B.
data[,"Age"]
C.
data[["Age"]]
D.
data.column("Age")
Answer: _________
Question 23:
In R, how do you add a new column named Height to a data frame named my_data?
A.
my_data$Height <- c(160, 170, 155)
B.
add_column(my_data, "Height", c(160, 170, 155))
C.
my_data[,"Height"] <- c(160, 170, 155)
D.
append_column(my_data, "Height", c(160, 170, 155))
Answer: _________
Question 24:
How do you create a character vector with the elements "apple", "orange", and "banana" in R?
A.
char_vec <- c("apple", "orange", "banana")
B.
vector("apple", "orange", "banana")
C.
create_char_vector("apple", "orange", "banana")
D.
char_vec(c("apple", "orange", "banana"))
Answer: _________
Question 25:
What does the str() function do in R?
A.
Display the structure of an object
B.
Convert object to a string
C.
Compute the mean of an object
D.
Check the type of an object using string comparison
Answer: _________
Question 26:
In R, how do you create a data frame named my_df with columns Name and Age?
A.
my_df <- data.frame(Name = c("Alice", "Bob"), Age = c(25, 30))
B.
create_df(Name = c("Alice", "Bob"), Age = c(25, 30))
C.
df(Name = c("Alice", "Bob"), Age = c(25, 30))
D.
data_frame(Name = c("Alice", "Bob"), Age = c(25, 30))
Answer: _________
Question 27:
What is the result of length(unique(c(1, 2, 3, 1, 2))) in R?
A.
3
B.
5
C.
2
D.
4
Answer: _________
Question 28:
In R, how is a factor converted to a numeric vector using the as.numeric() function?
A.
as.numeric(factor_vector)
B.
factor_vector(as.numeric)
C.
numeric(factor_vector)
D.
to.numeric(factor_vector)
Answer: _________
Question 29:
readlines is used for . . . . . . . .
A.
working on data
B.
reading files
C.
reading lines in files
D.
not exist
Answer: _________
Question 30:
Which of the following R code extracts the second column for the following matrix? > x <- matrix(1:6, 2, 3)
A.
x[2, ]
B.
x[1, 2]
C.
x[, 2]
D.
x[1 1 2]
Answer: _________
Question 31:
What will be the output of the following R code? > x <- matrix(1:6, 2, 3)
> x[1, , drop = FALSE]
A.
[,1] [,2] [,3] [1,] 1 3 5
B.
[,1] [,2] [,3] [1,] 2 3 5
C.
[,1] [,2] [,3] [1,] 1 2 5
D.
Error
Answer: _________
Question 32:
The . . . . . . . . operator allows you to string operations in a left-to-right fashion.
A.
%>%>
B.
%>%
C.
>%>%
D.
>>>>%%%
Answer: _________
Question 33:
dplyr can be integrated with the . . . . . . . . package for large fast tables.
A.
data.table
B.
read.table
C.
data.data
D.
table.read
Answer: _________
Question 34:
What will be the output of the following R code? > x <- list(foo = 1:4, bar = 0.6, baz = "hello")
> name <- "foo"
> x$name
A.
1
B.
2
C.
3
D.
NULL
Answer: _________
Question 35:
. . . . . . . . extract a subset of rows from a dataframe based on logical conditions.
A.
rename
B.
filter
C.
set
D.
subset
Answer: _________
Question 36:
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.
data <- data("foo.txt")
Answer: _________
Question 37:
Columns can be arranged in descending order too by using the special . . . . . . . . operator.
A.
asc()
B.
desc()
C.
descending()
D.
subset
Answer: _________
Question 38:
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.
b a 1 a a
Answer: _________
Question 39:
. . . . . . . . is used for outputting a textual representation of an R object.
A.
dput
B.
dump
C.
dget
D.
dset
Answer: _________
Question 40:
Which of the following function is identical to read .table?
A.
read.csv
B.
read.data
C.
read.tab
D.
read.del
Answer: _________
Question 41:
What will be the output of the following R code? > x <- Sys.time()
> class(x)
A.
"POSIXct" "POSIXt"
B.
"POSIXXt" "POSIXt"
C.
"POSIXct" "POSIct"
D.
"POSIXt" "POSIXt"
Answer: _________
Question 42:
. . . . . . . . function is similar to the existing subset() function in R but is quite a bit faster.
A.
rename
B.
filter
C.
set
D.
subset
Answer: _________
Question 43:
Which of the following is used for reading in saved workspaces?
A.
unserialize
B.
load
C.
get
D.
set
Answer: _________
Question 44:
What will be the output of the following R code? > x <- 1:4
> x > 2
A.
1 2 3 4
B.
FALSE FALSE TRUE TRUE
C.
1 2 3 4 5
D.
5 4 3 1 2 1
Answer: _________
Question 45:
What will be the output of the following R code? > x <- matrix(1:6, 2, 3)
> x[1, 2]
A.
3
B.
2
C.
1
D.
0
Answer: _________
Question 46:
Individual R objects can be saved to a file using the . . . . . . . . function.
A.
save
B.
put
C.
save_image
D.
get
Answer: _________
Question 47:
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: _________
Question 48:
Multiple objects can be de parsed at once using the . . . . . . . . function.
A.
dput()
B.
write()
C.
dump()
D.
dget()
Answer: _________
Question 49:
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: _________
Question 50:
Which of the following code extracts 1st element of the 2nd element? > x <- list(a = list(10, 12, 14), b = c(3.14, 2.81))
A.
x[[c(2, 1)]]
B.
x[[c(1, 2)]]
C.
x[[c(2, 1,1)]]
D.
x[[(2, 2,1)]]
Answer: _________
Question 51:
Which of the following object is masked from 'package: stats'?
A.
filter
B.
union
C.
set difference
D.
get difference
Answer: _________
Question 52:
What will be the output of the following R code? > x <- list(aardvark = 1:5)
> x[["a", exact = FALSE]]
A.
1 2 3 4 5
B.
2 3 5
C.
1 3 3 5
D.
1 2 3
Answer: _________
Question 53:
. . . . . . . . generate summary statistics of different variables in the data frame, possibly within strata.
A.
rename
B.
summarize
C.
set
D.
subset
Answer: _________
Question 54:
What will be the output of the following R code? > x <- list(aardvark = 1:5)
> x$a
A.
1 2 3 4 5
B.
2 3 5
C.
1 3 3 5
D.
1 2 3
Answer: _________
Question 55:
One way to pass data around is by de parsing the R object with . . . . . . . .
A.
dput()
B.
write()
C.
read()
D.
dget()
Answer: _________
Question 56:
.RData extension used when we save data using the functions . . . . . . . .
A.
save()
B.
save.image()
C.
save and save.image functions
D.
serialize()
Answer: _________
Question 57:
Which of the following extracts first element from the following R vector? > x <- c("a", "b", "c", "c", "d", "a")
A.
x[10]
B.
x[1]
C.
x[0]
D.
x[2]
Answer: _________
Question 58:
Which of the following R statement will save the output to the file for following R 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.
keep_image(a, b, file = "mydata.rda")
Answer: _________
Question 59:
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: _________
Question 60:
What will be the output of the following R code? > x <- as.Date("2012-01-01")
> y <- strptime("9 Jan 2011 11:34:21", "%d %b %Y %H:%M:%S")
> x-y
A.
Time difference of 356.3095 days
B.
Warning
C.
NULL
D.
Error
Answer: _________
Question 61:
Which of the following return a subset of the columns of a data frame?
A.
select
B.
retrieve
C.
get
D.
set
Answer: _________
Question 62:
What will be the output of the following R code? > x <- c("a", "b", "c", "c", "d", "a")
> x[c(1, 3, 4)]
A.
"a" "b" "c"
B.
"a" "c" "c"
C.
"a" "c" "b"
D.
"b" "c" "b"
Answer: _________
Question 63:
How do you extract the first row of a data frame named my_data in R?
A.
my_data[1, ]
B.
my_data[first_row()]
C.
my_data[,"row" == 1]
D.
extract_row(my_data, 1)
Answer: _________
Question 64:
In R, what is the purpose of the table() function?
A.
Create a contingency table from factors
B.
Display a table of values
C.
Generate a summary of data using tables
D.
Count the number of rows and columns in a data frame
Answer: _________
Question 65:
How do you remove a column named Income from a data frame named my_data in R?
A.
my_data <- my_data[, -which(names(my_data) == "Income")]
B.
my_data$Income <- NULL
C.
drop_column(my_data, "Income")
D.
remove_col(my_data, "Income")
Answer: _________
Question 66:
In R, what does the unlist() function do?
A.
Converts a list to a vector
B.
Reverses the order of elements
C.
Creates an unsorted list
D.
Extracts unique elements from a vector
Answer: _________
Question 67:
How is a character string converted to a numeric vector in R using the as.numeric() function?
A.
as.numeric("123")
B.
numeric("123")
C.
convert_numeric("123")
D.
to_numeric("123")
Answer: _________
Question 68:
In R, what is the purpose of the subset() function?
A.
Create a subset of a data frame based on conditions
B.
Generate a summary of a data frame
C.
Filter data based on row and column indices
D.
Extract unique values from a vector using subsetting
Answer: _________
Question 69:
What function is used to concatenate two vectors in R?
A.
concat()
B.
paste()
C.
c()
D.
combine()
Answer: _________
Question 70:
In R, what does the slice() function do?
A.
Extracts specific rows from a data frame
B.
Dices a vector into smaller slices
C.
Counts the number of slices in a vector
D.
Slices a data frame into smaller data frames
Answer: _________
Question 71:
How do you create a named numeric vector with values 1, 2, and 3 named "one", "two", and "three" in R?
A.
named_vector <- c(one = 1, two = 2, three = 3)
B.
create_named_vec(1, 2, 3, names = c("one", "two", "three"))
C.
numeric_vector(c(1, 2, 3), names = c("one", "two", "three"))
D.
vec_named(c(1, 2, 3), c("one", "two", "three"))
Answer: _________
Question 72:
Which of the following function gives the day of the week?
A.
weekdays
B.
months
C.
quarters
D.
semesters
Answer: _________
Question 73:
What will be the output of the following R code? > x <- as.POSIXct("2012-10-25 01:00:00")
> y <- as.POSIXct("2012-10-25 06:00:00", tz = "GMT")
> y-x
A.
Time difference of 1 hour
B.
Time difference of 1 min
C.
Time difference of 1 sec
D.
Time difference of 5 sec
Answer: _________
Question 74:
What will be the output of the following R code? > x <- list(foo = 1:4, bar = 0.6, baz = "hello")
> name <- "foo"
> x[[name]]
A.
1 2 3 4
B.
0 1 2 3
C.
1 2 3 4 5
D.
All of the mentioned
Answer: _________
Question 75:
What will be the output of the following R code? > datestring <- c("January 10, 2012 10:40", "December 9, 2011 9:10")
> x <- strptime(datestring, "%B %d, %Y %H:%M")
> x
A.
"2012-01-10 10:40:00 EST" "2011-12-09 09:10:00 EST"
B.
"2012-01-10 10:40:00 IST" "2011-12-09 09:10:00 IST"
C.
"2012-01-10 10:40:00 GMT" "2011-12-09 09:10:00 GMT"
D.
Error
Answer: _________
Question 76:
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: _________
Question 77:
What will be the output of the following R code? > x <- 1:4
> y <- 6:9
> x/y
A.
0.1666667 0.2857143 0.4444444
B.
0.1666667 0.2857143 0.3750000 0.4444444
C.
0.2857143 0.3750000 0.4444444
D.
Error
Answer: _________
Question 78:
The dplyr package can be installed from CRAN using . . . . . . . .
A.
installall.packages("dplyr")
B.
install.packages("dplyr")
C.
installed.packages("dplyr")
D.
installed.packages("dpl")
Answer: _________
Question 79:
Which of the following argument denotes if the file has a header line?
A.
header
B.
sep
C.
file
D.
footer
Answer: _________
Question 80:
Which data structure in R is used to store an ordered collection of elements?
A.
List
B.
Matrix
C.
Data Frame
D.
Vector
Answer: _________
Question 81:
What does the matrix() function create in R?
A.
A list of elements
B.
A one-dimensional array
C.
A two-dimensional array
D.
A data frame
Answer: _________
Question 82:
In R, how do you create a list named my_list with three elements: 1, "hello", and TRUE?
A.
my_list <- c(1, "hello", TRUE)
B.
my_list = list(1, "hello", TRUE)
C.
my_list(1, "hello", TRUE)
D.
list(my_list = c(1, "hello", TRUE))
Answer: _________
Question 83:
What is the primary data structure used for storing tabular data in R?
A.
List
B.
Matrix
C.
Data Frame
D.
Array
Answer: _________
Question 84:
How is a vector different from a list in R?
A.
Vectors can only store numeric values
B.
Lists can store elements of different types
C.
Lists can only store characters
D.
Vectors can store elements of different types
Answer: _________
Question 85:
In R, how is a matrix initialized with values 1 to 9 arranged in three rows?
A.
matrix(1:9, nrow = 3, ncol = 3)
B.
matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3)
C.
matrix(1:9, rows = 3, cols = 3)
D.
mat(1:9, 3, 3)
Answer: _________
Question 86:
How do you create a factor in R named color with levels "red", "green", and "blue"?
A.
factor(color, levels = c("red", "green", "blue"))
B.
factor(color, levels = "red", "green", "blue")
C.
factor(color = c("red", "green", "blue"))
D.
factor(color = c("red", "green", "blue"), levels = c("red", "green", "blue"))
Answer: _________
Question 87:
What is the purpose of the data.frame() function in R?
A.
Create a vector
B.
Create a data frame
C.
Create a matrix
D.
Create a list
Answer: _________
Question 88:
In R, how do you create a named list with elements "apple", "orange", and "banana"?
A.
list("apple", "orange", "banana")
B.
named_list(c("apple", "orange", "banana"))
C.
list(c("apple", "orange", "banana"))
D.
list(elements = c("apple", "orange", "banana"))
Answer: _________
Question 89:
What is the correct way to access the second element of a vector named my_vector in R?
A.
my_vector(2)
B.
my_vector[2]
C.
my_vector.2
D.
my_vector[[2]]
Answer: _________
Question 90:
Multiple objects can be de parsed at once and read back using function . . . . . . . .
A.
source()
B.
read()
C.
dget()
D.
dput()
Answer: _________
Question 91:
What will be the output of the following R code? > x <- as.Date("2012-03-01")
> y <- as.Date("2012-02-28")
> x-y
A.
Time difference of 3 days
B.
Time difference of 2 days
C.
Time difference of 1 days
D.
Time difference of 5 days
Answer: _________
Question 92:
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.
con <- gzfiles2("words.gz")
Answer: _________
Question 93:
What will be the output of the following R code? > x <- list(foo = 1:4, bar = 0.6)
> x
A.
$foo [1] 1 2 3 4 $bar [1] 0.6
B.
$foo [1] 0 1 2 3 4 $bar [1] 0 0.6
C.
$foo [1] 0 1 2 3 4 $bar [1] 0.6
D.
Error
Answer: _________
Question 94:
The . . . . . . . . function can be used to select columns of a data frame that you want to focus on.
A.
select
B.
rename
C.
get
D.
set
Answer: _________
Question 95:
What will be the output of the following R code? > x <- list(a = list(10, 12, 14), b = c(3.14, 2.81))
> x[[c(1, 3)]]
A.
13
B.
14
C.
15
D.
18
Answer: _________
Question 96:
What will be the output of the following R code? > p <- as.POSIXlt(x)
> names(unclass(p))
> p$wday
A.
1
B.
2
C.
3
D.
NULL
Answer: _________
Question 97:
There is an SQL interface for relational databases via the . . . . . . . . package.
A.
DIB
B.
DB2
C.
DBI
D.
DIB21
Answer: _________
Question 98:
dput() output is in the form of . . . . . . . .
A.
R code
B.
text file code
C.
binary code
D.
both binary and text
Answer: _________
Question 99:
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: _________
Question 100:
Which of the following function is similar to summarize?
A.
arrange_by()
B.
group()
C.
group_by()
D.
arrange
Answer: _________
Question 101:
The . . . . . . . . operator is used to connect multiple verb actions together into a pipeline.
A.
pipe
B.
piper
C.
start
D.
end
Answer: _________
Question 102:
What will be the output of the following R code? > x <- as.Date("1970-01-01")
> x
A.
"1970-01-01"
B.
"1970-01-02"
C.
"1970-02-01"
D.
"1970-02-02"
Answer: _________
Question 103:
. . . . . . . . add new variables/columns or transform existing variables.
A.
mutate
B.
add
C.
apped
D.
arrange
Answer: _________
Question 104:
Connections to text files can be created with the . . . . . . . . function.
A.
url
B.
gzfile
C.
bzfile
D.
file
Answer: _________
Question 105:
.rda extension used when saving data with function . . . . . . . .
A.
save()
B.
save.image()
C.
save and save.image functions
D.
serialize()
Answer: _________
Question 106:
What will be the output of the following R code? > x <- matrix(1:4, 2, 2)
> y <- matrix(rep(10, 4), 2, 2)
> x * y
A.
[,1] [,2] [1,] 10 30 [2,] 20 40
B.
[,1] [,2] [1,] 10 30 [2,] 30 40
C.
[,1] [,2] [1,] 20 30 [2,] 20 40
D.
Error
Answer: _________
Question 107:
Which of the following R code creates a connection to 'foo.txt'?
A.
con <- file("foo.txt")
B.
open(con, "r")
C.
opencon(con, "r")
D.
ocon(con, "r")
Answer: _________
Question 108:
The dplyr package can be installed from GitHub using the . . . . . . . . package.
A.
dev
B.
devtools
C.
devtool
D.
devdel
Answer: _________
Question 109:
How do you add a new row to a data frame named my_data with values "Alice" and 28 for columns Name and Age?
A.
my_data <- rbind(my_data, c("Alice", 28))
B.
my_data <- add_row(my_data, Name = "Alice", Age = 28)
C.
my_data$Name <- "Alice"
my_data$Age <- 28
D.
append_row(my_data, c("Alice", 28))
Answer: _________
Answer Key
1:
A
2:
D, F, L, M, Q, X, Y
3:
A
4:
C, E, I, P, S, X, [, _
5:
C
6:
B
7:
B
8:
C
9:
B
10:
B
11:
A
12:
B
13:
C
14:
D
15:
A
16:
A
17:
A
18:
A
19:
B
20:
C
21:
B
22:
B
23:
A
24:
A
25:
A
26:
A
27:
A
28:
C
29:
B
30:
C
31:
A
32:
B
33:
A
34:
D
35:
A
36:
A
37:
B
38:
A
39:
A
40:
A
41:
A
42:
B
43:
B
44:
B
45:
A
46:
A
47:
B
48:
A
49:
A
50:
A
51:
A
52:
A
53:
B
54:
A
55:
A
56:
C
57:
B
58:
A
59:
D
60:
B
61:
A
62:
B
63:
A
64:
A
65:
B
66:
A
67:
A
68:
A
69:
C
70:
A
71:
D
72:
A
73:
A
74:
A
75:
A
76:
A
77:
B
78:
B
79:
A
80:
D
81:
C
82:
B
83:
C
84:
D
85:
A
86:
D
87:
B
88:
D
89:
B
90:
A
91:
B
92:
B
93:
A
94:
A
95:
B
96:
A
97:
C
98:
A
99:
A
100:
C
101:
A
102:
A
103:
A
104:
D
105:
C
106:
A
107:
A
108:
B
109:
B