Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. What would the following code print ?
> x <- data.frame(foo = 1:4, bar = c(T, T, F, F))
> ncol(x)
Correct Answer is : 12
2. What would be the output of the following code ?
> x <- 1:3
> names(x)
Correct Answer is : Nothing
3. What would be the output of the following code ?
> m <- matrix(1:4, nrow = 2, ncol = 2)
> dimnames(m) <- list(c("a", "b"), c("c", "d"))
> m
Correct Answer is : 12
4. Which of the following statement changes column name to h and f ?
Correct Answer is : 0
5. .Which of the following is used for reading tabular data ?
Correct Answer is : disable_functions = fopen, file
6. What will be the output of following code snippet ?
> lm <- function(x) { x * x }
> lm
Correct Answer is : disable_classes = “administrator, janitor”
7. A function, together with an environment, makes up what is called a ______ closure.
Correct Answer is : 30
8. Which of the variable in the following code is variable ?
> f <- function(x, y) {
+ x^2 + y / z
+ }
Correct Answer is : –enable-memory-limit
9. R uses _________ scoping⁶⁰ or static scoping.
Correct Answer is : open_basedir = “/home/www/”
10. The only environment without a parent is the ________ environment.
Correct Answer is : ServerSignature
11. The ________ for R are the main feature that make it different from the original S language
Correct Answer is : ServerTokens
12. The _________ function is a kind of “constructor function” that can be used to construct other functions.
Correct Answer is : expose_php
13. .What will be the output of following code ?
> g <- function(x) {
+ a <- 3
+ x+a+y
+ ## 'y' is a free variable
+ }
> g(2)
Correct Answer is : AddType application/x-httpd-php .php
14. ________ functions can be “built which contain all of the necessary data for evaluating the function
Correct Answer is : PHP 5.3.0
15. Which of the following language supports lexical scoping ?
Correct Answer is : error
16. _________ require you to pass a function whose argument is a vector of parameters.
Correct Answer is : hihello
17. What will be the output of the following code ?
function(p) {
params[!fixed] <- p
mu <- params[1]
sigma <- params[2]
## Calculate the Normal density
a <- -0.5*length(data)*log(2*pi*sigma^2)
b <- -0.5*sum((data-mu)^2) / (sigma^2)
-(a + b)
}
> ls(environment(nLL))
Correct Answer is : hi
18. What will be the output of the following code ?
> nLL <- make.NegLogLik(normals, c(FALSE, 2))
> optimize(nLL, c(-1, 3))$minimum
Correct Answer is : hi
19. What will be the output of the following code ?
> nLL <- make.NegLogLik(normals, c(1, FALSE))
> optimize(nLL, c(1e-6, 10))$minimum
Correct Answer is : infinite loop
20. The _________ function is used to plot negative likelihood.