
R QCM3 5 boucles et conditions
Authored by Marion WILTHIEN
Information Technology (IT)
University
Used 44+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Quelle est la syntaxe correcte d'une boucle for en R ?
for (i from 1 to 5) { print(i) }
for i in 1 to 5 { print(i) }
for (i in 1:5) { print(i) }
for (i to 5) { print(i) }
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Quelle est la sortie de ce code : for (i in 1:3) { print(i^2) }
1, 2, 3
1, 4, 9
2, 3, 4
1, 8, 27
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Quelle est la structure correcte d'une condition if en R ?
if [x > 10] { print("x est grand") }
if (x > 10) { print("x est grand") }
if x > 10 then print("x est grand")
if {x > 10} print("x est grand")
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Que fait le code suivant ? x <- 5 if (x > 3) { print("x est supérieur à 3") } else { print("x est inférieur ou égal à 3") }
Affiche "x est supérieur à 3"
Affiche "x est inférieur ou égal à 3"
Erreur de syntaxe
Rien
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Quelle est la sortie de ce code : for (i in 1:4) { if (i %% 2 == 0) { print(i) } }
1, 3
2, 4
1, 2, 3, 4
2
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Quelle est la sortie de ce code : x <- 10 if (x < 5) { print("Petit") } else if (x == 10) { print("Exact") } else { print("Grand") }
"Petit"
"Exact"
"Grand"
Erreur
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Quelle boucle est utilisée pour parcourir les éléments d'un vecteur en R ?
while
for
repeat
next
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?