Control Structures In R Programming - Study Mode

[#71] What does the Sys.sleep(2) function do in R?
Correct Answer

(A) Pauses the execution of R for 2 seconds

[#72] In R, how do you create an infinite loop?
Correct Answer

(B) while (TRUE) { code_block }

[#73] In R, how do you create a switch statement with a default case?
Correct Answer

(C) switch(case_expression, case1 = expr1, case2 = expr2, default = default_expr)

[#74] In R, what is the purpose of the next statement in a loop?
Correct Answer

(C) Moves to the next iteration of the loop

[#75] What will be the output of the following R code snippet? > lm <- function(x) { x * x }
> lm
Correct Answer

(A) function(x) { x * x }