• 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

View Answer

2. What will be output for the following code?

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

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

View Answer

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

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

View Answer

4. Data Frames are created using the?

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

View Answer

5. Which functions gives the count of levels?

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

View Answer

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

View Answer

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

View Answer

8. What will be output for the following code?

`> sqrt(-17)`

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

View Answer

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()

View Answer

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

View Answer

Discussion

* You must be logged in to add comment.