ExamVeda
Login
Home
21
How do you create a vector containing the first 5 prime numbers in R using a while loop?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
22
In R, what is the purpose of the ifelse() function?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
23
How is the for loop different from the while loop in R?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
24
What does the Sys.sleep(2) function do in R?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
25
In R, how do you create an infinite loop?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
26
What is the output of the following R code: x <- 5; while (x > 0) { print(x); x <- x - 2 }
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
27
In R, how do you create a switch statement with a default case?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
28
How do you create a loop that prints the squares of numbers from 1 to 10 in R?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
29
In R, what is the purpose of the next statement in a loop?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
30
What is the output of the following R code: for (i in 1:5) { if (i == 3) next; print(i) }
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board