Vidyalelo
R Programming · all questions

Control Structures in R Programming
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

207

Questions

5/11

Page

Pick an option on a question to see the right answer and solution.

Which of the following R code will print "Hello, world!"?

Options are not available for this question.

Select an option to see the answer and solution.

What will be the output of the following R code snippet?
> f <- function(a, b) {
+              print(a)
+              print(b)
+ }
> f(45)

Select an option to see the answer and solution.

The syntax of the repeat loop is . . . . . . . .

Select an option to see the answer and solution.

In the base graphics system, which function is used to add elements to a plot?

Select an option to see the answer and solution.

Which of the following R code generate a uniform random number?

Options are not available for this question.

Select an option to see the answer and solution.

Which function is used to select variables and observations from a given dataset?

Select an option to see the answer and solution.

Point out the correct statement?

Select an option to see the answer and solution.

Point out the wrong statement?

Select an option to see the answer and solution.

What will be the output of the following R code?
> printmessage <- function(x) {
+ if(x > 0)
+         print("x is greater than zero")
+ else
+         print("x is less than or equal to zero")
+ invisible(x)
+ }
> printmessage(1)

Select an option to see the answer and solution.

. . . . . . . . is an indication that a fatal problem has occurred and execution of the function stops.

Select an option to see the answer and solution.

What will be the output of the following R code snippet?
> lm <- function(x) { x * x }
> lm

Select an option to see the answer and solution.

Write the syntax to set the path of the current working directory in R environment?

Select an option to see the answer and solution.

Which of the following language supports lexical scoping?

Select an option to see the answer and solution.

What will be the value of following R expression?

Select an option to see the answer and solution.

What will be the output of the following R code?
> x <- 3
> switch(6, 2+2, mean(1:10), rnorm(5))

Select an option to see the answer and solution.

Warnings are generated by the . . . . . . . . function.

Select an option to see the answer and solution.

Point out the correct statement?

Select an option to see the answer and solution.

Point out the correct statement?

Select an option to see the answer and solution.

What will be the output of the following R code snippet?
> paste("a", "b", sep = ":")

Select an option to see the answer and solution.

What will be the output of the following R code?
> mean(x)
  Error in mean(x) : object 'x' not found
> traceback()

Select an option to see the answer and solution.