Page 248 - Data Science class 11
P. 248

18.  Which of the following is an example  of a vectorized operation as far as subtraction is concerned?
               > x <- 1:4
               > y <- 6:9

              a.  x+y                                            b.  x-y
              c.  x/y                                            d.  x*y

           19.  What would be the output of the following code?
               > x <- 1:4
               > y <- 6:9
               > z <- x + y
               > z
              a.  7 9 11 13                                      b.  7 9 11 13 14

              c.  9 11 13                                        d.  Null

           20.  What would be the output of the following code?
               > x <- 1:4
               > x > 2
              a.  FALSE FALSE TRUE TRUE                          b.  1 2 3 4

              c.  1 2 3 4 5                                      d.  None of these
           21.  What would be the value of the following expression?
               log(-1)

              a.  Warning in log(-1): NaNs produced              b.  1
              c.  Null                                           d.  1/10
           22.  What will be the output of the following code?

               > g <- function(x) {
               + a <- 3
               + x+a+y
               + ## ‘y’ is a free variable
               + }

               > g(2)
              a.  8                                              b.  9
              c.  42                                             d.  Error

        B.  Fill in the blanks.

            1.  A ________________ data type is the most common type in R, and contains any number with or without a decimal.
            2.  ________________ vectors are sometimes called recursive vectors because they can contain other lists.
            3.  When a person writes more than one value in R, it is called a ________________ vector.

            4.  The return type is determined by the highest type of the components in the hierarchy expression: > list > ________________
              > ________________ > double > integer > logical > raw > NULL.
            5.  A ________________ is a table or a two-dimensional array-like structure in which each column contains values of one
              variable and each row contains one set of values from each column.


          246   Touchpad Data Science-XI
   243   244   245   246   247   248   249   250   251   252   253