MCQs > IT & Programming > R Programming MCQs > Basic R Programming MCQs

Basic R Programming MCQ

1. Point out the correct statement.

Answer

Correct Answer: Empty vectors can be created with the vector() function

Note: This Question is unanswered, help us to find answer for this one

2.

What can a factor hold?

Answer

Correct Answer: Both strings and integers

Note: This Question is unanswered, help us to find answer for this one

3.

Identify which of the following expressions will give an error in R:

Answer

Correct Answer: _abc <- 1

Note: This Question is unanswered, help us to find answer for this one

4.

Which of the following is an invalid assignment ?

Answer

Correct Answer: > name(x) <- c("New York", "Seattle", "Los Angeles")

Note: This Question is unanswered, help us to find answer for this one

5.

____ loops over a list and evaluate a function on each element.

Answer

Correct Answer: apply()

Note: This Question is unanswered, help us to find answer for this one

6.

Which of the following is a valid body of split function ?

Answer

Correct Answer: function (x, f, drop = FALSE, …)

Note: This Question is unanswered, help us to find answer for this one

7.

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

Answer

Correct Answer: 4

Note: This Question is unanswered, help us to find answer for this one

8.

What is the use of the doBY package?

Answer

Correct Answer: defines the desired table using function and model formula

Note: This Question is unanswered, help us to find answer for this one

9.

Which statement changes the column name to h and f of a matrix m?

Answer

Correct Answer: colnames(m) <- c("h", "f")

Note: This Question is unanswered, help us to find answer for this one

10.

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

Answer

Correct Answer: seq(4) produces a vector from 1 to 4 (c(1, 2, 3, 4)), and seq_along(4) produces a vector of length(4), or 1 (c(1))

Note: This Question is unanswered, help us to find answer for this one

11.

Which package in R supports the exploratory analysis of genomic data?

Answer

Correct Answer: adegenet

Note: This Question is unanswered, help us to find answer for this one

12.

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

Answer

Correct Answer: [1] 1 3

Note: This Question is unanswered, help us to find answer for this one

13.

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

Answer

Correct Answer: [1] 0 0

Note: This Question is unanswered, help us to find answer for this one

14.

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

Answer

Correct Answer: [1] 0 1 2 3

Note: This Question is unanswered, help us to find answer for this one

15.

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

Answer

Correct Answer: [1] "X1" "Y2"

Note: This Question is unanswered, help us to find answer for this one

16.

In an R list, '[[...]]' is ......

Answer

Correct Answer: the operator used to select a single element.

Note: This Question is unanswered, help us to find answer for this one

17.

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

Answer

Correct Answer: All of the above

Note: This Question is unanswered, help us to find answer for this one

18.

_____ function removes predictors that are sparse and highly unbalanced?

Answer

Correct Answer: nearZeroVar

Note: This Question is unanswered, help us to find answer for this one

19.

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

Answer

Correct Answer: [1] 13

Note: This Question is unanswered, help us to find answer for this one

20.

Does the following expression throw an error? f2 <- function(a, b) { a * 10 } f2(10, stop("This is not an error!"))

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

21.

Which of the expressions below result in the following output?

> [1] "a b"

Answer

Correct Answer:

> `%/\\%` <- function(a, b){ return(paste(a, b))} > "a" %/\% " b"

Note: This Question is unanswered, help us to find answer for this one

22.

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)

Answer

Correct Answer: 13

Note: This Question is unanswered, help us to find answer for this one

23.

Point out the wrong statement.

Answer

Correct Answer: A formal argument can be a symbol, a statement of the form ‘symbol = expression’, or the special formal argument

Note: This Question is unanswered, help us to find answer for this one

24.

What will be the output of the following code ? > f <- function() { + ## This is an empty function + } > f()

Answer

Correct Answer: NULL

Note: This Question is unanswered, help us to find answer for this one

25.

M2 performs class prediction based on ___ data and clinical parameters?

Answer

Correct Answer: microarray

Note: This Question is unanswered, help us to find answer for this one

26.

Data frames in R language can be merged manually using? Check all that apply.

Answer

Correct Answer: cbind ()
merge ()

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

27.

What would be the output of the following code ? > x <- 1:4 > x > 2

Answer

Correct Answer: FALSE FALSE TRUE TRUE

Note: This Question is unanswered, help us to find answer for this one

28.

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?

Answer

Correct Answer: 2
3
7

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

29.

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

Answer

Correct Answer: Error

Note: This Question is unanswered, help us to find answer for this one

30.

What does the following code return? x <- 5 f1 <- function(x) { function() { x + 6 } } f1(3)()

Answer

Correct Answer: 9

Note: This Question is unanswered, help us to find answer for this one

31.

fun1 <- function(data, data.frame, graph=TRUE, limit=20) { ... [ function body omitted] ... } Which of the following does NOT involve a valid invocation of this function?

Answer

Correct Answer: ans <- fun1(d)

Note: This Question is unanswered, help us to find answer for this one

32.

Which code can be used for converting all variables?

Answer

Correct Answer: col_names <- names(mydata) mydata[,col_names] <- lapply(mydata[,col_names] , factor)
col_names <- names(mydata) mydata[,col_names] <- lapply(mydata[,col_names] , factor)

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

33.

What is the output of the following commands?

> x <- c(1, 2)

> y <- c(x, 0, x)

> prod(y)

Answer

Correct Answer: [1] 1 2 0 1 2

Note: This Question is unanswered, help us to find answer for this one

34.

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

Answer

Correct Answer: [1] 2 3

Note: This Question is unanswered, help us to find answer for this one

35.

What are the column names of the dataset?

Answer

Correct Answer: names(dataset)
colnames(dataset)

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

36.

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

Answer

Correct Answer: (3, 5)

Note: This Question is unanswered, help us to find answer for this one

37.

Which function performs classical multidimensional scaling?

Answer

Correct Answer: cmdscale() function

Note: This Question is unanswered, help us to find answer for this one

38.

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

Answer

Correct Answer: is.null()

Note: This Question is unanswered, help us to find answer for this one

39.

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

Answer

Correct Answer: 8

Note: This Question is unanswered, help us to find answer for this one

40.

__ prints out the function call stack after an error occurs?

Answer

Correct Answer: traceback()

Note: This Question is unanswered, help us to find answer for this one

41.

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

Answer

Correct Answer: [1] 3 4 5 6 7 8 9

Note: This Question is unanswered, help us to find answer for this one

42.

Which code will rename the field old_name to new_name in the data frame called data?

Answer

Correct Answer: colnames(data)[colnames(data)=="old_name"] <- "new_name"

Note: This Question is unanswered, help us to find answer for this one

43.

What would the following code print ? > x <- data.frame(foo = 1:4, bar = c(T, T, F, F)) > ncol(x)

Answer

Correct Answer: 2

Note: This Question is unanswered, help us to find answer for this one

44.

In which of the following is HousePrice a data frame? (1) HousePrice <- data.frame(home=statef, postCode=zip, price=fee) (2) HousePrice <- read.table("house.data") (3) HousePrice <- scan("house.data", list("", 0, 0)

Answer

Correct Answer: 1 and 2

Note: This Question is unanswered, help us to find answer for this one

45.

___ function returns a vector of the same size as x with the elements arranged in increasing order.

Answer

Correct Answer: orderasc()

Note: This Question is unanswered, help us to find answer for this one

46.

Consider the following code output? x = "I love R Programming" library(stringr) str_to_title(x)

Answer

Correct Answer: I LOVE R PROGRAMMING

Note: This Question is unanswered, help us to find answer for this one

47.

Which function is used to generate factor levels?

Answer

Correct Answer: gl()

Note: This Question is unanswered, help us to find answer for this one

48.

___regression is used to predict the binary outcome from the given set of continuous predictor variables?

Answer

Correct Answer: Logistic

Note: This Question is unanswered, help us to find answer for this one

49.

How can you merge two data frames in R?

Answer

Correct Answer: Using combine() function

Note: This Question is unanswered, help us to find answer for this one

50.

What are the row names of the data frame?

Answer

Correct Answer: row.names(dataset)
rownames(dataset)

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

51.

Which statement makes a mosaic plot ?

Answer

Correct Answer: mosaicplot()

Note: This Question is unanswered, help us to find answer for this one

52.

What is the factor variable in R language?

Answer

Correct Answer: Both 1 and 2

Note: This Question is unanswered, help us to find answer for this one

53.

How do you create log linear models in R language?

Answer

Correct Answer: loglm () function

Note: This Question is unanswered, help us to find answer for this one

54.

R is easily extensible through functions and ____?

Answer

Correct Answer: Extensions

Note: This Question is unanswered, help us to find answer for this one

55.

What is the difference between matrix and dataframe?

Answer

Correct Answer: Dataframe can contain different types of data but matrix can contain only similar type of data.

Note: This Question is unanswered, help us to find answer for this one

56.

Which of the following determines the least-squares regression line ?

Answer

Correct Answer: lm

Note: This Question is unanswered, help us to find answer for this one

57.

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

Answer

Correct Answer: factor(v)

Note: This Question is unanswered, help us to find answer for this one

58.

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,]

Answer

Correct Answer: [,1] [,2] [1,] 2 6 [2,] 3 7

Note: This Question is unanswered, help us to find answer for this one

59.

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

Answer

Correct Answer: [,1] [,2] [1,] 1 0 [2,] 0 1

Note: This Question is unanswered, help us to find answer for this one

60.

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

Answer

Correct Answer: [1] 6 5

Note: This Question is unanswered, help us to find answer for this one

61.

How can you create scatterplot matrices?

Answer

Correct Answer: Both 1 and 2

Note: This Question is unanswered, help us to find answer for this one

62.

Data frames can be converted to a matrix by calling data.__

Answer

Correct Answer: matrix()

Note: This Question is unanswered, help us to find answer for this one

63.

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]

Answer

Correct Answer: [1] 0 1 3 2

Note: This Question is unanswered, help us to find answer for this one

64.

How do you obtain the transpose of a matrix m in R?

Answer

Correct Answer: t(m)

Note: This Question is unanswered, help us to find answer for this one

65.

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]

Answer

Correct Answer: [1] 4

Note: This Question is unanswered, help us to find answer for this one

66.

Which of the following is lattice command for producing boxplots ?

Answer

Correct Answer: bwplot()

Note: This Question is unanswered, help us to find answer for this one

67.

Point out the correct statement.

Answer

Correct Answer: Matrices are vectors with a dimension attribute

Note: This Question is unanswered, help us to find answer for this one

68.

Error is an indication that a fatal problem has occurred and __ of the function stops?

Answer

Correct Answer: execution

Note: This Question is unanswered, help us to find answer for this one

69.

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

Answer

Correct Answer: [,1] [,2] [1,] 1 2 [2,] 2 4

Note: This Question is unanswered, help us to find answer for this one

70.

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

Answer

Correct Answer: 140

Note: This Question is unanswered, help us to find answer for this one

71.

While creating a data frame, the variables must have __ length?

Answer

Correct Answer: Same

Note: This Question is unanswered, help us to find answer for this one

72.

uniPlot uniforms and customizes plots of packages _ , __ and lattice?

Answer

Correct Answer: ggplot2, graphics

Note: This Question is unanswered, help us to find answer for this one

73.

What would be the output of the following code ? > m <- matrix(1:4, nrow = 2, ncol = 2) > dimnames(m) <- list(c("a", "b"), c("c", "d")) > m

Answer

Correct Answer: c d a 1 3 b 2 4

Note: This Question is unanswered, help us to find answer for this one

74.

The following vector represents the country of each of 10 freelancers on UpWork: > country <- c("UK", "Vietnam", "USA", "Russia", "Russia", "Egypt", "UK", "Vietnam", "Egypt", "USA") The following vector represents the hourly rate of the same 10 freelancers: > hourlyRate <- c(10, 20, 30, 40, 50, 50 ,40 ,30 ,20 ,10) Which R command will show the average rate for each country?

Answer

Correct Answer: tapply(hourlyRate, country, mean)

Note: This Question is unanswered, help us to find answer for this one

75.

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

Answer

Correct Answer: [[1]] [1] 1 [[2]] [1] "1"

Note: This Question is unanswered, help us to find answer for this one

76.

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

Answer

Correct Answer: [1] FALSE TRUE TRUE

Note: This Question is unanswered, help us to find answer for this one

77.

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

Answer

Correct Answer: [1] 4 5

Note: This Question is unanswered, help us to find answer for this one

78.

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

Answer

Correct Answer: [1] 0 1 2 3 4 5 6 7 8 9

Note: This Question is unanswered, help us to find answer for this one

79.

The ____ function takes an arbitrary number of arguments and concatenates them one by one into character strings?

Answer

Correct Answer: copy()

Note: This Question is unanswered, help us to find answer for this one

80.

Functions are defined using the _____ directive and are stored as R objects.

Answer

Correct Answer: function()

Note: This Question is unanswered, help us to find answer for this one

81.

Which function gives the structure of a data frame “df”?

Answer

Correct Answer: str(df)

Note: This Question is unanswered, help us to find answer for this one

82.

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

Answer

Correct Answer: [1] 2 4 6 8 10 12 14 16 18 20

Note: This Question is unanswered, help us to find answer for this one

83.

Which of the following is lattice command for producing a scatterplot ?

Answer

Correct Answer: xyplot()

Note: This Question is unanswered, help us to find answer for this one

84.

Point out the correct statement.

Answer

Correct Answer: Sequence of operations is sometimes referred to as “map-reduce”

Note: This Question is unanswered, help us to find answer for this one

85.

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

Answer

Correct Answer: a2 = as.numeric(as.character(a)) str(a2)

Note: This Question is unanswered, help us to find answer for this one

86.

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

Answer

Correct Answer: [1] FALSE FALSE FALSE TRUE

Note: This Question is unanswered, help us to find answer for this one

87.

Point out the correct statement.

Answer

Correct Answer: None of the mentioned

Note: This Question is unanswered, help us to find answer for this one

88.

Melt is used to convert wide data to _____ data?

Answer

Correct Answer: long

Note: This Question is unanswered, help us to find answer for this one

89.

gzfile opens a connection to a file compressed with _____?

Answer

Correct Answer: gzip

Note: This Question is unanswered, help us to find answer for this one

90.

Which function is used to convert a list ‘a’ to a vector?

Answer

Correct Answer: unlist(a)

Note: This Question is unanswered, help us to find answer for this one

91.

What would be the output of the following code ? > x <- 1:3 > names(x)

Answer

Correct Answer: NULL

Note: This Question is unanswered, help us to find answer for this one

92.

Using the __ the BY variable should be in the list?

Answer

Correct Answer: aggregate() function

Note: This Question is unanswered, help us to find answer for this one

93.

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

Answer

Correct Answer: 7

Note: This Question is unanswered, help us to find answer for this one

94.

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

Answer

Correct Answer: Fred

Note: This Question is unanswered, help us to find answer for this one

95. Which of the following commands is used to load the "xlsx" package into the R workspace?

Answer

Correct Answer: library('xlsx')

Note: This Question is unanswered, help us to find answer for this one

96. Which of the following options is used for checking the directory to which the R workspace is pointing?

Answer

Correct Answer: getwd

Note: This Question is unanswered, help us to find answer for this one

97. Which of the following control structures is used to execute an infinite loop?

Answer

Correct Answer: repeat

Note: This Question is unanswered, help us to find answer for this one

98. In R programming language. which of the following are the loop control statements?

Answer

Correct Answer: break
next

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

99.

What will be the output of the following program on R interpreter?

tempString <- "Hello.World!"

print (tempString)

tempString

Answer

Correct Answer:

[1] "Hello,World!"

[1] "Hello,World!"


Note: This Question is unanswered, help us to find answer for this one

100.

What will be the output of the following program on R interpreter?

foo <- 'red'

switch(foo, fruit = "apple", vegetable = “chilli‘. "Exception')

Answer

Correct Answer:

Exception 


Note: This Question is unanswered, help us to find answer for this one

101.

What will be the output of the following program on R interpreter?

custom_cub_function <- function()

i

for(i in 1:4)

{

i

cubeoutput <- i"3

print[cubeoutput)

}

Answer

Correct Answer:

No output.  


Note: This Question is unanswered, help us to find answer for this one

102. To create a relationship model, the lrn() function is used in R. Which of the following are the valid parameters for this function?

Answer

Correct Answer: formula, which is a symbol. presenting the relation between x and y.
data. which is the vector on which the formula will be applied.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

103. In R programming language, the library(x) function:

Answer

Correct Answer: will load add-on packages

Note: This Question is unanswered, help us to find answer for this one

104.

You have an Excel workbook with the name "data.xlsx". it has 3 sheets. Which of the following options will load the Excel workbook and read the second sheet?

Answer

Correct Answer:

data <~ read.xlsx(‘data.xlsx', sheetlndex = 2) 


Note: This Question is unanswered, help us to find answer for this one

105. In R programming. which of the following are the valid values for the data type, Numeric?

Answer

Correct Answer: 1 1 123
2 999

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

106.

R has four in-built functions to generate a normal distribution. Which of the following functions gives the height of the probability distribution at each point for a given mean and standard deviation?

Answer

Correct Answer:

dnorm(x, mean, sd)  


Note: This Question is unanswered, help us to find answer for this one

107. In R programming. which of the following functions are included in the standard Strings Library?

Answer

Correct Answer: grep(pattern.x)
match(x,table)

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

108.

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?

Answer

Correct Answer:

na.rm


Note: This Question is unanswered, help us to find answer for this one

109.

R has four in-built functlons to generate a normal distributlon. Which of the following functions takes the probability value and gives a number. whose cumulative value matches the probability value?

Answer

Correct Answer:

qnorm(p.mean. sd)  


Note: This Question is unanswered, help us to find answer for this one

110.

The middle-most value in a data series is called the median. The median() function is used. in R. to calculate this value. Which of the following are the valid parameters in the median() function?

Answer

Correct Answer:

x, which is the input vector.


na.rm, which is used to remove the missing values from the input vector.


Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

111.

What will be the output of the following R code?

car_colors <~ ci‘black',‘red','blue'.'blue'.'-.vltite'.‘metallic',‘red')

tactor_cars <~ Iactor(car_colors)

Print (factor_cars)

print(nlevels(factot_cats))

Answer

Correct Answer:

 [1] black red blue blue White metallic red

Levels: black blue metallic red white

[1] 5   



Note: This Question is unanswered, help us to find answer for this one

112.

What will be the output ofthe following program on R interpreter?

foo <- C("Testing","loop")

count <— 5

repeat {


print(foo)


count <- count +1


if(count > 8.34)[


break

}

]


Answer

Correct Answer:

[1]"Testing""loop"

[1] "Testing""loop"

[1] "Testing""loop"

[1] "Testing""loop"


Note: This Question is unanswered, help us to find answer for this one

113.

What will be the output of the following program on R Interpreter?

foo <- c(‘Testing‘.’while statement‘)

cnt <- 7

while [cnt<11.64)

[

printltoo)

cnt = count + 1

]

Answer

Correct Answer:

[1] 'Testlng’”while statement’

[1] "Testing‘'while statement'

[1] “Testing“while statement‘

[1] "Testing"‘while statement'

[1] "Testing”while statement‘ 


Note: This Question is unanswered, help us to find answer for this one

114.

Following is a function def‌inition in R programming language:

foo.function <- function(a =1, b = 2. c = 3)

{result <- a ’ b+ c

print(result)

}

Answer

Correct Answer:

 foo.functlon()


 foo.functlon(8,6,4)


 foo.functlon(b=10,a=9)


Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

115. Which of the following statements is/are correct?

Answer

Correct Answer: print(rootnode[[1]]11]]) will get the f‌irst element of the second node
printfrootnodef‌limm) will get the f‌irst element of the f‌irst node.
xmlToDataFrarnefinputxml
xmlSize(rootnode) will f‌ind the number of child nodes under the root node.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

116.

Following is a code snippet executed on R interpreter:

sales <- c(10,20.30.40.50)

months <- c{"JAN".“FEB"."MARCH"."APRIL"."MAY")

png(file = "months_sales.png")

barplot(sales,names.arg = months.xlab = "Month".ylab = "Sales",col = "Red",main = "Sales Chart“,border =

"Black")

What does this code do?


Answer

Correct Answer:

It creates the vector data for the bar chart.


It gives a name to the chart f‌ile.


It plots the bar chart.


Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

117.

Find the error in following code snippet

foodata <- data.frame(

empid = C(11:15),

empname = c("EMP2"."EMP3"."EMP4","EMP5"),

"" = c(100,200,300,400,500},

empjoindate = asDatetcf'2017—01-01", '2017~02~01", '2017-03-01‘, "2017-0401”,"2017~05-01‘)),

stringsAsFactors = FALSE

)

print(foo.data)

Answer

Correct Answer:

 One of the column names has a zero-length variable name.


The column

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

118. Which of the following functions is used for variable conversions?

Answer

Correct Answer: as.array

Note: This Question is unanswered, help us to find answer for this one

119.

What wlll be the Output of the following program on R Interpreter?

v <- LETTERS[5:1]

{or (i in v)

{

print(i)

}

Answer

Correct Answer:

[1] “E”

[1] "D"

[1] “C”

[1] "B"

[1] "A.” 


Note: This Question is unanswered, help us to find answer for this one

120. Which of the following functions computes the combinations of k events among n repetitions = ner_(n-k)!kl]?

Answer

Correct Answer: choose(n. K)

Note: This Question is unanswered, help us to find answer for this one

121.

Following is a code snippet to be used to draw a boxplot in R:

boxplot(mpg "‘ Cyl, data = mtcars,

xiab = "Number of Cylinders",

ylab = Miles Per Gallon“,

main = "Mileage Data",

notch = TRUE,

varwldth = FALSE.

col = ched","Biue","Green"],

names = c("High","Medium","Low")

Which of the following options is NOT correct?

Answer

Correct Answer:

It will draw a box with the width proportionate to the sample (data inputted) size.     


Note: This Question is unanswered, help us to find answer for this one

122. In R programming. a pie chart is created using the plea function. Which of the following parameters is used to give description to the slices?

Answer

Correct Answer: labels

Note: This Question is unanswered, help us to find answer for this one

123. Which of the following commands is used to check and verify whether or not the ”xlsx" package is installed?

Answer

Correct Answer: any(grepl(‘x|sx',instalIed.packages()))

Note: This Question is unanswered, help us to find answer for this one

124. There is a csv f‌ile named "data.csv". Which of the following options will read that csv f‌ile in R programming?

Answer

Correct Answer: output <- read.csv('data.csv')

Note: This Question is unanswered, help us to find answer for this one

125. Which of the following decision-making statements is used to test a variable for equality against a list of values?

Answer

Correct Answer: Switch

Note: This Question is unanswered, help us to find answer for this one

126. Which of the following are the valid vector Inputs to the pie() function?

Answer

Correct Answer: foo <. c[10. 10. 10. 70)
foo <- c[0. 10. 10. 90)

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

127. In R programming language. which of the following statements is NOT correct about operators?

Answer

Correct Answer: operator creates the series of numbers in sequence for a vector.

Note: This Question is unanswered, help us to find answer for this one

128.

What will be the output of the following program on R interpreter?

temp <- c("Comp|ex","Simple")

cnt <- 10

repeat

[

print(temp)

cnt <— cnt-1

if(cnt < 6.5) {

break

1

}

Answer

Correct Answer:

[1]"Complex""Simple"

[1] "Complex""Simple"

[1] "Complex""Simple"

[1] "Complex""Simple"


Note: This Question is unanswered, help us to find answer for this one

129. Which of the following options represents an atomic vector of the numeric type?

Answer

Correct Answer: print(24)

Note: This Question is unanswered, help us to find answer for this one

130. in R programming. a pie chart is created using the piel] function. Which of the following parameters indicates the title of the chart?

Answer

Correct Answer: main

Note: This Question is unanswered, help us to find answer for this one

131.

Following Is a function def‌inition in R programming language:

foo.function <- function(a,b)

{

print{a)

print{b‘b)

}

Which of the following function calls will give an error?

Answer

Correct Answer:

 foo.functlon(9)


Note: This Question is unanswered, help us to find answer for this one

132.

What will be the output of the following program on R interpreter?

OUTPUTMATRIX = matrix( c("1","2"."3"."4"."5"."6"."7"."8"."9"."10"."11","12"). nrow = 4, ncol = 3. byrow = FALSE)

print(OUTPUTMATRlX)


Answer

Correct Answer:

[.1] [.2] [.3]

[1.] '1' ' 5' '9'

[2.] '2' '6' '10'

[3.] '3' '7' '11'

[4.] '4' '8' '12'   



Note: This Question is unanswered, help us to find answer for this one

133. In R programming. which of the following are the valid values for the data type, Integer?

Answer

Correct Answer: 13 4L
0L

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

134.

Following is a function definition in R programming language:


dummy.function <- function(a.b.c) [

result -=- a ‘+ b ' c

print(result)

]


Which of the following function calls will give the output: 41895?

Answer

Correct Answer:

dummy.function(200.1345.31)


dumnly.function(b=1345.a=200.c=31]


Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

135.

What will be the output of the following code on the R Interpreter?

print(seq(7,12. by = 0.68))

Answer

Correct Answer:

[1] 7.00 7.68 8.36 9.04 9.7210.4011.0811.76  


Note: This Question is unanswered, help us to find answer for this one

136.

In R programming language. the arguments of a function can be partially matched using the following checks:

Check for a partial match.

Check for a positional match.

Check for exact match for a named argument

Which of the following Is the correct sequence of checks followed by the function to partially match the supplied arguments?


Answer

Correct Answer:

CAB 


Note: This Question is unanswered, help us to find answer for this one

137. In R programming. in order to read a text file, the read.table() function is used. Which of the following options are the valid arguments for this function?

Answer

Correct Answer: file
header
sep
quote

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

138.

What will be the output of the following program on R Interpreter?

v <- 3+16i

printiclass()

v <— 3"46

print[class[v])


v <~ 3l+16

printiclassMJ


v <- 316


print(class[v))

Answer

Correct Answer:

[[1] 'complex'

[1] 'numeric'

[1] 'complex'

[1] 'numeric' 


Note: This Question is unanswered, help us to find answer for this one

139. What will be the output of the following line of code on R Interpreter?

Answer

Correct Answer: [1] TESTOUTPUT

Note: This Question is unanswered, help us to find answer for this one

140.

What will be the output of the following program on R interpreter?

v <- LETTERS[9.55:15.86]

for ( i in v)

{

if (i = "0")(


next


]

print(i)

}


Answer

Correct Answer:

[1]'1'

[1] 'J'

[1]'k'


[1] 'L'

[1]M'


[1] 'N'


[1] '0'


Note: This Question is unanswered, help us to find answer for this one

141. Which of the following are related to slicing and extracting data by indexing lists?

Answer

Correct Answer: Xllnil
['1'] xf‌l'name

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

142. Which of the following options represents an atomic vector of the integer type?

Answer

Correct Answer: print(2+3i)

Note: This Question is unanswered, help us to find answer for this one

143. In R programming language, the indexing vectors, xl-[lzn)]. will:

Answer

Correct Answer: get elements from n+1 to the end.

Note: This Question is unanswered, help us to find answer for this one

144.

Which of the given tasks are performed by the following code?

library("rjso")

result <- fromJSON(lile = '"data.json"]

print(result)

Answer

Correct Answer:

I It loads the package required to read JSON files.


It reads the file


It prints the contents of the [son file.



Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

145.

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?


Answer

Correct Answer:

namesarg is a vector of names appearing under each bar.


col is used to give colors to the bars in the graph.


Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

146. Which of the following functions is used to join multiple vectors to create a data frame?

Answer

Correct Answer: cbind()

Note: This Question is unanswered, help us to find answer for this one

147. Which of the following statements terminates the loop statement and transfers execution to the immediate statement?

Answer

Correct Answer: break

Note: This Question is unanswered, help us to find answer for this one

148.

Find the output of the following code on the R Interpreter.

months <- c{"JAN"."FEB"."MARCH"."APRIL"."MAY"."JUNE"."JULY")

output <- months[c(1.TRUE.4.TRUE.5)]

print(output)


Answer

Correct Answer:

[1]'JAN' 'JAN' 'APRIL' 'JAN' 'MAY' 


[1]' JAN' 'FEB' 'MARCH' 'APRIL' 'MAY'


Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one