R Programming Questions and Answers – Functions – 3

«
»

This set of R Programming Language Multiple Choice Questions & Answers (MCQs) focuses on “Functions – 3”.

1. R Commander is used to ___________ in R.
a) Export data
b) Import data
c) Use data
d) Work on data
View Answer

Answer: b
Explanation: R Commander is used to import data in R language. To start the R commander GUI, the user should type in the command Rcmdr into the console. There are 3 different types in which data can be imported in R language.
advertisement

2. Two vectors M and N are defined as M <- c(3, 2, 4) and N <- c(1, 2). What will be the output of vector Z that is defined as Z <- M*N.
a) Z <- (3, 2, 4)
b) Z <- (3, 6, 4)
c) Z <- (3, 4, 5)
d) Z <- (3, 4, 4)
View Answer

Answer: d
Explanation: In R language when the vectors have different lengths, the multiplication begins with the smaller vector and continues till all the elements in the larger vector have been multiplied.

3. How missing values and impossible values are represented in R language?
a) NA
b) NAN
c) NA & NAN
d) Not Exist
View Answer

Answer: c
Explanation: NaN (Not a Number) is used to represent impossible values whereas NA (Not Available) is referred to represent missing values. It is good to find the missing values and then take the necessary steps to handle them.
advertisement
advertisement

4. CRAN package ecosystem has more than ______ packages.
a) 5000
b) 4000
c) 6000
d) 8000
View Answer

Answer: c
Explanation: R language has several packages for solving a particular problem. CRAN package ecosystem has more than 6000 packages.

5. Which function in R language is used to find out whether the means of 2 groups are equal to each other or not?
a) f.tests ()
b) l.tests ()
c) t.tests ()
d) not exist
View Answer

Answer: c
Explanation: t.tests () function in R language is used to find out whether the means of 2 groups are equal to each other. It is not used most commonly in R. It is used in some specific conditions.
advertisement

6. __________ is the best way for communicating the results of data analysis using the R language.
a) Single document
b) Files
c) Structures
d) Loadings
View Answer

Answers: a
Explanation: The best possible way to do this is to combine the data, code and analysis results for a single document by knitr for reproducible research. This helps others to verify the findings, then engage in discussions.

7. How many types of data structures does R language have?
a) 2
b) 3
c) 5
d) 8
View Answer

Answer: a
Explanation: R language consists of Homogeneous and Heterogeneous data structures. Homogeneous data structures have the same type of objects – Vector, Matrix and Array. Heterogeneous data structures have a different type of objects – Data frames and lists.
advertisement

8. __________ is the easiest method for reshaping the data before analysis.
a) Transpose()
b) Structure()
c) Package
d) Function
View Answer

Answer: a
Explanation: Transpose t () is the easiest method for reshaping the data before analysis. The transpose (reversing rows and columns) is always the simplest method of reshaping a dataset. Use the t() function to transpose a matrix or a data frame.

9. ___________ function is used to apply an expression for a given dataset.
a) This()
b) With()
c) Unwith()
d) That()
View Answer

Answer: b
Explanation: With a () function is used to apply an expression for a given dataset. R language has a large number of in-built functions and the user can create their own functions. In R, a function is an object to the R interpreter is able to pass control to the function.
advertisement

10. __________ package is used to speed up data frame management code.
a) Data.table
b) Dplyr
c) Table
d) Data.dplyr
View Answer

Answer: b
Explanation: dplyr is a powerful R-package to transform and summarize tabular data with rows and columns. 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.

Sanfoundry Global Education & Learning Series – R Programming Language.

Here’s the list of Best Reference Books in R Programming Language .

To practice all areas of R Programming Language, Here is complete set of 1000+ Multiple Choice Questions and Answers.

Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn | Youtube | Instagram | Facebook | Twitter