R Programming MCQs

R Programming MCQs

Try to answer these 100+ R Programming MCQs and check your understanding of the R Programming subject.
Scroll down and let's begin!

1:

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)


A.  

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

B.  

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

C.  

[1]' JAN' 'JAN' 'APRIL' 'MAY' ‘JUNE'

D.  

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

2: Which of the following statements terminates the loop statement and transfers execution to the immediate statement?

A.   if

B.   for

C.   break

D.   next

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

A.   cbind()

B.   rbind()

C.   merge()

D.   meit()

4:

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?


A.  

H is the title of the bar chart.

B.  

main is a vector or matrix containing numeric values used in the bar chart.

C.  

namesarg is a vector of names appearing under each bar.

D.  

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

5:

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

library("rjso")

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

print(result)

A.  

I It loads the package required to read JSON files.

B.  

It reads the file

C.  

It prints the contents of the [son file.


D.  

None of the above.

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

A.   get the first n elements.

B.   get elements from n+1 to the end.

C.   get the nth element

D.   get all elements but the nth element.

7: Which of the following options represents an atomic vector of the integer type?

A.   print(24L)

B.   print(24)

C.   print(12.5)

D.   print(2+3i)

A.   Xl-(iznll

B.   Xllnil

C.   ['1'] xf‌l'name

D.   F1 x[i,j]

9:

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)

}


A.  

[1]'1'

[1] 'J'

[1]'k'


[1] 'L'

[1]M'


[1] 'N'


[1] '0'

B.  

[1] 'l'

[11 'J'

[1] 'K'

[1]'’L'

[1]'M'

[1]W

C.  

No output.

D.  

[1] 'G'

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

A.   Empty output

B.   TESTOUTPUT

C.   Compilation error

D.   [1] TESTOUTPUT

11:

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

A.  

O [t] 'complex'

[1119

[1] 'character'

[1] 'numeric‘         


B.  

[[1] 'complex'

[1] 'numeric'

[1] 'complex'

[1] 'numeric' 

C.  

Compilation error

D.  

Runtime error

12: 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?

A.   file

B.   header

C.   what

D.   sep

E.   quote

13:

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?


A.  

ABC 

B.  

BCA 

C.  

CAB 

D.  

AcB

14:

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

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

A.  

 [1] 7.68 8.36 9.04 9.7210.4011.0811.76  

B.  

[1] 7.00 7.68 8.36 9.04 9.7210.4011.0811.76  

C.  

[1] 7.00 7.68 8.36 9.04 9.7210.4011.08

D.  

[1] 7.68 8.36 9.04 9.7210.4011.08

15:

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?

A.  

dummy.function(1345.200.31)

B.  

dummy.function(200.1345.31)

C.  

dummy.function(1345.31.200)

D.  

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

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

A.   13 4L

B.   4

C.   0L

D.   0

17:

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)


A.  

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

[1,] '1' '2' '3'

[2.] '4' '5' '6'

[3']'7' '8' '9'

[4.] '10' '11' '12'

B.  

[1].[2][.3][,4]

[1'] 1' '2' '3' '4'

[2’] '5' '6' '7' '8'

[3'] '9' '10' 11'12' 

C.  

[111.211.311.41

[1,] '1' ' 4III7IIH10'

[2,] '2' '5ll118lll11'

[3’] '3' '6' '9' '12'

D.  

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

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

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

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

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


18:

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?

A.  

 foo.function

B.  

 foo.functlon(9,5) 

C.  

 foo.function[b=2,4)

D.  

 foo.functlon(9)

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

A.   col

B.   labels

C.   radius

D.   main

20: Which of the following options represents an atomic vector of the numeric type?

A.   print(24L)

B.   print(24)

C.   printr12.5)

D.   print(2+3i)

21:

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

}

A.  

[1]"Complex""Simple"

[1] "Complex""Simple"

[1] "Complex""Simple"

[1] "Complex""Simple"

B.  

Error in code execution

C.  

System timeout error.

D.  

[1]"Complex""Simple"

[1] "Complex""Simple"

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

A.   operator creates the series of numbers in sequence for a vector.

B.   0%in% operator is used to multiply a matrix with its transpose.

C.   %/% operator gives result of the division of f‌irst vector with second (quotient).

D.   ^ operator gives the remainder of the division of first vector with the second.

23: Which of the following are the valid vector Inputs to the pie() function?

A.   foo <- c[O. 0.0.0)

B.   foo <. c[10. 10. 10. 70)

C.   foo <- c(-10. 10. 0. 90)

D.   foo <- c[0. 10. 10. 90)

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

A.   if

B.   If...else

C.   while

D.   Switch

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

A.   output <- read.csv('data.csv')

B.   output <- readcsv(‘'data.csv')

C.   output <- read('data.csv')

D.   output <- readf‌ile.csv('data.csv‘)

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

A.   install.packages('xlsx‘)

B.   any(grepl(‘x|sx',instalIed.packages()))

C.   library('xlsx')

D.   read.xlsx()

27: 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?

A.   col

B.   labels

C.   radius

D.   main

28:

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?

A.  

 it will draw a boxplot with 'Number of Cylinders' values on x axis and the Miles Per Gallon' data on y axis.

B.  

it will give a title to the graph as Mileage Data   

C.  

it will draw the notch graphs

D.  

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

E.  

 it will fill the color of the boxes as red, blue and green, respectively.

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

A.   which(n = k)

B.   match(n, k)

C.   merge(n,k)

D.   choose(n. K)

30:

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

v <- LETTERS[5:1]

{or (i in v)

{

print(i)

}

A.  

[1] “E”

[1] "D"

[1] “C”

[1] "B"

[1] "A.” 

B.  

[1] “A”

[1] 'B-.

[I] "C'

C.  

[1] “A"

[‘1 “B

[1] "C'

[1]  D"

[1] "E'

D.  

No output.

31: Which of the following functions is used for variable conversions?

A.   as.array

B.   ls.data.frame

C.   class(x)

D.   whichmax(x)

32:

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)

A.  

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

B.  

The column

C.  

The data stored in a data frame is not of character type.

D.  

 The row names are not unique.

33:

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?


A.  

It creates the vector data for the bar chart.

B.  

It gives a name to the chart f‌ile.

C.  

It plots the bar chart.

D.  

It saves the chart as per the mentioned f‌ile name.

34: Which of the following statements is/are correct?

A.   print(rootnode[[1]]11]]) will get the f‌irst element of the second node

B.   printfrootnodef‌limm) will get the f‌irst element of the f‌irst node.

C.   xmlToDataFrarnefinputxml

D.   xmlSize(rootnode) will f‌ind the number of child nodes under the root node.

35:

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)

}

A.  

 foo.functlon()

B.  

 foo.functlon(8,6,4)

C.  

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

D.  

 foo.function(1;1,1,1)

36:

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

]

A.  

No output.

B.  

[1] 'Testlng’”while statement’

[1] "Testing‘'while statement'

[1] “Testing“while statement‘

[1] "Testing"‘while statement'

[1] "Testing”while statement‘ 

C.  

[1] 'Testing"'while statement'

[1] "Testing-while statement‘

[1] "Testing‘"‘while statement‘

D.  

Error in code executlon

37:

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

}

]


A.  

[1]"Testing""loop"

[1] "Testing""loop"

[1] "Testing""loop"

[1] "Testing""loop"

B.  

[1] "Testing""loop"

[1] "Testing""loop"

[1] "Testing""loop"

C.  

[1]"Testing""loop"

[1] "Testing"“loop"

D.   No output.

38:

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

A.  

Levels: black blue metallic red white

[1]5  


B.  

 [1] black red blue blue White metallic red

Levels: black blue metallic red white

[1] 5   


C.  

 [l] 5

D.  

[1] black red blue blue white metallic red

Levels: black blue metallic red white


39:

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?

A.  

x, which is the input vector.

B.  

trlm, which Is used to drop values from both ends of the sorted vector.

C.  

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

40:

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?

A.  

dnorm(x.mean. sd) 

B.  

 pnorm(x.mean. sd)  

C.  

qnorm(p.mean. sd)  

D.  

rnorm(n. mean, sd)

41:

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?

A.  


B.  

trim

C.  

na.rm

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

A.   grep(pattern.x)

B.   match(x,table)

C.   merge(a,b)

D.   choose(n, k)

43:

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?

A.  

dnorm(x, mean, sd)  

B.  

pnorm(x, mean, sd)

C.  

qnorm(p, mean, sd)

D.  

rnorm(n, mean, sd)

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

A.   123L

B.   1 1 123

C.   999L

D.   2 999

45:

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?

A.  

data <- readodsxrdataxlsx', sheetlndex =1)

B.  

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

C.  

data <- read.xlsxt(data.xlsx'. sheetlndex = 3)


D.  

data <- read.xlsx('data.xlsx', sheetlndex = 0)

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

A.   will load specif‌ied data sets.

B.   will load add-on packages

C.   will load the datasets written with save.

D.   will start the HTML version of help.

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

A.   formula, which is a symbol. presenting the relation between x and y.

B.   data. which is the vector on which the formula will be applied.

C.   object, which is the formula that is already created using the lm0 function.

D.   newdata, which is the vector containing the new value for the predictor variable.

48:

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)

}

A.  

[1]1

[1]8

[1]27

[1]64 


B.  

 [1]3

[1]6

[1]9

[1]12   


C.  

[1]0.3333333

[1] 0.6666667

[1]1

[1]1.333333   


D.  

No output.  

49:

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

foo <- 'red'

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

A.   red

B.  

apple 

C.  

chilli

D.  

Exception 

50:

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

tempString <- "Hello.World!"

print (tempString)

tempString

A.  

[1] "Hello,World!"

[1] "Hello,World!"

B.  

[1] "Hello.World!"

C.  

Compilation error

D.  

Empty output

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

A.   repeat

B.   while

C.   for

D.   break

E.   next

52: Which of the following control structures is used to execute an infinite loop?

A.   next

B.   for

C.   while

D.   repeat

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

A.   dir

B.   getwd

C.   user.dir

D.   getcwd

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

A.   install.packages('xlsx')

B.   any(grepl('xlsx'.installed.packages()))

C.   read.xlsx()

D.   library('xlsx')

55:

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

A.   Fred

B.   Mary

C.   3

D.   c(4, 7, 9)

56:

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

A.   Mary

B.   (4, 7, 9)

C.   7

D.   9

57:

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

A.   aggregate() function

B.   aggregated() function

C.   aggregates() function

D.   aggregateted() function

58:

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

A.   NULL

B.   1

C.   2

D.   None of the mentioned

59:

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

A.   a.as_vector()

B.   unlist(a)

C.   a.vector()

D.   vector(a)

60:

gzfile opens a connection to a file compressed with _____?

A.   url

B.   gzip

C.   bzfile

D.   gdata

61:

Melt is used to convert wide data to _____ data?

A.   long

B.   dcast

C.   variable

D.   infr

62:

Point out the correct statement.

A.   lapply() takes elements of the list and passes them as the first argument of the function you are applying

B.   You can use lapply() to evaluate a function multiple times each with a different argument

C.   Functions that you pass to lapply() may have other arguments

D.   None of the mentioned

63:

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

A.   [1] TRUE

B.   [1] FALSE

C.   [1] FALSE TRUE

D.   [1] FALSE FALSE

E.   [1] TRUE TRUE TRUE TRUE

F.   [1] FALSE FALSE FALSE FALSE

G.   [1] FALSE FALSE FALSE TRUE

64:

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

A.   x <- factor(c(0, 4, 3, 3, 4)) str(x)

B.   x1 = as.numeric(x) str(x1)

C.   a2 = as.numeric(as.character(a)) str(a2)

D.   a2 = as.numeric(as.factor(a)) str(a2)

65:

Point out the correct statement.

A.   split() takes elements of the list and passes them as the first argument of the function you are applying

B.   You can use tsplit() to evaluate a function single time each with a same argument

C.   Sequence of operations is sometimes referred to as “map-reduce”

D.   None of the mentioned

66:

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

A.   plot()

B.   lm()

C.   xyplot()

D.   All of the mentioned

67:

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

A.   [1] 2 3 4 5 6 7 8 9 10

B.   [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

C.   [1] 2 4 6 8 10 12 14 16 18 20

D.   [1] 2 4 6 8 10

E.   [1] 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10

68:

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

A.   describe(df)

B.   str(df)

C.   df.structure()

D.   summary(df)

69:

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

A.   function()

B.   funct()

C.   functions()

D.   All of the mentioned

70:

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

A.   copy()

B.   multiscale()

C.   bind()

D.   traceback()

71:

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

A.   [1] 1 2 3 4 5 6 7 8 9

B.   [1] 0 1 2 3 4 5 6 7 8 9

C.   [1] 1 2 3 4 5 6 7 8 9 10

D.   [1] 0 1 2 3 4 5 6 7 8 9 10

E.   [1] -1 0 1 2 3 4 5 6 7 8

72:

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

A.   [1] 2

B.   [1] 5

C.   [1] 2 5

D.   [1] 4 5

E.   [1] 1 5

73:

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

A.   [1] TRUE

B.   [1] FALSE

C.   [1] FALSE FALSE FALSE

D.   [1] FALSE TRUE TRUE

E.   [1] TRUE FALSE FALSE

74:

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

A.   [1] [[1]] "1"

B.   [1] 1 1

C.   [1] 1 "1"

D.   [[1]] [1] 1 [[2]] [1] "1"

E.   [[1]] [1] 1 [[2]] [1] 1

F.   [,1] [,2] [1,] 1 1

G.   [,1] [,2] [1,] 1 "1"

75:

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?

A.   hourlyRate/length(country)

B.   mean(hourlyRate)/length(country)

C.   tapply(mean, hourlyRate, country)

D.   tapply(hourlyRate, country, mean)

E.   mean(hourlyRate/length(country))

76:

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

A.   c d a 1 3 b 2 4

B.   c d a 1 2 b 2 3

C.   c d a 1 3 b 4 2

D.   All of the mentioned

77:

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

A.   uniCox, graphics

B.   ggplot2, graphics

C.   uniPlot, ggplot2

D.   graphics, uniPlot

78:

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

A.   Same

B.   Different

C.   does not matter

D.   None

79:

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

A.   4

B.   16

C.   25

D.   36

E.   49

F.   98

G.   140

80:

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

A.   [1] 1

B.   [1] 2

C.   [1] 4

D.   [,1] [,2] [1,] 1 2 [2,] 2 1

E.   [,1] [,2] [1,] 1 2 [2,] 2 4

F.   [,1] [,2] [1,] 1 4 [2,] 4 1

81:

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

A.   message

B.   execution

C.   warning

D.   fatal

82:

Point out the correct statement.

A.   The elements of a logical vector cannot have the values TRUE, FALSE, and NA

B.   Matrices are vectors with a dimension attribute

C.   Numerical vectors are generated by conditions

D.  

All of the mentioned

83:

Which of the following is lattice command for producing boxplots ?

A.   plot()

B.   bwplot()

C.   xyplot()

D.   All of the mentioned

84:

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]

A.   [1] 0

B.   [1] 1

C.   [1] 2

D.   [1] 3

E.   [1] 4

F.   [1] 5

G.   [1] 6

H.   [1] 7

85:

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

A.   t(m)

B.   transpose(m)

C.   m.t()

D.   m.transpose()

86:

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]

A.   [1] 0 1 2 3

B.   [1] 0 1 3 2

C.   [1] 0 4 2 6

D.   [1] 0 2 4 6

E.   [1] 1 5 7 3

F.   [1] 7 5 3 1

87:

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

A.   matr()

B.   mat()

C.   matrix()

D.   matrix

88:

How can you create scatterplot matrices?

A.   pairs()

B.   splom()

C.   plot()

D.   Both 1 and 2

89:

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]

A.   [1] 0 3

B.   [1] 4 3

C.   [1] 1 3

D.   [1] 1 7

E.   [1] 3 4

F.   [1] 4 4

G.   [1] 6 5

90:

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

A.   [1] 1

B.   [,1] [1,] 1

C.   [,1] [,2] [1,] 0 1 [2,] 1 0

D.   [,1] [,2] [1,] 1 0 [2,] 0 1

E.   [1] 2

F.   [1] 10

G.   [,1] [,2] [1,] 0 0 [2,] 0 0

H.   [,1] [,2] [1,] 1 1 [2,] 1 1

91:

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

A.   [,1] [,2] [1,] 0 4 [2,] 2 6

B.   [,1] [,2] [1,] 1 5 [2,] 3 7

C.   [,1] [,2] [1,] 0 4 [2,] 1 5

D.   [,1] [,2] [1,] 0 2 [2,] 1 3

E.   [,1] [,2] [1,] 2 6 [2,] 3 7

F.   [,1] [,2] [1,] 4 6 [2,] 5 7

92:

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

A.   factor(v)

B.   create_factor(v)

C.   v.factor()

D.   v.create_factor()

93:

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

A.   histo()

B.   lm

C.   barlm()

D.   All of the mentioned

94:

What is the difference between matrix and dataframe?

A.   Dataframe can contain only similar type of data but matrix can contain different types of data.

B.   Dataframe can contain different types of data but matrix can contain only similar type of data.

C.   Dataframe and matrix are the same.

D.   None of the mentioned.

95:

R is easily extensible through functions and ____?

A.   Extensions

B.   Classes

C.   Methods

D.   Librarys

96:

How do you create log linear models in R language?

A.   loglm () function

B.   trace() function

C.   print() function

D.   logim() function

97:

What is the factor variable in R language?

A.   Factor variables are categorical variables that hold either string or numeric values

B.   Factor variables are used in various types of graphics and particularly for statistical modelling

C.   Both 1 and 2

D.   Factor variables are used in data types and classes

98:

Which statement makes a mosaic plot ?

A.   histogram()

B.   mosaicplot()

C.   bar()

D.   All of the mentioned

99:

What are the row names of the data frame?

A.   names(dataset)

B.   colnames(dataset)

C.   row.names(dataset)

D.   rownames(dataset)

100:

How can you merge two data frames in R?

A.   using cbind () functions

B.   using the merge () function on common rows or columns

C.   Using combine() function

D.   Both 1 and 2