250+ TOP MCQs on Data Wrangling and Answers

Basic R Programming Interview questions and answers focuses on “Data Wrangling”.

1. __________ is used when you have variables that form rows instead of columns.
a) tidy()
b) spread()
c) separate()
d) gather()

Answer: b
Clarification: You need spread() less frequently than gather() or separate().

2. Point out the correct statement?
a) tidyr and dplyr packages do not make use of the pipe operator
b) tidyr does less than reshape2
c) tidyr provides ability to string multiple functions together by incorporating %
d) tidyr does greater than reshape2

Answer: b
Clarification: Just as reshape2 did less than reshape, tidyr does less than reshape2.

3. Which of the following merges two variables into one?
a) spread()
b) gather()
c) separate()
d) unite()

Answer: b
Clarification: The unite() function is a convenience function to paste together multiple variable values into one.

4. How many functions exist for wrangling the data with dplyr package?
a) one
b) seven
c) three
d) five

Answer: b
Clarification: dplyr provides seven main functions for tidying your messy data.

5. Point out the correct statement?
a) gather() makes “long” data wider
b) tidyr is a reframing of reshape designed to accompany the tidy data framework
c) there are two fundamental verbs of data tidying
d) tidyr and dplyr packages do not make use of the pipe operator

Answer: c
Clarification: In particular, built-in methods only work for data frames, and tidyr provides no margins or aggregation.

6. ________ add new variables/columns or transform existing variables.
a) mutate
b) add
c) apped
d) arrange

Answer: a
Clarification: arrange is used to reorder rows of a data frame.

7. _________ extract a subset of rows from a data frame based on logical conditions.
a) rename
b) filter
c) set
d) subset

Answer: a
Clarification: rename is used to rename variables in a data frame.

8. Spread function is known as ___________ in spreadsheets.
a) pivot
b) unpivot
c) cast
d) order

Answer: b
Clarification: Spread is known by other names in other places: it’s cast in reshape2, unpivot in spreadsheets and unfold in databases.

Leave a Reply

Your email address will not be published. Required fields are marked *