Sail E0 Webinar

MCQs

Total Questions : 10
Question 1. Point out the correct statement :
  1.    Empty vectors can be created with the vector() function
  2.    A sequence is represented as a vector but can contain objects of different classes
  3.    raw" objects are commonly used directly in data analysis
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> Empty vectors can be created with the vector() function


A vector can only contain objects of the same class


Question 2. Which of the following statement changes column name to h and f ?
  1.    colnames(m)
  2.    columnnames(m)
  3.    rownames(m)
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> colnames(m)


Column names and row names can be set separately using the colnames() and rownames() functions.


Question 3. Point out the wrong statement :
  1.    matrices or more generally arrays are multi-dimensional generalizations of vectors
  2.    factors provide compact ways to handle categorical data
  3.    vectors provide a convenient way to return the results of a statistical computation
  4.    All of the mentioned
 Discuss Question
Answer: Option C. -> vectors provide a convenient way to return the results of a statistical computation


The dimension attribute is itself an integer vector of length 2 (number of rows, number of columns).


Question 4. Data frames can be converted to a matrix by calling data._______
  1.    matr()
  2.    mat()
  3.    matrix()
  4.    All of the mentioned
 Discuss Question
Answer: Option C. -> matrix()


as.matrix() function should be used to coerce a data frame to a matrix.


Question 5. Point out the correct statement :
  1.    The value NaN represents undefined value
  2.    Number Inf represents infinity in R
  3.    NaN can also be thought of as a missing value
  4.    None
 Discuss Question
Answer: Option B. -> Number Inf represents infinity in R


This allows us to represent entities like 1 / 0.


Question 6. What would be the output of the following code ?x - vector("list", length = 5)x
  1.    NULL
  2.    1
  3.    0
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> NULL


We can also create an empty list of a pre-specified length with the vector() function.


Question 7. What would be the output of the following code ?m - matrix(nrow = 2, ncol = 3)dim(m)
  1.    3 2
  2.    2 3
  3.    2 2
  4.    None of the mentioned
 Discuss Question
Answer: Option B. -> 2 3


Matrices are constructed column-wise.


Question 8. Point out the correct statement :
  1.    The usual operator, -, can be thought of as a syntactic short-cut to expression operation
  2.    Assignment can also be made using the function assignment()
  3.    Vectors can be used in arithmetic expressions, in which case the operations are performed element by element
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> Vectors can be used in arithmetic expressions, in which case the operations are performed element by element


Vectors occurring in the same expression need not all be of the same length.


Question 9. What would be the output of the following code ?sqrt(-17)
  1.    -4.02
  2.    4.02
  3.    NaN
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> NaN


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


Question 10. What would the following code print ?x - c("a", "b", "c")as.logical(x)
  1.    a b c
  2.    NA NA NA
  3.    0 1 2
  4.    All of the mentioned
 Discuss Question
Answer: Option B. -> NA NA NA


When nonsensical coercion takes place, you will usually get a warning from R.


Latest Videos

Latest Test Papers