matrices/questions.rst
changeset 287 d9507624eb8f
parent 261 c7f0069d698a
child 397 4aea9ed09983
equal deleted inserted replaced
286:44f06ae0d957 287:d9507624eb8f
     1 Objective Questions
     1 Objective Questions
     2 -------------------
     2 -------------------
     3 
     3 
     4 .. A mininum of 8 questions here (along with answers)
     4 .. A mininum of 8 questions here (along with answers)
     5 
     5 
       
     6 1. ``matrix(A) * matrix(B)`` and ``array(A) * array(B)`` are the same.
       
     7 
       
     8     a. True
       
     9     #. False
       
    10 
       
    11 Answer: False
       
    12 
       
    13 2. ``matrix(A) * array(B)`` does,
       
    14 
       
    15    a. Element wise multiplication.
       
    16    #. Matrix multiplication.
       
    17    #. Cannot multiply a matrix object and array object.
       
    18    #. Depends on the shape of A and B, if compatible matrix
       
    19       multiplication will be done, otherwise element wise
       
    20       multiplication.
       
    21 
       
    22 Answer: Matrix multiplication
       
    23 
       
    24 3. A and B are two matrix objects. Element wise multiplication in
       
    25    matrices are done by,
       
    26 
       
    27    a. A * B
       
    28    #. ``multiply(A, B)``
       
    29    #. ``dot(A, B)``
       
    30    #. ``element_multiply(A,B)``
       
    31 
       
    32 Answer: multiply(A, B)
       
    33 
       
    34 4. ``norm(A)`` method determines the,
       
    35 
       
    36    a. Frobenius norm
       
    37    #. Infinity norm
       
    38    #. Induced norm
       
    39    #. Schatten norm
       
    40 
       
    41 Answer: Frobenius norm
       
    42 
       
    43 5. ``eig(A)[1]`` and ``eigvals(A)`` are the same.
       
    44 
       
    45    a. True
       
    46    #. False
       
    47 
       
    48 Answer: False
       
    49 
       
    50 6. The code snippet will work without an error,
       
    51    ::
       
    52 
       
    53        A = matrix([[1, 2, 3, 4], [5, 6, 7, 8]])
       
    54        inv(A)
       
    55 
       
    56    a. True
       
    57    #. False
       
    58 
       
    59 Answer: False
       
    60 
       
    61 7. What is the output of the following code,
       
    62    ::
       
    63 
       
    64       x = matrix([[1, 2, 3], ['a', 2, 'c']])
       
    65       identity(x.shape)
       
    66 
       
    67    a. Will create an identity matrix of shape (2, 3).
       
    68    #. ``identity()`` function takes an integer as argument and a tuple
       
    69       is passed.
       
    70    #. Will return, matrix([[1,0,1],[0,1,0]])
       
    71    #. Will return, matrix([[0,1,0],[0,1,0]])
       
    72 
       
    73 Answer: ``identity()`` function takes an integer as argument and a
       
    74       	tuple is passed.
       
    75 
       
    76 8. ``norm(A,ord='fro')`` is the same as ``norm(A)``
       
    77 
       
    78    a. True
       
    79    #. False
       
    80 
       
    81 Answer: True
     6 
    82 
     7 Larger Questions
    83 Larger Questions
     8 ----------------
    84 ----------------
     9 
    85 
    10 .. A minimum of 2 questions here (along with answers)
    86 .. A minimum of 2 questions here (along with answers)
    28    [11, 11, 11, 11, 11, 17, 18, 19, 20, 21].
   104    [11, 11, 11, 11, 11, 17, 18, 19, 20, 21].
    29 
   105 
    30    What will be the array after 22 such operations starting with [1,
   106    What will be the array after 22 such operations starting with [1,
    31    2, 3, 4, 5, 6, 7, 8, 9, 10]
   107    2, 3, 4, 5, 6, 7, 8, 9, 10]
    32 
   108 
       
   109 2. Find the infinity norm and the determinant of the inverse of the
       
   110    product of matrices A and B. 
       
   111    ::
       
   112 
       
   113       A = [[ 1,  2,  3,  4],     B = [[16, 15, 14, 13],
       
   114       	   [ 5,  6,  7,  8],          [12, 11, 10,  9],
       
   115 	   [ 9, 10, 11, 12],          [ 8,  7,  6,  5],
       
   116 	   [13, 14, 15, 16]]          [ 4,  3,  2,  1]]