R Programming Language Multiple Choice Questions on “Functions”.
1. Which package can be integrated with dplyr for large fast tables?
a) Table
b) Data, dplyr
c) Data.table
d) Dplyr.table
Answer: c
Clarification: Data.table package can be integrated with dplyr for large fast tables. dplyr package is used to speed up data frame management code. dplyr is a package for data manipulation, written and maintained regularly by Hadley Wickham.
2. In the base graphics system, which function is used to add elements to a plot?
a) Boxplot()
b) Text()
c) Boxplot() or Text()
d) Treat()
Answer: c
Clarification: In the base graphics system, boxplot or text function is used to add elements to a plot.
3. What are the different types of sorting algorithms available in R language?
a) Bubble
b) Selection
c) Merge
d) All sorts
Answer: d
Clarification: Bucket Sort, Selection Sort, Quick Sort, Bubble Sort, Merge Sort is the different sorts available in R language. Each and Every sorting algorithm is available in R.
4. What is the command used to store R objects in a file?
a) save (x, file=”x.Rdata”)
b) save (x, file=x.Rdata)
c) save (x, file=”x.Rdata”);
d) save (x, file=”x.data”)
Answer: a
Clarification: The function save() can be used to save one or more R objects to a specified file (in .RData or .rda type file formats). The function can be read back from the file using the function load(). Note that if you save your data with save(), it cannot be restored under a different name.
5. ___________ can be used for storing the data for long-term.
a) HDLS
b) HDFS
c) HDLSV
d) HSSLV
Answer: b
Clarification: The Hadoop Distributed File System (HDFS) is the primary data storage system used in Hadoop applications. The Hadoop Distributed File System ( HDFS ) is a distributed file system designed for a run on commodity hardware.
6. MapReduce jobs submitted from either Oozie, Pig or Hive can be used to encode, improve and sample the data sets from _________ into R.
a) HDLS
b) HDFS
c) HDLSV
d) HSSLV
Answer: b
Clarification: MapReduce jobs submitted from either Oozie, Pig or Hive can be used for encode, improve and sample the data sets from HDFS into R. This helps to leverage complex analysis tasks with the subset of data prepared in R.
7. What will be the output of log (-5.8) when executed on R console?
a) NAN
b) NA
c) Error
d) 0.213
Answer: a
Clarification: Executing the above on R console or terminal will display a warning sign that NaN (Not a Number) will be produced in R console because it is not possible to take a log of a negative number(-).
8. How is a Data object represented internally in R language?
a) unclass (as.time (“2018-12-28″))
b) unclass (as.dat (“2018-12-28″))
c) unclass (as.D (2018-12-28))
d) unclass (as.Date (“2018-12-28″))
Answer: d
Clarification: unclass returns (a copy of) its argument with its class information removed. Unclass with an object is to remove from a class or category.
9. Which package in R supports the exploratory analysis of genomic data?
a) Adegenat
b) Adegenet
c) Adegnet
d) Adezenet
Answer: b
Clarification: Adegenet package in R supports the exploratory analysis of genomic data. R has a large number of in-built functions and the user can create their own functions. In R, a function is an object so the R interpreter is able to pass control to the function.
10. __________ can contain heterogeneous inputs.
a) Matrix
b) Data Frames
c) Matrix and Data Frames
d) Does not exists
Answer: b
Clarification: Data frame can contain heterogeneous inputs while a matrix cannot. In the matrix, only similar data types can be stored whereas in a data frame there can be different data types like characters, integers or other data frames.