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

8/11

Page

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

Which function helps you perform sorting in R language?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

. . . . . . . . is used to apply a function over subsets of a vector.

Select an option to see the answer and solution.

Which of the variable in the following R code is variable?
> f <- function(x, y) {
+            x^2 + y / z
+ }

Select an option to see the answer and solution.

What will be the output of the following R code?
function(p) {
          params[!fixed] <- p
          mu <- params[1]
          sigma <- params[2]
## Calculate the Normal density
          a <- -0.5*length(data)*log(2*pi*sigma^2)
          b <- -0.5*sum((data-mu)^2) / (sigma^2)
          -(a + b)
}
> ls(environment(nLL))

Select an option to see the answer and solution.

. . . . . . . . initiates an infinite loop right from the start.

Select an option to see the answer and solution.

What will be the output of runif()?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

. . . . . . . . will produce a sequential vector c( (1,2,3,4,5,6,7,8,9)).

Select an option to see the answer and solution.

What are the different types of sorting algorithms available in R language?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

. . . . . . . . variables are categorical variables which can hold either string or numeric values.

Select an option to see the answer and solution.

. . . . . . . . measures the probability of the binary response variable in R language.

Select an option to see the answer and solution.

. . . . . . . . is the best way for communicating the results of data analysis using the R language.

Select an option to see the answer and solution.

Which function is difficult to implement?

Select an option to see the answer and solution.

. . . . . . . . allows you to modify the error behavior so that you can browse the function call stack

Select an option to see the answer and solution.

Which of the following is primary tool for debugging?

Select an option to see the answer and solution.

Point out the correct statement?

Select an option to see the answer and solution.

How will you check if an element is present in a vector?

Select an option to see the answer and solution.