• R MCQ Topics

• R Reference

• Other Reference

# R Programming MCQ Questions And Answers - Data Types

This section focuses on "Data Types" in R Programming. These Multiple Choice Questions (MCQ) should be practiced to improve the R Programming skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.

1. What will be output for the following code?

```v <- TRUE
print(class(v))```

A. logical
B. Numeric
C. Integer
D. Complex

2. What will be output for the following code?

```v <- ""TRUE""
print(class(v))```

A. logical
B. Numeric
C. Integer
D. Character

3. In R programming, the very basic data types are the R-objects called?

A. Lists
B. Matrices
C. Vectors
D. Arrays

4. Data Frames are created using the?

A. frame() function
B. data.frame() function
C. data() function
D. frame.data() function

5. Which functions gives the count of levels?

A. level
B. levels
C. nlevels
D. nlevel

6. Point out the correct statement?

A. Empty vectors can be created with the vector() function
B. A sequence is represented as a vector but can contain objects of different classes
C. "raw” objects are commonly used directly in data analysis
D. The value NaN represents undefined value

7. What will be the output of the following R code?

```> x <- vector(""numeric"", length = 10)
> x```

A. 1 0
B. 0 0 0 0 0 0 0 0 0 0
C. 0 1
D. 0 0 1 1 0 1 1 0

8. What will be output for the following code?

`> sqrt(-17)`

A. -4.02
B. 4.02
C. 3.67
D. NAN

9. _______ function returns a vector of the same size as x with the elements arranged in increasing order.

A. sort()
B. orderasc()
C. orderby()
D. sequence()

10. What will be the output of the following R code?

```> m <- matrix(nrow = 2, ncol = 3)
> dim(m)```

A. 3 3
B. 3 2
C. 2 3
D. 2 2