FREE R Programming Language: Computer Science 114 Questions and Answers

0%

What R classes exist for scalar data types?

Correct! Wrong!

Which of the following best justifies changing an R string (or vector of strings) from lowercase to uppercase?

Correct! Wrong!

Explanation:
Converting R strings, or a vector of strings, to the upper case can be useful for several reasons, such as consistency, formatting, and comparison. However, one of the most appropriate reasons for converting a string to upper case is to aid in data validation.

The statements in the following program will be executed in the following order:
Line 1: print (''welcome'')
Line 2: printHello <- function() {
Line 3: print(''Hello'')
Line 4: }
Line 5: printHello()
Line 6: print(''done'')

Correct! Wrong!

Which of the following statements most accurately sums up R's operator?

Correct! Wrong!

Explanation:
The <- operator in R is used for assignment, meaning it assigns the value on the right-hand side to the variable on the left-hand side.

The starting index for R vectors is.

Correct! Wrong!

Explanation:
In R, vector indexing starts at 1, not 0. So the first element of a vector has index 1, the second element has index 2, and so on.

To repeat over a functional matrix?

Correct! Wrong!

Explanation:
One way to iterate over a matrix in R is to use a nested for-loop. A nested for-loop is a loop within a loop, where the outer loop iterates over the rows of the matrix and the inner loop iterates over the columns.

Which one of the following creates a string in R correctly?

Correct! Wrong!

Explanation:
The code user <- c("Jane", "Emily", "Shauna") creates a character vector in R, not a string.

Premium Tests $49/mo
FREE April-2024