R Programming Questions and Answers – Data Types – 7

This set of R Programming Language Multiple Choice Questions & Answers (MCQs) focuses on “Data Types – 7”.

1. Accessing elements is achieved through a process called ________
a) Indexing
b) Outdexing
c) Highlighting
d) Scrapping
View Answer

Answer: a
Explanation: Accessing elements is achieved through a process called indexing. Indexing may be done by a vector of positive integers and negative integers to indicate inclusion.

2. Which are indexed by either row or column using a specific name or number?
a) Datasets
b) Data frames
c) Data
d) Functions
View Answer

Answer: b
Explanation: Data frames can be indexed by either row or column using a specific name (that corresponds to either the row or column) or a number.

3. What should we use to access elements with a value greater than five?
a) Subsetting commands
b) Use functions
c) Packages
d) Interfaces
View Answer

Answer: a
Explanation: To access elements with a value greater than five we can use some subsetting commands and logical operators to produce the desired result.
advertisement
advertisement

4. Lists can be created using the _______ function.
a) Matrix.li
b) Matrix.lists
c) Lists.matric
d) List
View Answer

Answer: d
Explanation: Lists can be created using the list function. Like data frames, they can incorporate a mixture of modes into the one list and each component can be of a different length or size.

5. First component of the list can be accessed by _____________
a) Name of the component
b) List name
c) Function
d) Package
View Answer

Answer: a
Explanation: There are a number of ways of accessing the first component of a list. We can either access it through the name of that component (if names are assigned) or by using a number corresponding to the position of the component.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. How can we access the first component of the list?
a) Number of the position
b) Function
c) Package
d) Tools
View Answer

Answer: a
Explanation: There are a number of ways of accessing the first component of a list. We can either access it through the name of that component (if names are assigned) or by using a number corresponding to the position the component.

7. The first component can be accessed using __________ operator.
a) Intraction
b) Extraction
c) AND
d) OR
View Answer

Answer: b
Explanation: There are a number of ways of accessing the first component of a list. We can either access it through the name of that component (if names are assigned) or by using a number corresponding to the position the component corresponds to. The former approach can be performed using subsetting ([[]]) or alternatively, by the extraction operator ($).
advertisement

8. To extract a sublist, we use _________ brackets.
a) Flower
b) Square
c) Double
d) Single
View Answer

Answer: d
Explanation: To extract a sublist, we use single brackets. There are a number of ways of accessing the first component of a list.

9. The length of a list is ______ to the number of components in that list.
a) Double
b) Equal
c) Triple
d) One fourth
View Answer

Answer: b
Explanation: The length of a list is equal to the number of components in that list. Lists can be created using the list function. Like data frames, they can incorporate a mixture of modes into the one list and each component can be of a different length or size.
advertisement

10. Which function can be used to determine the names assigned to a list?
a) Names
b) Name
c) Nam
d) Nem
View Answer

Answer: a
Explanation: To determine the names assigned to a list, the names function can be used. Lists can be created using the list function. Like data frames, they can incorporate a mixture of modes into the one list and each component can be of a different length or size.

11. Joining two lists can be achieved either using the _________ function.
a) Concat
b) Join
c) Reduce
d) Delete
View Answer

Answer: a
Explanation: Joining two lists can be achieved either using the concatenation function or the append function.

12. Which function gives the list as output?
a) Spline
b) Matrix
c) Vector
d) Alphabet
View Answer

Answer: a
Explanation: There are also many functions within R that produce a list as output. Examples of these functions include spline(), density() and locator().Joining two lists can be achieved either using the concatenation function or the append function.

13. Density function gives output as ________
a) Matrix
b) Lists
c) Vector
d) Number
View Answer

Answer: b
Explanation: There are also many functions within R that produce a list as output. Examples of these functions include spline(), density() and locator().

14. Locator function gives output as ___________
a) Matrix
b) Lists
c) Vector
d) Number
View Answer

Answer: b
Explanation: To extract a sublist, we use single brackets. There are a number of ways of accessing the first component of a list. There are also many functions within R that produce a list as output. Examples of these functions include spline(), density() and locator().

15. The _________ function returns a list of densities (y) corresponding to bin values (x).
a) Spline
b) Density
c) Lists
d) Locator
View Answer

Answer: a
Explanation: The spline function returns a list of densities (y) corresponding to bin values (x). These can be passed to the plot routine to produce a line graph of the density.

Sanfoundry Global Education & Learning Series – R Programming Language.

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

To practice all areas of R Programming Language, Here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

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.