Examveda
Examveda

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

A. > x <- 1:4
> lapply(x, runif, min = 0, max = 10)

B. > x <- 1:4
> lapply(x, runif, min = 0, max = 9)

C. > x <- 1:3
> lapply(x, runif, min = 0, max = 10)

D. > x <- 1:4
> lapply(x, runif, min = 0, max = 6)

Answer: Option A


Join The Discussion

Related Questions on Control Structures in R Programming

In R, what is the purpose of the if-else statement?

A. To execute a block of code if a condition is true, otherwise execute another block of code

B. To create a loop that iterates a specified number of times

C. To check multiple conditions sequentially

D. To execute a block of code repeatedly until a condition is met