R Programming Questions and Answers – Functions – 7

This set of R Programming Objective Questions & Answers focuses on “Functions – 7”.

1. If two vectors with different lengths perform some operation, the elements of the shorter vector will be used again to complete the operation. This is referred to as _________________
a) Element Recycling
b) Recycling
c) Cycling
d) Element Cycling
View Answer

Answer: a
Explanation: If two vectors with different lengths perform an operation, the elements of the shorter vector will be used again to complete the operation. This is referred to as element recycling.

2. If the function in a console is.matrix(X) returns true then X can be considered as a _______
a) Matrix object
b) Matrix data object
c) Matrix vector
d) Vector
View Answer

Answer: b
Explanation: The function call is.matrix(X) returns TRUE then X can be termed as a matrix data object. R has a large number of in-built functions and also the user can create their own functions.

3. ______________ measures the probability of the binary response variable in R language.
a) Logical Regression
b) Multivariate Regression
c) Simpler Regression
d) Statistics
View Answer

Answer: a
Explanation: Logistic regression can be used for this and the function glm () in R language provides this functionality. Logistic regression is a statistical method for analysing a dataset in which there are one or more independent variables which determine an outcome.
advertisement
advertisement

4. ______________ function will measure the probability of the binary response variable in R language.
a) Glm()
b) Glmi()
c) Gelmi()
d) Jlm()
View Answer

Answer: a
Explanation: Glm () in R language provides this functionality. Logistic regression is a statistical method for analysing a dataset in which there are one or more independent variables that determine an outcome.

5. ____________ function can be used to select the random sample of size ‘n’ from a huge dataset.
a) Simple()
b) Sample()
c) While()
d) Signal()
View Answer

Answer: b
Explanation: Sample () function can be used to select a random sample of size ‘n’ from the huge dataset. R has a large number of in-built functions and also the user can create their own functions.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. Which function is used to select variables and observations from a given dataset?
a) Subset()
b) Sample()
c) While()
d) Signal()
View Answer

Answer: a
Explanation: Subset () function is used to select variables and observations from a given dataset. R has a large number of in-built functions and also the user can create their own functions.

7. ____________ package in R language provides various options for re-randomization and permutations based on statistical tests.
a) Coin
b) Vain
c) Join
d) Lain
View Answer

Answer: a
Explanation: Coin package in R language provides various options for re-randomization and permutations based on statistical tests. When test assumptions cannot be met then this package serves as a good alternative to classical methods.
advertisement

8. A matrix of scatterplots can be produced using _________ function.
a) Pears
b) Pairs
c) Tears
d) Cars
View Answer

Answer: b
Explanation: A matrix of scatterplots can be produced using pairs. Pairs function takes various parameters like formula, data, subset, labels, etc.

9. __________ function takes various parameters like formula, data, subset, labels, etc.
a) Pears
b) Pairs
c) Tears
d) Cars
View Answer

Answer: b
Explanation: Pairs function takes various parameters like formula, data, subset, labels, etc. A matrix of scatterplots can be produced using pairs.
advertisement

10. How will you check if an element is present in a vector?
a) Match()
b) Dismatch()
c) Mismatch()
d) Search()
View Answer

Answer: a
Explanation: It can be done using the match () function- match () function returns the first appearance of a particular element. The other way is to use %in% which returns a Boolean value either true or false.

Sanfoundry Global Education & Learning Series – R Programming Language.

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

To practice all objective questions on R Programming, Here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). 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!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.