## R Programming Questions and Answers Part-8

1. R has how many atomic classes of objects?
a) 1
b) 2
c) 3
d) 5

Explanation: The most basic type of R object is a vector.

2. 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

Explanation: A vector can only contain objects of the same class.

3. Numbers in R are generally treated as _______ precision real numbers.
a) single
b) double
c) real
d) imaginary

Explanation: This means that even if you see a number like “1” or “2” in R, which you might think of as integers, they are likely represented behind the scenes as numeric objects something like “1.00” or “2.00”.

4. If you explicitly want an integer, you need to specify the _____ suffix.
a) D
b) R
c) L
d) K

Explanation: Entering 1 in R gives you a numeric object; entering 1L explicitly gives you an integer object.

5. Point out the correct statement?
a) The value NaN represents undefined value
b) Number Inf represents infinity in R
c) NaN can also be thought of as a missing value
d) “raw” objects are commonly used directly in data analysis

Explanation: This allows us to represent entities like 1 / 0.

6. Attributes of an object (if any) can be accessed using the ______ function.
a) objects()
b) attrib()
c) attributes()
d) obj()

Explanation: Not all R objects contain attributes, in which case the attributes() function returns NULL.

7. R objects can have attributes, which are like ________ for the object.
b) features
c) expression
d) dimensions

Explanation: These metadata can be very useful in that they help to describe the object.

8. Which of the following can be considered as object attribute?
a) dimensions
b) class
c) length
d) all of the mentioned

Explanation: All objects in R have an Attribute list.

9. What will be the output of the following R code?
> x <- vector("numeric", length = 10)
> x
a) 10
b) 0 0 0 0 0 0 0 0 0 0
c) 01
d) 00120