31. A function, together with an environment, makes up what is called a . . . . . . . . closure.
32. Body of lapply function is?
33. . . . . . . . . is used to break the execution of a loop.
34. Write a function to extract the first name in the string "Mrs. Jake Luther"?
35. 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
[[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
36. 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)
> 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)
37. . . . . . . . . function is same as lapply in R.
38. What would be the value of following R expression?
log(-1)
log(-1)
39. The . . . . . . . . for R are the main feature that make it different from the original S language.
40. What will be the output of the following R code?
> f <- function(elt) {
+ elt[, 1]
+ }
> lapply(x, f)
> f <- function(elt) {
+ elt[, 1]
+ }
> lapply(x, f)
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.