R Programming Questions and Answers – Data Types – 6

This set of R Programming Questions & Answers for Exams focuses on “Data Types – 6”.

1. The four most frequently used types of data objects in R are vectors, matrices, data frames and ________
a) Function
b) Lists
c) Packages
d) Interfaces
View Answer

Answer: b
Explanation: The four most frequently used types of data objects in R are vectors, matrices, data frames and lists. A list is a generalisation of a vector and represents a collection of data objects.

2. A __________ is a set of elements appearing in rows and columns where the elements are of the same mode whether they are logical, numeric (integer or double), complex or character.
a) Vector
b) Matrix
c) Lists
d) Data frames
View Answer

Answer: b
Explanation: A matrix is a set of elements appearing in rows and columns where the elements are of the same mode whether they are logical, numeric (integer or double), complex or character.

3. What is the simplest way of creating the vector?
a) C function
b) Create
c) Destroy
d) Invalid
View Answer

Answer: a
Explanation: The simplest way to create a vector is through the concatenation function, c. This function binds elements together, whether they are of character form, numeric or logical.
advertisement
advertisement

4. Which function replicates elements of vectors?
a) C
b) Rep
c) Crep
d) Grep
View Answer

Answer: b
Explanation: The rep function replicates elements of vectors. The seq function creates a regular sequence of values to form a vector. The four most frequently used types of data objects in R are vectors, matrices, data frames and lists.

5. The ________ function creates a regular sequence of values to form a vector.
a) sequel
b) Rep
c) seq
d) Grep
View Answer

Answer: c
Explanation: The rep function replicates elements of vectors. The seq function creates a regular sequence of values to form a vector. The four most frequently used types of data objects in R are vectors, matrices, data frames and lists.

6. Which function is used to enter in data at the terminal?
a) Scanned
b) Scnn
c) Scan
d) Sccn
View Answer

Answer: c
Explanation: The scan function is used to enter data at the terminal. This is useful for small datasets but tiresome for entering in large datasets.

7. Computation with vectors is achieved using an element-by-element operation for avoiding _________
a) Loops
b) Functions
c) Packages
d) Interfaces
View Answer

Answer: a
Explanation: Computation with vectors is achieved using an element-by-element operation. This is useful when writing code because it avoids ’for loops’.
advertisement

8. To bind a row onto an already existing matrix, the ______ function can be used.
a) Rbind
b) Sbnd
c) Gbind
d) Sbind
View Answer

Answer: a
Explanation: To bind a row onto an already existing matrix, the rbind function can be used. The scan function is used to enter data at the terminal.

9. Which of the following is a 3-dimensional dataset?
a) Eris
b) Iris
c) Toris
d) Iris
View Answer

Answer: b
Explanation: The iris dataset is a three dimensional dataset. One dimension is represented for each species: Setosa, Versicolor and Virginica.
advertisement

10. Which dimension corresponds to the explanatory variables collected for each species?
a) First
b) Second
c) Third
d) Fifth
View Answer

Answer: b
Explanation: The second dimension corresponds to the explanatory variables collected for each species. The third dimension corresponds to the species.

11. Using the ________ vector, we create a species factor and bind it to the columns of iris.df.
a) snames
b) rnames
c) jnames
d) fnames
View Answer

Answer: a
Explanation: Using the Snames vector, we create a species factor and bind it to the columns of iris.df. The iris dataset is a three dimensional dataset.

Sanfoundry Global Education & Learning Series – R Programming Language.

Here’s the list of Best Books in R Programming Language .

To practice all exam questions on R Programming, Here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.