
Control Structures in R Quiz
Authored by Sneha Tiwari
Biology
University
Used 2+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
26 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the primary purpose of control structures in R?
To define variables
To create functions
To control the flow of execution
To store data
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is NOT a type of control statement in R?
if condition
for loop
switch statement
case statement
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the 'if-else' statement do?
Always executes the first block of code
None of the above
Executes code based on a TRUE condition
Executes code only if the condition is FALSE
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In a 'for loop', what does the 'variable' represent?
The condition to check
The sequence to iterate over
The final output
The current element in the sequence
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the syntax for a 'while loop' in R?
while (condition) { code }
for (condition) { code }
repeat { code }
if (condition) { code }
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the 'break' statement?
To define a function
To skip the current iteration
To continue to the next iteration
To exit a loop prematurely
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which statement is used to return a value from a function?
output()
return()
exit()
result()
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 Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?