Q161
Open question> x <- 3
> switch(2, 2+2, mean(1:10), rnorm(5))Select an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
207
Questions
9/11
Page
Pick an option on a question to see the right answer and solution.
Q161
Open question> x <- 3
> switch(2, 2+2, mean(1:10), rnorm(5))Select an option to see the answer and solution.
Q162
Open question> f <- function(num = 1) {
+ hello <- "Hello, world!\n"
+ for(i in seq_len(num)) {
+ cat(hello)
+ }
+ chars <- nchar(hello) * num
+ chars
+ }
> f()Select an option to see the answer and solution.
Q163
Open questionSelect an option to see the answer and solution.
Q164
Open questionSelect an option to see the answer and solution.
Q165
Open questionSelect an option to see the answer and solution.
Q166
Open question> g <- function(x) {
+ a <- 3
+ x+a+y
+ ## 'y' is a free variable
+ }
> y <- 3
> g(2)Select an option to see the answer and solution.
Q167
Open questionSelect an option to see the answer and solution.
Q168
Open questionSelect an option to see the answer and solution.
Q169
Open questionSelect an option to see the answer and solution.
Q170
Open questionSelect an option to see the answer and solution.
Q171
Open questionSelect an option to see the answer and solution.
Q172
Open questionSelect an option to see the answer and solution.
Q173
Open questionSelect an option to see the answer and solution.
Q174
Open questionSelect an option to see the answer and solution.
Q175
Open question> log(-2.3)Select an option to see the answer and solution.
Q176
Open questionSelect an option to see the answer and solution.
Q177
Open question> printmessage <- function(x) {
+ if(x > 0)
+ print("x is greater than zero")
+ else
+ print("x is less than or equal to zero")
+ invisible(x)
+ }
> printmessage(NA)Select an option to see the answer and solution.
Q178
Open questionSelect an option to see the answer and solution.
Q179
Open question> nLL <- make.NegLogLik(normals, c(FALSE, 2))
> optimize(nLL, c(-1, 3))$minimumSelect an option to see the answer and solution.
Q180
Open questionSelect an option to see the answer and solution.