

R While Loop Flashcard
Flashcard
•
Computers
•
11th Grade
•
Practice Problem
•
Hard
Wayground Content
FREE Resource
Student preview

10 questions
Show all answers
1.
FLASHCARD QUESTION
Front
What is the purpose of loops in programming?
Back
To execute a block of code multiple times
2.
FLASHCARD QUESTION
Front
Which of the following is a loop command in R? if, else, while, switch
Back
while
3.
FLASHCARD QUESTION
Front
What will the following R code print?
i <- 1
while (i < 6) {
print(i)
i <- i + 1
}
Back
1 2 3 4 5
4.
FLASHCARD QUESTION
Front
What does the 'break' statement do in a loop?
Back
Stops the loop immediately
5.
FLASHCARD QUESTION
Front
In the context of loops, what does the 'next' statement do?
Back
Skips the rest of the current iteration
6.
FLASHCARD QUESTION
Front
What will the following R code print?
i <- 1
while (i < 6) {
if (i == 4) {
break
}
print(i)
i <- i + 1
}
Options: 1 2 3, 2 3 4 5, 1 2 3 4, 1 2 3 4 5
Back
1 2 3
7.
FLASHCARD QUESTION
Front
What is the output of this R code?
i <- 0
while (i < 6) {
i <- i + 1
if (i == 3) {
next
}
print(i)
}
Back
1 2 4 5 6
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Microsoft
or continue with
%20(1).png)
Apple
Others
Already have an account?