Data Science Questions and Answers Part-16

1. Which of the following function is used for fixing character vectors?
a) tolower
b) toUPPER
c) toLOWER
d) all of the mentioned

Answer: a
Explanation: It translates character to lowercase.

2. Which of the following metacharacter is used to refer to any character?
a) %
b) @
c) .
d) All of the mentioned

Answer: c
Explanation: A dot in function name can mean any of the following: nothing at all; a separator between method and class in S3 method.

3. Point out the wrong statement.
a) Variables with character values should be made less descriptive
b) Variables with character values should usually be made into factor variable
c) Common variables are used to apply transforms
d) All of the mentioned

Answer: a
Explanation: Variables with character values should be made more descriptive.

4. Which of the following is used for specifying character class with metacharacter?
a) []
b) {}
c) /+
d) All of the mentioned

Answer: a
Explanation: You can list set of characters to accept a given point in the match.

5. Regular expressions can be thought of as a combination of literals and metacharacters.
a) True
b) False

Answer: a
Explanation: Regular expressions have rich set of metacharacters.

6. Which of the following signs are used to indicate repetition?
a) #
b) *
c) –
d) All of the mentioned

Answer: b
Explanation: * and + are metacharacters for repetition of data.

7. Which of the following function is used for searching text strings by means of regular expression?
a) grepd
b) grepl
c) gepexpr
d) all of the mentioned

Answer: b
Explanation: grep, grepl, regexpr, gregexpr and regexec search for matches to argument pattern within each element of a character vector.

8. merge function is used for merging data frames.
a) True
b) False

Answer: a
Explanation: To merge two data frames horizontally, use the merge function.

9. Point out the correct statement.
a) On Mac, the screen device is launched with quartz
b) On Windows, the screen device is launched with wind
c) On Unix, the screen device is launched with x12
d) All of the mentioned

Answer: a
Explanation: On Windows, the screen device is launched with window function.

10. Which of the following is an example of graphics device?
a) PDF
b) SVG
c) JPEG
d) All of the mentioned

Answer: d
Explanation: When the plot() function is invoked, R sends the data corresponding to the plot over, and the graphics device generates the plot.