R Programming Objective Questions & Answers focuses on “Functions”.
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
Answer: a
Clarification: 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
Answer: b
Clarification: 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
Answer: a
Clarification: 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.
4. ______________ function will measure the probability of the binary response variable in R language.
a) Glm()
b) Glmi()
c) Gelmi()
d) Jlm()
Answer: a
Clarification: 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()
Answer: b
Clarification: 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.
6. Which function is used to select variables and observations from a given dataset?
a) Subset()
b) Sample()
c) While()
d) Signal()
Answer: a
Clarification: 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
Answer: a
Clarification: 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.
8. A matrix of scatterplots can be produced using _________ function.
a) Pears
b) Pairs
c) Tears
d) Cars
Answer: b
Clarification: 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
Answer: b
Clarification: Pairs function takes various parameters like formula, data, subset, labels, etc. A matrix of scatterplots can be produced using pairs.
10. How will you check if an element is present in a vector?
a) Match()
b) Dismatch()
c) Mismatch()
d) Search()
Answer: a
Clarification: 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.