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

9/11

Page

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

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

Select an option to see the answer and solution.

What will be the output of the following R code snippet?
> f <- function(num = 1) {
+        hello <- "Hello, world!\n"
+        for(i in seq_len(num)) {
+                cat(hello)
+         }
+         chars <- nchar(hello) * num
+         chars
+ }
> f()

Select an option to see the answer and solution.

. . . . . . . . function can be used to select the random sample of size 'n' from a huge dataset.

Select an option to see the answer and solution.

. . . . . . . . package in R language provides various options for re-randomization and permutations based on statistical tests.

Select an option to see the answer and solution.

. . . . . . . . can be used for storing the data for long-term.

Select an option to see the answer and solution.

What will be the output of the following R code?
> g <- function(x) {
+               a <- 3
+               x+a+y
+             ## 'y' is a free variable
+ }
> y <- 3
> g(2)

Select an option to see the answer and solution.

What is the memory limit in R for 64 bit system?

Select an option to see the answer and solution.

Which of the following code will print NULL?

Select an option to see the answer and solution.

The current user defined objects like lists, vectors, etc. is referred to as . . . . . . . . in the R language.

Select an option to see the answer and solution.

If two vectors with different lengths perform some operation, the elements of the shorter vector will be used again to complete the operation. This is referred to as . . . . . . . .

Select an option to see the answer and solution.

Point out the wrong statement?

Select an option to see the answer and solution.

Which of the following R code can be used to avoid numeric problems such as taking the logarithm of a negative number?

Select an option to see the answer and solution.

debug() flags a function for . . . . . . . . mode in R mode.

Select an option to see the answer and solution.

You can check to see whether an R object is NULL with the . . . . . . . . function.

Select an option to see the answer and solution.

What will be the output of the following R expression?
> log(-2.3)

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?
> 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(NA)

Select an option to see the answer and solution.

A . . . . . . . . in R programming language can also contain numeric and alphabets along with special characters like dot and underline.

Select an option to see the answer and solution.

What will be the output of the following R code?
> nLL <- make.NegLogLik(normals, c(FALSE, 2))
> optimize(nLL, c(-1, 3))$minimum

Select an option to see the answer and solution.

How do you create log linear models in R language?

Select an option to see the answer and solution.