# MCQs R Language

This quiz will help you to check your ability to execute some basic operations on objects in R language, and it will also help you to understand some basic concepts. This quiz may also improve you computational understanding.

Question 1: The R language is a dialect of which of the following programming languages?

A) S
B) C
C) Lisp
D) Matlab and Mathematica
E) SAS

Question 2: The definition of free software consists of four freedoms (freedoms 0 through 3). Which of the following is NOT one of the freedoms that are part of the definition?

A) The freedom to study how the program works, and adapt it to your needs.
B) The freedom to improve the program, and release your improvements to the public, so that the whole community benefits.
C) The freedom to run the program, for any purpose.
D) The freedom to sell the software for any price.

Question 3: In R language the following are all atomic data types EXCEPT
A) integer
B) logical
C) data frame
D) character

Question 4: If I execute the expression x <- 4 in R language, what is the class of the object x’ as determined by the class()’ function?
A) Numeric
B) Integer
C) Real
D) Complex

Question 5: What is the class of the object defined by the expression x <- c(4, “a”, TRUE)?
A) Numeric
B) Character
C) Integer
D) Logical

Question 6: If I have two vectors x <- c(1,3, 5) and y <- c(3, 2, 10), what is produced by the expression rbind(x, y)?
A) A vector of length 2
B) a 2 by 2 matrix
C) a vector of length 3
D) a 2 by 3 matrix

Question 7: A key property of vectors in R language is that
A) a vector cannot have have attributes like dimensions
B) elements of a vector can be of different classes
C) elements of a vector can only be character or numeric
D) elements of a vector all must be of the same class

Question 8: Suppose I have a list defined as x <- list(2, “a”, “b”, TRUE). What does x[[2]] give me?
A) a list containing a character vector with the elements “a” and “b”.
B) a character vector of length 1.
C) a character vector with the elements “a” and “b”.
D) a list containing the number 2 and the letter “a”.

Question 9: Suppose I have a vector x <- 1:4 and y <- 2:3. What is produced by the expression x + y?
A) a numeric vector with the values 3, 5, 3, 4.
B) an integer vector with the values 3, 5, 5, 7.
C) a numeric vector with the values 1, 2, 5, 7.
D) an error.

Question 10: Suppose I have a vector x <- c(3, 5, 1, 10, 12, 6) and I want to set all elements of this vector that are less than 6 to be equal to zero. What R code achieves this?
A) x[x < 6] == 0
B) x[x == 6] <- 0
C) x[x < 6] <- 0
D) x[x == 0]

Question 11: ______ is function in R to get number of observation in a data frame
A) n()
B) ncols()
C) nobs()
D) nrow()

Question 12: what function is used to test the missing observation in data frame
A) missing()
B) NA.miss()
C) na()
D) is.na()

For MCQs Statistics ANSWERS, either download the pdf file or enjoy the online MCQs Statistics Test about R-Language.

## R Language Quiz

This quiz will help you to check your ability to execute some basic operations on objects in R language, and it will also help you to understand some basic concepts. This quiz may also improve you computational understanding.
Congratulations - you have completed R Language Quiz. You scored %%SCORE%% out of %%TOTAL%%. Your performance has been rated as %%RATING%%   Go to MCQs Statistics main page http://itfeature.com/statistics-mcqs

#### The Author

Student and Instructor of Statistics and business mathematics. Currently Ph.D. Scholar (Statistics), Bahauddin Zakariya University Multan. Like Applied Statistics and Mathematics and Statistical Computing. Statistical and Mathematical software used are: SAS, STATA, GRETL, EVIEWS, R, SPSS, VBA in MS-Excel. Like to use type-setting LaTeX for composing Articles, thesis etc.