R Programming

0
Answered
0
Correct
0%
Accuracy
Question 1 Easy Mcq

What is the output of the following commands? > x <- c(1, 2) > y <- c(x, 0, x) > z <- 2*x + y + 1 > z

Question 2 Easy Mcq

What is the correct way of converting a factor to integer in R?

Question 3 Easy Mcq

What is the output of the following commands? > x <- c(1, 2) > y <- c(4, 5) > pmax(x, y)

Question 4 Easy Mcq

What is the output of the following expression? num <- 5; res <- 1; for (i in 1:num) { if (i%%2 == 0) {res <- res * i}}; res

Question 5 Easy Mcq

What is the output of the following code? > x <- c(0, 1, 2, 3, 4, 5, 6, 7) > dim(x) <- c(2,2,2) > x[1,1,2]

Question 6 Easy Mcq

What is the result of the following code? > a <- array(c(0:1, 1:0), dim=c(2,2)) > a %*% a

Question 7 Easy Mcq

What will be the output of the following program on R interpreter?temp <- c("Comp|ex","Simple")cnt <- 10repeat[print(temp)cnt <— cnt-1if(cnt < 6.5) {break1}

Question 8 Easy Mcq

What is the output of the following expression? > c(0, FALSE)

Question 9 Easy Mcq

What is the output of the following code? > x <- outer(1:2, 1:2, FUN = "*") > x

Question 10 Easy Mcq

What is the difference between seq(4) and seq_along(4)?

Question 11 Easy Mcq

What is the result of the following code? > x <- 0:3 > y <- as.character(x) > z <- as.integer(y) > z

Question 12 Easy Mcq

What is the result of the following R code? > x <- c(0, 1, 2, 3, 4, 5, 6, 7) > dim(x) <- c(2,2,2) > x[,2,]

Question 13 Easy Mcq

What is the difference between matrix and dataframe?

Question 14 Easy Mcq

Lst <- list(name="Fred", wife="Mary", no.children=3, child.ages=c(4,7,9)) What is the value of length(Lst)?

Question 15 Easy Mcq

"%UpWork%" <- function(x, y) {upw <- x + y; upw} ans <- c(1,2)%UpWork%c(2,3) What is value of ans?

Question 16 Easy Mcq

What is the output of the following expression? > x <- c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) > x[-(1:3)]

Question 17 Easy Mcq

What is returned by the following code? x <- 0 y <- 10 f <- function() { x <- 1 g() } g <- function() { x <- 2 h() } h <- function() { x <- 3 x + y } f()

Question 18 Easy Mcq

What is the output of the following commands? > x <- c(1:3, NA) > y <- is.na(x) > y

Question 19 Easy Mcq

What is the output of the following commands? > x <- c(-1, 0, 1, 2, NA) > (x+1)[(!is.na(x)) & x>0]

Question 20 Easy Mcq

Lst <- list(name="Fred", wife="Mary", no.children=3, child.ages=c(4,7,9)) What is Lst[[1]]?

Question 21 Easy Mcq

What is the use of the doBY package?

Question 22 Easy Mcq

Following is a function definition in R programming language:dummy.function <- function(a.b.c) [result -=- a ā€˜+ b ' cprint(result)]Which of the following function calls will give the output: 41895?

Question 23 Easy Mcq

What is the output of the following expression? > c(list(1), "1")

Question 24 Easy Mcq

What is the output of the following command? > 2*1:10

Question 25 Easy Mcq

What is the factor variable in R language?

Question 26 Easy Mcq

Let v be a vector. What is the correct way of creating a factor from v?

Question 27 Easy Mcq

What is the output of the following commands? > x <- paste(c("X", "Y"), 1:2, sep='') > x

Question 28 Easy Mcq

Lst <- list(name="Fred", wife="Mary", no.children=3, child.ages=c(4,7,9)) What is the value of Lst[[4]][2]?

Question 29 Easy Mcq

R uses the function. barplotii. to create bar charts. The basic syntax to create a bar chart In R is:barplot(H. xlab. yiab. main. namesarg. col)Which of the following options are correct?

Question 30 Easy Mcq

What is the result of the following R code? > x <- 0:6 > y <- x[2 * 1:3] > length(y) <- 2 > y

Question 31 Easy Mcq

What is the result of the following R code? > x <- array(0:7, dim=c(2,2,2)) > i <- array(c(1:2, 4:3), dim=c(2,2)) > x[i]

Question 32 Easy Mcq

What is the result of the following R code? > a <- array(0:7, dim=c(2,2,2)) > b<-a%*%a > b[1]

Question 33 Easy Mcq

fun1 <- function(a, b, c, ... ) { ans <- 2; ans} s <- fun1(1, 2, 3, 4, 5, 6, 7, 8) What is the value contained by s?

Question 34 Easy Mcq

What is the output of the following commands?> x <- c(1, 2)> y <- c(x, 0, x)> prod(y)

Question 35 Easy Mcq

in R language, in order to calculate the mean of a given set of values, the mean() function is used. Following is the basic syntax for the same:mean(x, trim = O, na.rm = FALSE, ...)Which of the following parameters is used to remove the missing values from the input vector?

Question 36 Easy Mcq

What is the output of the following code? > y <- 5; f <- function(x) { y <-2; y^2 + g(x)}; g <- function(x) { x + y } > f(4)