(As it is suggested on the r-exercises website, for a better practice, you should write down your answers and check your answers with using r. It would be more useful in this way.)

1.1.2.1 Consider two vectors, x=c(4,6,5,7,10,9,4,15) & y=c(0,10,1,8,2,3,4,1). What is the value of: x*y?

x <- c(4,6,5,7,10,9,4,15) 
y <- c(0,10,1,8,2,3,4,1)
x*y
## [1]  0 60  5 56 20 27 16 15

So the statement multiplies the values with the same index.

1.1.2.2 Consider two vectors, a=c(1,2,4,5,6) and b=c(3,2,4,1,9). What is the value of: cbind(a,b)

a <- c(1,2,4,5,6)
b <- c(3,2,4,1,9)

## with cbind you can combine vectors by columns.

cbind(a,b)
##      a b
## [1,] 1 3
## [2,] 2 2
## [3,] 4 4
## [4,] 5 1
## [5,] 6 9

1.1.2.3 Consider two vectors, a=c(1,5,4,3,6) and b=c(3,5,2,1,9). What is the value of: a<=b

a <- c(1,5,4,3,6) 
b <- c(3,5,2,1,9)

a<= b
## [1]  TRUE  TRUE FALSE FALSE  TRUE
##This statement checks the values that have the same index and will return a logical output.

1.1.2.4 Consider two vectors a=c(10,2,4,15) and b=c(3,12,4,11). What is the value of: rbind(a,b)

a <- c(10,2,4,15) 
b <- c(3,12,4,11)
rbind(a,b)
##   [,1] [,2] [,3] [,4]
## a   10    2    4   15
## b    3   12    4   11
## with cbind you can combine vectors by columns. and with rbind you can combine the vectors by rows as you can guess.

1.1.2.5 If x=c(1:12).What is the value of: dim(x)? What is the value of: length(x)?

x <- c(1:12)

dim(x)
## NULL
length(x)
## [1] 12
## As it is described in 'help' for dim statement "for an array (and hence in particular, for a matrix) dim retrieves the dim attribute of the object. It is NULL or a vector of mode integer". So, the dim will return NULL and the length will return the number of the values in x.

1.1.2.6 If a=c(12:5). What is the value of: is.numeric(a)?

a <- c(12:5)
is.numeric(a)
## [1] TRUE
## the values of a will be 12,11,10,9,8,7,6,5. So this is a numeric vector.

1.1.2.7 Consider two vectors, x=c(12:4), y=c(0,1,2,0,1,2,0,1,2), What is the value of: which(!is.finite(x/y))?

x <- c(12:4) 
y <- c(0,1,2,0,1,2,0,1,2)

which(!is.finite(x/y))
## [1] 1 4 7
## this statement return the index of the numbers from vector y where we do not get a "finite" result at the end of x/y computation.

1.1.2.8 Consider two vectors, x=letters[1:10], y=letters[15:24]. What is the value of: x<y?

x <- letters[1:10]
y <- letters[15:24]

x<y
##  [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## We are generating 2 vectors which have letters inside. x < y statement is comparing the alphabet index of letters and the output would be a logical vector.

1.1.2.9 If x=c(‘blue’,‘red’,‘green’,‘yellow’). What is the value of: is.character(x)?

x <- c('blue','red','green','yellow')

is.character(x)
## [1] TRUE
## x is obviously character vector.

1.1.2.10 If x=c(‘blue’,10,‘green’,20). What is the value of: is.character(x)?

x <- c('blue',10,'green',20)

is.character(x)
## [1] TRUE
## Returns TRUE if there is any character object in the vector.