Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. .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 : Error
2. ________ functions can be “built which contain all of the necessary data for evaluating the function
Correct Answer is : Objective
3. Which of the following language supports lexical scoping ?
Correct Answer is : All of the mentioned
4. _________ require you to pass a function whose argument is a vector of parameters.
Correct Answer is : opt()
5. Point out the correct statement :
Correct Answer is : An environment is a collection of (symbol, value) pairs, i.e. x is a symbol and 3.14 might be its value
6. 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 : “data” “fixed” “params”
7. 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 : empty
8. 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 : 1.800596
9. The _________ function is used to plot negative likelihood.
Correct Answer is : plot()
10. What will be the output of following code ?
> g <- function(x) {
+ a <- 3
+ x+a+y
+ ## 'y' is a free variable
+ }
> y <- 3
> g(2)
Correct Answer is : 8
11. ________ generate random Normal variates with a given mean and standard deviation
Correct Answer is : rnorm
12. Point out the correct statement :
Correct Answer is : R comes with a set of pseudo-random number generators
13. ______ evaluate the cumulative distribution function for a Normal distribution
Correct Answer is : pnorm
14. _______ generate random Poisson variates with a given rate
Correct Answer is : rpois
15. Point out the wrong statement :
Correct Answer is : For each probability distribution there are typically three functions
16. Which of the following evaluate the Normal probability density (with a given mean/SD) at a point ?
Correct Answer is : dnorm
17. _________ is the most common probability distribution to work with.
Correct Answer is : Gaussian
18. What will be the output of the following code ?
> pnorm(2)
Correct Answer is : 0.9772499
19. _________ ensures reproducibility of the sequence of random numbers.
Correct Answer is : set.seed()
20. Point out the correct statement :
Correct Answer is : You should always set the random number seed when conducting a simulation