R Interview Questions - 34 | Snaprecruit.com
R Interview Questions - 34 | Snaprecruit.com
JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing
Enterprises
R interview questions part 34
R interview questions part 34
Back
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. Point out the correct statement :
A. Character strings are entered using either matching double (“) or single (‘) quotes
B. Character vectors may be concatenated into a vector by the c() function
C. Subsets of the elements of a vector may be selected by appending to the name of the vector an index vector in square brackets
D. All of the mentioned
Show Correct Answer
Correct Answer is :
All of the mentioned
2. Point out the wrong statement :
A. matrices or more generally arrays are multi-dimensional generalizations of vectors
B. factors provide compact ways to handle categorical data
C. vectors provide a convenient way to return the results of a statistical computation
D. all of the mentioned
Show Correct Answer
Correct Answer is :
vectors provide a convenient way to return the results of a statistical computation
3. What would be the output of the following code ? > x <- vector("list", length = 5) > x
A.
B. 1
C. 0
D. None of the mentioned
Show Correct Answer
Correct Answer is :
4. Which of the following code snippet will create a vector with NAs in it ?
A. x >- c(1, 2, NA, 10, 3)
B. x >- cNA(1, 2, NA, 10, 3)
C. x >- NA(1, 2, NA, 10, 3)
D. None of the mentioned
Show Correct Answer
Correct Answer is :
x >- c(1, 2, NA, 10, 3)
5. .What would the following code print ? > x <- c(1, 2, NaN, NA, 4) > is.na(x)
A. FALSE FALSE TRUE TRUE FALSE
B. FALSE TRUE TRUE TRUE FALSE
C. TRUE FALSE TRUE TRUE FALSE
D. None of the mentioned
Show Correct Answer
Correct Answer is :
FALSE FALSE TRUE TRUE FALSE
6. Point out the wrong statement :
A. is.nan() is used to test objects if they are NA
B. is.nan() is used to test for NaN
C. NA values have a class also, so there are integer NA, character NA, etc
D. All of the mentioned
Show Correct Answer
Correct Answer is :
is.nan() is used to test objects if they are NA
7. Data frames can be converted to a matrix by calling data._______
A. matr()
B. mat()
C. matrix()
D. all of the mentioned
Show Correct Answer
Correct Answer is :
matrix()
8. What would the following code print ? > x <- data.frame(foo = 1:4, bar = c(T, T, F, F)) > ncol(x)
A. 2
B. 4
C. 7
D. All of the mentioned
Show Correct Answer
Correct Answer is :
2
9. Point out the correct statement :
A. Using factors with labels is better than using integers because factors are self-describing
B. Factors are used to represent categorical data and can be unordered or ordered
C. Factors are important in statistical modeling and are treated specially by modelling functions like lm() and glm()
D. All of the mentioned
Show Correct Answer
Correct Answer is :
All of the mentioned
10. What would be the output of the following code ? > x <- 1:3 > names(x)
A.
B. 1
C. 2
D. None of the mentioned
Show Correct Answer
Correct Answer is :
11. Which of the following statement changes column name to h and f ?
A. colnames(m) <- c(“h”, “f”)
B. columnnames(m) <- c(“h”, “f”)
C. rownames(m) <- c(“h”, “f”)
D. none of the mentioned
Show Correct Answer
Correct Answer is :
colnames(m) <- c(“h”, “f”)
12. .Which of the following is used for reading tabular data ?
A. read.csv
B. dget
C. readLines
D. none of the mentioned
Show Correct Answer
Correct Answer is :
read.csv
13. What will be the output of following code snippet ? > lm <- function(x) { x * x } > lm
A. function(x) { x * x }
B. func(x) { x * x }
C. function(x) { x / x }
D. none of the mentioned
Show Correct Answer
Correct Answer is :
function(x) { x * x }
14. A function, together with an environment, makes up what is called a ______ closure.
A. formal
B. function
C. reflective
D. all of the mentioned
Show Correct Answer
Correct Answer is :
function
15. Which of the variable in the following code is variable ? > f <- function(x, y) { + x^2 + y / z + }
A. x
B. y
C. z
D. all of the mentioned
Show Correct Answer
Correct Answer is :
z
16. Point out the wrong statement :
A. The order of the packages on the search list does not matter
B. R has separate namespaces for functions and non-functions
C. Users can configure which packages get loaded on startup so if you are writing a function
D. None of the mentioned
Show Correct Answer
Correct Answer is :
The order of the packages on the search list does not matter
17. R uses _________ scoping⁶⁰ or static scoping.
A. reflective
B. transitive
C. lexical
D. all of the mentioned
Show Correct Answer
Correct Answer is :
lexical
18. The only environment without a parent is the ________ environment.
A. full
B. half
C.
D. empty
Show Correct Answer
Correct Answer is :
empty
19. The ________ for R are the main feature that make it different from the original S language
A. scoping rules
B. closure rules
C. environment rules
D. all of the mentioned
Show Correct Answer
Correct Answer is :
scoping rules
20. The _________ function is a kind of “constructor function” that can be used to construct other functions.
A. make.pow()
B. make.power()
C. keep.power()
D. none of the mentioned
Show Correct Answer
Correct Answer is :
make.power()
Similar Interview Questions
Search for latest jobs
Find Jobs