YOU may join our Telegram for all subjects PDF BOOKS.
https://t.me/+Ccx9McEia7wyODg1
Data Structure Questions and Answers-Matrix
Question 1 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |
What is the order of a matrix?
number of rows X number of columns | |
number of columns X number of rows | |
number of rows X number of rows | |
number of columns X number of columns |
Question 1 Explanation:
By definition, the order of a matrix is number of rows X number of columns, generally denoted by mXn(not compulsory).
Question 2 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |
Which of the following property does not hold for matrix multiplication?
Associative | |
Distributive | |
Commutative | |
None of the mentioned |
Question 2 Explanation:
In matrix multiplication, AB != BA
Question 3 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |
How do you allocate a matrix using a single pointer in C?(r and c are the number of rows and columns respectively)
int *arr = malloc(r * c * sizeof(int)); | |
int *arr = (int *)malloc(r * c * sizeof(int)); | |
int *arr = (int *)malloc(r + c * sizeof(int)); | |
int *arr = (int *)malloc(r * c * sizeof(arr)); |
Question 3 Explanation:
Total number of elements in the matrix will be r*c
Question 4 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |
Select the code snippet which performs matrix multiplication.(a and b are the two given matrices, resultant marix is c)
for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { for (int k = | |
for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { for (int k | |
None of the mentioned |
Question 4 Explanation:
The corresponding elements from the row and column are multiplied and a cumulative sum is formed.
Question 5 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |
What does the following piece of code do?
for(int i = 0; i < row; i++) { for(int j = 0; j < column; j++) { if(i == j) sum = sum + (array[i][j]); } } System.out.println(sum);
Normal of a matrix | |
Trace of a matrix | |
Square of a matrix | |
Transpose of a matrix |
Question 5 Explanation:
Trace of a matrix is the sum of the principal diagonal elements.
There are 5 questions to complete.