R Programming Questions and Answers Part-12

1. 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

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.

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

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.

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

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.

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

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.

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

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.

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

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.

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

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.

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

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 ($).

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

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.

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

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.