Multiple Choice Questions

Before completing the book’s Coder/Hacker chapter exercises, take this multiple-choice pre-test from the end of the chapter.

Next, visit the Coder and Hacker Chapter exercises page for more.

1: Which R data type is most appropriate for a categorical variable?

  1. Numeric
  2. Factor
  3. Integer
  4. Character

Ans: B

2: Which of the following opens the ggplot2 library?

  1. install.packages("ggplot2")
  2. library(package = "ggplot2")
  3. summary(object = ggplot2)
  4. open(x = ggplot2)

Ans: B

3: The block of text at the top of a code file that introduces the project is called

  1. library.
  2. summary.
  3. prolog.
  4. pane.

Ans: C

4: In a data frame containing information on the age and height of 100 people, the people are the _____________ and age and height are the _____________.

  1. observations, variables
  2. variables, observations
  3. data, factors
  4. factors, data

Ans: A

5: The results of running R code show in which pane?

  1. Source
  2. Environment
  3. History
  4. Console

Ans: D