Sparse Matrices – 1 MCQ’s

Electronics & Communication Engineering MATLAB

This set of MATLAB Multiple Choice Questions & Answers (MCQs) focuses on “Sparse Matrices – 1″.

1. What is the output of the following code?

sparse[m n]

a) A m*n all zero sparse matrix
b) A m*n sparse matrix
c) Error due to syntax
d) Error in the input

2. The nature of complex input taken by the sparse() command is ______________
a) Only Imaginary part
b) Only positive imaginary part
c) Only negative real part
d) All of the mentioned

3. What is the attribute of sparse matrices?
a) sparse
b) double
c) vector
d) no attribute

4. To check whether the input matrix is sparse or not, we use the ________ command.
a) issparse
b) besparse
c) ifsparse
d) sparse

5. A sparse identity matrix is generated by the ______ command.
a) sparseid
b) isparse
c) speye
d) idensparse

6. Which of the following can be the space taken up by a sparse matrix?
a) .25 megabytes
b) 600 megabytes
c) .5 GB
d) 450 megabytes

7. What is the output of the following code?

A=[1 2 0 3; 2 8 4 1; sin(Inf) 2 3 4];
P=sparse(A); nnz(P)

a) 11
b) 10
c) Error while declaring A
d) Error while making sparse matrix

8. The non-zero elements in a sparse matrix are shown by the ______ command.
a) nzeros
b) nonzeros
c) notzeros
d) nozero

9. What is the command used to generate a sparse normally generated matrix?
a) sparserndn
b) sprandom
c) sprandn
d) no such command

10. What is the output of the following code?

A=[0 Inf/Inf 0 0; 2 9 7 0; sin(Inf) 8 0 0];
P=sparse(A);q=nmz(p); L=full(P);

a) l = a
b) lmemory > amemory
c) lmemory < amemory
d) lmemory != amemory

11. The maximum space allocated for sparse matrices is given by the ____ command.
a) maxsparse
b) sparsemax
c) nzmax
d) no such command

12. The size of the sparse matrix will be ___ the original matrix.
a) equal
b) greater than
c) less than
d) not equal to

13. The output of the following code is:

a=[pi/2 pi 3*pi]; spy[a]

a) Suppressed output
b) A pattern of sparsity
c) Syntactical error
d) Symbolic error

14. The output of the following command is

a=[1 2 3;4 0 0;3 0 9]; spy(A)

a) a graph of sparsity
b) a pattern of sparsity
c) syntactical error
d) logical error

15. The spy command takes in multiple matrices.
a) True
b) False

Leave a Reply

Your email address will not be published. Required fields are marked *