R Programming Language Multiple Choice Questions on “Data Types”.
1. Accessing elements is achieved through a process called ________
a) Indexing
b) Outdexing
c) Highlighting
d) Scrapping
Answer: a
Clarification: 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
Answer: b
Clarification: 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
Answer: a
Clarification: To access elements with a value greater than five we can use some subsetting commands and logical operators to produce the desired result.
4. Lists can be created using the _______ function.
a) Matrix.li
b) Matrix.lists
c) Lists.matric
d) List
Answer: d
Clarification: 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
Answer: a
Clarification: 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.
6. How can we access the first component of the list?
a) Number of the position
b) Function
c) Package
d) Tools
Answer: a
Clarification: 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
Answer: b
Clarification: 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 ($).
8. To extract a sublist, we use _________ brackets.
a) Flower
b) Square
c) Double
d) Single
Answer: d
Clarification: 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
Answer: b
Clarification: 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.
10. Which function can be used to determine the names assigned to a list?
a) Names
b) Name
c) Nam
d) Nem
Answer: a
Clarification: 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
Answer: a
Clarification: 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
Answer: a
Clarification: 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
Answer: b
Clarification: 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
Answer: b
Clarification: 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
Answer: a
Clarification: 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.