This set of R Programming Language Multiple Choice Questions & Answers (MCQs) focuses on “Functions – 4”.
1. Which package can be integrated with dplyr for large fast tables?
b) Data, dplyr
Explanation: 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?
c) Boxplot() or Text()
Explanation: 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?
d) All sorts
Explanation: 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”)
Explanation: 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.
Explanation: 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.
Explanation: 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?
Explanation: 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″))
Explanation: 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?
Explanation: 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.
b) Data Frames
c) Matrix and Data Frames
d) Does not exists
Explanation: 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.
Sanfoundry Global Education & Learning Series – R Programming Language.