In: Computer Science
1.If variable Test(i,j) is selected so the first column represents the student number (1,2,..., 32), 2nd column represents the score of the first homework, 3rd column represents the score of the 2nd homework, etc. If there is a total of 5 homework for this class, what is the size of variable Test ? Explain why, Does (i,i) is the same as rows x columns?
(6,32)
(32,6)
2.If the size of b is shown on the workspace menu for MATLAB as 4x4, what type of variable b is? Explain why
2D matrix
4D matrix
3. If you want to multiply 8 by the result of adding 12 to 5, which command would you use in MATLAB? Explain why
[5+12]*8
(8+12)*5
4. If the following commands are executed in MATLAB
a = [1:5;logspace(2,8,5)]
How many rows are in a?
2
3
8
5
1. Ans: Correct Option is: (32,6)
EXPLANATION:
If first column represent student number and apart from that there are 5 homework scores, so on total there are 6 columns i.e,:
Stud_Num | score1 | score2 | score3 | score4 | score5 |
And since total number of students are 32, therefore there are 32 rows which can be represented as:
A matrix is represented as : (rows
columns)
Stud_Num | score1 | Score2 | score3 | score4 | Score5 |
1 | 47 | 54 | 44 | 32 | 56 |
2 | 52 | 43 | 23 | 76 | 47 |
: | : | : | : | : | : |
32 | 43 | 22 | 32 | 32 | 62 |
Therefore b) is correct option.
No In Test(i,i), (i,i) is not same as rows columns because (i,i)
means (32,32) . But (i,j) is same as rows
columns
2. Ans: Correct option is 2D MATRIX
EXPLANATION:
If size of variable 'b' is 4
4, then number of rows will be 4 and number of columns will be 4
i.e, rows columns. Two Dimensional matrix is specified by the
number of rows and columns.
So example of 4
4 matrix can be:
—————————————————-
3. Correct option is: [5+12]*8
EXPLANATION:
To add 5 with 12 we have to write expression 5+12 inside bracket i.e, [5+12] and then multiply the expression with 8 i.e, [5+12]*8
—————————————————————————————-—
4. Ans: It will produce two rows.
EXPLANATION:
Basically, In the first rows exponential numbers between 1 and 5 will be produced with each number incremented by 1.
Then the second row will contain the exponential numbers between 10^2 and 10^8.