# R Language quiz questions

• 1.

Which of the following will reverse the order of values in x ?

1. rev(x)

2. max(x, na.rm=TRUE)

3. all(x)

4. x%in%y

• 2.

Which of the following produces the variance covariance matrix ?

1. sd(x, na.rm=TRUE)

3. fivenum(x, na.rm=TRUE)

4. var(x, na.rm=TRUE)

• 3.

Which of the following finds the maximum value in the vector x, exclude missing values

1. rm(x)

2. max(x, na.rm=TRUE)

3. all(x)

4. x%in%y

• 4.

Which of the following tests each element of x for membership in y ?

1. y%in%x

2. all(x)

3. any(x)

4. x%in%y

• 5.

Which of the following truncates real x to integers ?

1. as.numeric(x)

2. as.integer(x)

3. as.order(x)

4. All of the mentioned

• 6.

Which of the following is uniform distribution ?

1. dunif(x, min=0, max=1, log = FALSE)

2. punif(q, min=0, max=1, lower.tail = TRUE, log.p = FALSE)

3. qunif(p, min=0, max=1, lower.tail = TRUE, log.p = FALSE)

4. runif(n, min=0, max=1)

• 7.

which of the following statement gives cumulative sum ?

1. cumsum(x,na=rm=TRUE)

2. cumprod(x)

3. cummax(x)

4. cummin(x)

• 8.

Which of the following statement is normal distribution ?

1. dnorm(x, mean=0, sd=1, log = FALSE)

2. pnorm(q, mean=0, sd=1, lower.tail = TRUE, log.p = FALSE)

3. qnorm(p, mean=0, sd=1, lower.tail = TRUE, log.p = FALSE)

4. rnorm(n, mean=0, sd=1)

• 9.

Which of the following statement find cases with no missing values ?

1. complete <- subset(data.df,complete.cases(data.df)

2. complete <- sub(data.df,complete.cases(data.df)

3. complete <- subset(data.df,completeall.cases(data.df)

4. new <- old[n1:n2,n3:n4]

• 10.

Which of the following code drop the ith and jth column ?

1. new <- old[-n,]

2. new <- old[,-n]

3. new <- old[,-c(i,j)]

4. new <- subset(old,logical)

• 11.

Which of the following code will drop the nth column ?

1. new <- old[-n,]

2. new <- old[,-n]

3. new <- old[,-c(i,j)]

4. new <- subset(old,logical)

• 12.

___________ remove all the variables from the workspace

1. rm(x)

2. rm(list=ls())

3. ls()

4. attach(mat)

• 13.

_____ list the variables in the workspace

1. rm(x)

2. rm(list=ls())

3. ls()

4. attach(mat)

• 14.

Which of the following is Mac menu command ?

1. browse.workspace

2. browse.works

3. browser.workspace

4. a statistical transformation

• 15.

Which of the following sort a dataframe by the order of the elements in B

1. x[rev(order(x\$B)),]

2. x[ordersort(x\$B),]

3. x[order(x\$B),]

4. All of the mentioned

• 16.

Which of the following statement is another way to get a subset ?

1. subsetcon(dataset,logical)

2. data.df[data.df=logical]

3. sub(dataset,logical)

4. None of the mentioned

• 17.

which of the following statement chose those objects meeting a logical criterion ?

1. sub(dataset,logical)

2. subset(dataset,logical)

3. subsetcon(dataset,logical)

4. None of the mentioned

• 18.

Which of the following statement read a tab or space delimited file ?

• 19.

Which of the following statement can read csv files ?

4. None of the mentioned

• 20.

Which of the following code create a n item vector of random normal deviates ?

1. x1 <- c(snorm(n))

2. x1 <- c(pnorm(n))

3. x1 <- c(rnorm(n))

4. All of the mentioned