Knowledge Quiz: Basic Commands

Note
  • Click the check-mark button to check your answer.
  • Click the question-mark button to see an explanation of the solution.

Which of the following commands represents the recommended way to assign the value 7 to the object y?

Although there are three valid assignment operators: <-, ->, =, only the left-facing arrow is recommended by most style guides.

  • This is a misuse of the native R pipe operator.
  • This is a logical comparison. We’re checking if the value of y is equal to the 7.
  • This command adds the value of y to the value of 7 and prints the result.
  • Correct
  • This is a logical comparison. We’re checking if the value of y is less than 7.

What value will the following R code produce?

(2 * 3 + 4) / 2

By applying the appropriate order of operations, we get 5.

Which of the following expressions will return TRUE?

  • TRUE: “alice” is not equal to “bob”, but “alice is equal to”alice”
  • TRUE: 6 is not strictly greater than 7, and that result is negated
  • FALSE: Trivially
  • FALSE: “alice” is not equal to “bob”, and “alice” is equal to “alice”
  • TRUE: 14 is strictly less than 48
  • FALSE: Trivial negation
Back to top