Question
> x <- c("a", "b", "c", "d")
> for(i in 1:4) {
+ ## Print out each element of 'x'
+ print(x[i])
+ }
a.
[1] "a"
[1] "b"
[1] "c"
[1] "d"
b.
[1] "c"
[1] "b"
[1] "a"
[1] "d"
c.
[1] "d"
[1] "c"
[1] "b"
[1] "a"
d.
Error
Posted under R Programming
[1] "b"
[1] "c"
[1] "d"
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What will be the output of the following R code?
Similar Questions
Discover Related MCQs
Q. Which of the following code skips the first 20 iterations?
View solution
Q. Point out the correct statement?
View solution
Q. _________ initiates an infinite loop right from the start.
View solution
Q. Which of the following R code snippet stops loop after 20 iterations?
View solution
Q. Point out the wrong statement?
View solution
Q. _______ is used to skip an iteration of a loop.
View solution
Q. Which of the following R code can be used to avoid numeric problems such as taking the logarithm of a negative number?
View solution
Q. R has ________ statements that provide explicit looping.
View solution
Q. The syntax of the repeat loop is _________
View solution
Q. Point out the correct statement?
View solution
Q. Point out the correct statement?
View solution
Q. Which of the following R code will print “Neither”?
View solution
Q. R has ________ basic indexing operators.
View solution
Q. The syntax of the for loop is?
View solution
Q. Which of the following R code syntax is syntactically valid?
View solution
Q. Which of the following is apply function in R?
View solution
Q. Point out the correct statement?
View solution
Q. Functions are defined using the _________ directive and are stored as R objects.
View solution
Q. Point out the wrong statement?
View solution
Q. Which of the following R code will print “Hello, world!”?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond R Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!