Which loop in R is used when the number of iterations is known beforehand?

Which loop in R is used when the number of iterations is known beforehand?

a) while loop
b) repeat loop
c) for loop
d) do-while loop

Answer:

c) for loop

Explanation:

The for loop is used in R when the number of iterations is known before the loop starts.

Reference:

R Programming – Loops MCQ Questions and Answers

Scroll to Top