How do you create a vector containing the first 5 prime numbers in R using a while loop?
Select an option to see the answer and solution.
In R, what is the purpose of the ifelse() function?
Select an option to see the answer and solution.
How is the for loop different from the while loop in R?
Select an option to see the answer and solution.
What does the Sys.sleep(2) function do in R?
Select an option to see the answer and solution.
In R, how do you create an infinite loop?
Select an option to see the answer and solution.
What is the output of the following R code: x <- 5; while (x > 0) { print(x); x <- x - 2 }
Select an option to see the answer and solution.
In R, how do you create a switch statement with a default case?
Select an option to see the answer and solution.
How do you create a loop that prints the squares of numbers from 1 to 10 in R?
Select an option to see the answer and solution.
In R, what is the purpose of the next statement in a loop?
Select an option to see the answer and solution.
What is the output of the following R code: for (i in 1:5) { if (i == 3) next; print(i) }
Select an option to see the answer and solution.
A function, together with an environment, makes up what is called a . . . . . . . . closure.
Select an option to see the answer and solution.
Body of lapply function is?
Options are not available for this question.
Select an option to see the answer and solution.
. . . . . . . . is used to break the execution of a loop.
Select an option to see the answer and solution.
Write a function to extract the first name in the string "Mrs. Jake Luther"?
Select an option to see the answer and solution.
Which of the following R code will print the following result?
[[1]]
[1] 2.263808
[[2]]
[1] 1.314165 9.815635
[[3]]
[1] 3.270137 5.069395 6.814425
[[4]]
[1] 0.9916910 1.1890256 0.5043966 9.2925392
Select an option to see the answer and solution.
What will be the output of the following R code?
> f <- function(num) {
+ hello <- "Hello, world!\n"
+ for(i in seq_len(num)) {
+ cat(hello)
+ }
+ chars <- nchar(hello) * num
+ chars
+ }
> meaningoflife <- f(3)
> print(meaningoflife)
Select an option to see the answer and solution.
. . . . . . . . function is same as lapply in R.
Select an option to see the answer and solution.
What would be the value of following R expression?
log(-1)
Select an option to see the answer and solution.
The . . . . . . . . for R are the main feature that make it different from the original S language.
Select an option to see the answer and solution.
What will be the output of the following R code?
> f <- function(elt) {
+ elt[, 1]
+ }
> lapply(x, f)
Select an option to see the answer and solution.