1/35
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
According to the presentation, what is the fundamental definition of an array?
A. A 2-dimensional structure with rows and columns.
B. A list of elements such that they all have the same data type.
C. A list of elements that can be of different data types.
D. A 1-dimensional list of numbers.
B. A list of elements such that they all have the same data type.
An array is characterized by homogeneity of its elements' data types.
A 1-dimensional array with 'n' elements is known as what?
A. An n x n matrix
B. An n-dimensional vector
C. An array list
D. A scalar
B. An n-dimensional vector
This is the correct term for a 1-dimensional array containing 'n' elements, as defined in the presentation.
A. An n x n matrix
Not quite
An n x n matrix is a 2-dimensional array with 'n' rows and 'n' columns.
What function in R is used to combine a list of items into a vector?
A. c()
B. vector()
C. list()
D. matrix()
A. c()
The c()
function, which stands for combine, is the correct function in R to create a vector from a list of items.
What will be the output of the R code v2 <- 1:4
?
A. A 2x2 matrix with elements 1, 2, 3, 4.
B. A vector containing the numbers 1 and 4.
C. A vector containing four 1s.
D. A vector containing the numbers 1, 2, 3, 4.
D. A vector containing the numbers 1, 2, 3, 4.
The expression 1:4
generates a sequence of all integers from 1 to 4, inclusive.
An m×n matrix is a 2-dimensional array with how many rows and columns?
A. m+n rows and m*n columns
B. It depends on the data type.
C. n rows and m columns
D. m rows and n columns
D. m rows and n columns
This is the correct convention. An m×n matrix has 'm' rows and 'n' columns.
What does the byrow = TRUE
argument do in the matrix()
function in R?
A. It fills the matrix by rows.
B. It transposes the resulting matrix.
C. It fills the matrix by columns.
D. It sorts the rows of the matrix.
A. It fills the matrix by rows.
This argument tells R to populate the matrix using the provided elements row by row, instead of the default column-wise filling.
A matrix where all elements are zero is called a:
A. Scalar Matrix
B. Identity Matrix
C. Zero or Null Matrix
D. Square Matrix
C. Zero or Null Matrix
This is the correct term for a matrix where every entry is 0.
What is the defining characteristic of a square matrix?
A. The matrix is equal to its transpose.
B. All elements are equal to 1.
C. All elements outside the main diagonal are zero.
D. It has the same number of rows and columns.
D. It has the same number of rows and columns.
This is the definition of a square matrix. If it's an m×n matrix, then m=n.
Which R code correctly creates a 3×3 identity matrix?
A. matrix(diag(1,3), nrow=3)
B. diag(c(1,1,1))
C. matrix(1, nrow=3, ncol=3)
D. diag(3)
D. diag(3)
In R, diag(n)
where n is a single integer creates an n x n identity matrix. An alternative shown is diag(rep(1,3))
.
True or False: A diagonal matrix must have all non-zero elements on its principal diagonal.
False
A diagonal matrix is a square matrix where all off-diagonal elements are zero. The elements on the principal diagonal can be any value, including zero.
In a lower triangular matrix, which elements are all zero?
A. Elements above the principal diagonal.
B. Elements on the principal diagonal.
C. Elements below the principal diagonal.
D. All elements are zero.
A. Elements above the principal diagonal.
This is the correct definition of a lower triangular matrix.
What is the transpose of a matrix?
A. The matrix with all its elements negated.
B. The inverse of the matrix.
C. The matrix with its rows and columns swapped.
D. The matrix multiplied by itself.
C. The matrix with its rows and columns swapped.
This is the correct definition. The rows of the original matrix become the columns of the transposed matrix.
If matrix A is a 3×2 matrix, what will be the dimensions of its transpose, AT?
A. 2×2
B. 3×2
C. 2×3
D. 3×3
C. 2×3
The transpose of an m×n matrix is an n×m matrix. So, a 3×2 matrix becomes a 2×3 matrix.
What is the R command to find the transpose of a matrix A
?
A. A.transpose()
B. t(A)
C. A'
D. transpose(A)
B. t(A)
According to the properties of transpose, what is (AT)T equal to?
A. The Identity matrix
B. 2A
C. A2
D. A
D. A
Transposing a matrix twice returns it to its original form.
What is the condition for matrix addition or subtraction to be possible?
A. Both matrices must have the same dimensions.
B. Both matrices must be diagonal matrices.
C. Both matrices must be square.
D. The number of columns of the first matrix must equal the number of rows of the second.
A. Both matrices must have the same dimensions.
To add or subtract matrices, they must have the same number of rows and the same number of columns.
If you multiply a 3×4 matrix by a scalar value of 5, what are the dimensions of the resulting matrix?
A. 15×20
B. 1×1
C. 3×4
D. 3×20
C. 3×4
Scalar multiplication performs an element-wise multiplication and does not change the dimensions of the matrix.
The dot product of two vectors results in a:
A. Vector
B. Scalar
C. It's undefined
D. Matrix
B. Scalar
The dot product is defined as the sum of the products of the corresponding entries of two sequences of numbers, yielding a single scalar value.
What is the condition for the dot product of two vectors to be defined?
A. The vectors must be row vectors.
B. The vectors must have the same number of elements.
C. One vector must be a column vector and the other a row vector.
D. The vectors must be orthogonal.
B. The vectors must have the same number of elements.
This is the correct condition. The operation requires pairing up corresponding elements, so the vectors must be of equal length.
What is the dot product of v1=[1,2,3] and v2=[4,5,6]?
A. 5.33
B. 32
C. [4, 10, 18]
D. 21
B. 32
The dot product is calculated as (1∗4)+(2∗5)+(3∗6)=4+10+18=32.
Which R code correctly calculates the dot product of two vectors, a
and b
?
A. dot(a, b)
B. sum(a * b)
C. a * b
D. a %*% b
B. sum(a * b)
It first performs element-wise multiplication (a * b
) and then sums the elements of the resulting vector to get the scalar dot product.
D.a %*% b
Not quite
This operator is for matrix multiplication. While it can compute a dot product if the vectors are treated as matrices of appropriate dimensions, the more direct way is shown in the presentation.
For the matrix multiplication A×B to be defined, what condition must be met regarding their dimensions?
A. A and B must both be square matrices.
B. A and B must have the same number of rows.
C. The number of columns in A must equal the number of rows in B.
D. A and B must have the same dimensions.
C. The number of columns in A must equal the number of rows in B.
This is the fundamental rule for matrix multiplication. An m×n matrix can be multiplied by an n×p matrix.
If matrix A is 2×3 and matrix B is 3×4, what are the dimensions of the product matrix C=A×B?
A. The multiplication is not possible.
B. 4×2
C. 3×3
D. 2×4
D. 2×4
The product of an m×n matrix and an n×p matrix is an m×p matrix. Here, m=2 and p=4.
What is the R operator for matrix multiplication?
A. *
B. x
C. %*%
D. &
C. %*%
This is the correct and distinct operator in R used specifically for matrix multiplication.
A. *
Not quite
The *
operator performs element-wise multiplication, not standard matrix multiplication.
True or False: In general, for matrices A and B, A×B=B×A.
False
Matrix multiplication is not commutative. The order of matrices is crucial. A×B and B×A may have different dimensions or different values altogether.
A square matrix that is equal to its own transpose is called a:
A.Symmetric Matrix
B. Orthogonal Matrix
C. Diagonal Matrix
D. Identity Matrix
A. Symmetric Matrix
This is the definition of a symmetric matrix. A=AT.
What is the result of the R code rep(0, 5)
?
A. A scalar value 0.
B. A vector containing a single 0 and a single 5.
C. A vector containing five 0s: [0, 0, 0, 0, 0]
.
D. A 5×5 matrix of zeros.
C. A vector containing five 0s: [0, 0, 0, 0, 0]
.
The rep()
function replicates the first argument the number of times specified by the second argument.
Which of the following is NOT a property of matrix transpose listed in the presentation?
A. (AD)T=DTAT
B. (A+B)T=AT+BT
C. (AT)T=A
D. (A−B)T=BT−AT
D. (A−B)T=BT−AT
The property for subtraction is (A−B)T=AT−BT. The order is not reversed as it is in this option.
True or False: The principal diagonal of a matrix always goes from the upper right corner to the lower left corner.
False
The note in the presentation specifies that the principal diagonal goes from the upper left corner to the lower right corner.
True or False: A 1-dimensional n-array is also known as an n-dimensional vector.
True
The R code M <- matrix(1:6, nrow = 2, ncol = 3)
will create a matrix. What will be the first column of M
?
A. [1, 2, 3]
B. [1, 4]
C. [1, 3, 5]
D. [1, 2]
D. [1, 2]
Since nrow=2
and the matrix is filled column by column by default, the first two numbers (1 and 2) will form the first column.
Which special matrix is a diagonal matrix where all diagonal elements are 1?
A. Symmetric Matrix
B. Zero Matrix
C. Unit Matrix
D. Identity Matrix
D. Identity Matrix
True or False: Any square matrix can be a triangular matrix.
False
A triangular matrix is a specific type of square matrix where elements either above or below the principal diagonal are zero. A matrix with non-zero elements both above and below the diagonal is not triangular.
What does the R expression A - B
do, assuming A and B are matrices of the same dimension?
A. It returns a logical value indicating if A is smaller than B.
B. It calculates the matrix inverse of B and adds it to A.
C. It concatenates the two matrices.
D. It performs element-wise subtraction.
D. It performs element-wise subtraction.
This is the correct operation. R will subtract the element in B from the corresponding element in A.
The rows of an m×n matrix M can be considered as:
A. m row vectors of dimension 1×n.
B. m column vectors of dimension m×1.
C. n row vectors of dimension 1×m.
D. n row vectors of dimension n×1.
A. m row vectors of dimension 1×n.
This is correct. There are 'm' rows, and each row has 'n' elements, making it a 1×n vector.
What is the main difference noted between *
and %*%
in R for matrix operations?
A. *
is for matrices, %*%
is for vectors.
B. *
is for addition, %*%
is for multiplication.
C. There is no difference; they are interchangeable.
D. *
does element-wise multiplication, %*%
does matrix multiplication.
D. *
does element-wise multiplication, %*%
does matrix multiplication.