
Mastering R Programming Basics
Quiz
•
Others
•
University
•
Practice Problem
•
Medium
krishan425 krishan425
Used 3+ times
FREE Resource
Enhance your content in a minute
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the syntax for an if statement in R?
if (condition) code_to_execute else code_to_execute_if_false
if (condition) { code_to_execute } else { code_to_execute_if_false }
if { condition } then { code_to_execute }
if condition { code_to_execute }
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you write an if-else statement in R?
if (condition) { code_if_true } else code_if_false
if (condition) { code_if_true } else { code_if_false }
if condition { code_if_true } else code_if_false
if (condition) code_if_true else { code_if_false }
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What function is used to check multiple conditions in R?
ifelse() or case_when()
for()
switch()
repeat()
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Explain the purpose of the switch statement in R.
To define a function in R.
To declare variables in R.
To create a loop in R.
The purpose of the switch statement in R is to select and execute code based on the value of an expression.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the difference between for loop and while loop in R?
For loop is used for conditional execution; while loop is for fixed iterations.
For loop requires a condition to start; while loop does not need any condition.
For loop can only iterate over vectors; while loop can iterate over any data type.
For loop iterates a fixed number of times; while loop continues based on a condition.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you create a for loop to iterate over a vector in R?
foreach (i in my_vector) { print(i) }
for (i in my_vector) { print(i) }
for (i = 1; i <= length(my_vector); i++) { print(my_vector[i]) }
for (i in 1:length(my_vector)) { print(i) }
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code: for(i in 1:5) { print(i) }?
-1
1 2 3 4 5
6
0
Create a free account and access millions of resources
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
20 questions
ABA - Study Quiz Two
Quiz
•
University
15 questions
FANERA 2024
Quiz
•
University
15 questions
HARI GURU NASIONAL 2024
Quiz
•
University
20 questions
VERB PART II
Quiz
•
University
15 questions
Thermodynamics Concepts
Quiz
•
University
22 questions
QUIZ 2 AUD589 OCT2023
Quiz
•
University
22 questions
The Empire of Ghana in the Year 1000
Quiz
•
8th Grade - University
20 questions
Reading day
Quiz
•
University
Popular Resources on Wayground
10 questions
Honoring the Significance of Veterans Day
Interactive video
•
6th - 10th Grade
9 questions
FOREST Community of Caring
Lesson
•
1st - 5th Grade
10 questions
Exploring Veterans Day: Facts and Celebrations for Kids
Interactive video
•
6th - 10th Grade
19 questions
Veterans Day
Quiz
•
5th Grade
14 questions
General Technology Use Quiz
Quiz
•
8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Circuits, Light Energy, and Forces
Quiz
•
5th Grade
19 questions
Thanksgiving Trivia
Quiz
•
6th Grade
Discover more resources for Others
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
9 questions
Principles of the United States Constitution
Interactive video
•
University
18 questions
Realidades 2 2A reflexivos
Quiz
•
7th Grade - University
10 questions
Dichotomous Key
Quiz
•
KG - University
25 questions
Integer Operations
Quiz
•
KG - University
7 questions
What Is Narrative Writing?
Interactive video
•
4th Grade - University
20 questions
SER vs ESTAR
Quiz
•
7th Grade - University
