42.
What will be the output of the following R code?
> f <- function(num) {
+ for(i in seq_len(num)) {
+               cat("Hello, world!\n")
+ }
+ }
> f(3)

45.
What will be the output of the following R 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))

Read More Section(Control Structures in R Programming)

Each Section contains maximum 100 MCQs question on Control Structures in R Programming. To get more questions visit other sections.