R Matrices: Multiple Choice

Nov 4, 2013 • Robert Flight

Novice vs Competent

Given the matrix M:

[,1] [,2]
[1,]    6    3
[2,]    5    2
[3,]    4    1

What is the output of dim(M[1,])?

(a) NULL

(b) 3   2

(c) 1   2

(d) 3   1

 

Competent vs Expert

Given the matrix M:

[,1] [,2]
[1,]    6    3
[2,]    5    2
[3,]    4    1

What index returns rows 2 and 3?

(a) c(2,3)
(b) c(-1)
(c) c(1,3)
(d) c(2:3)