MATLAB EXAM 1 QUESTIONS AND ANSWERS
1. What would be the result of the following 1 (logical)
expres- sions?
'q' >= 'D' - 1
2. What would be the result of the following 0 (logical)
expres- sions?
5 ==5+ 2
3. What would be the result of the following 3
expres- sions?
(5==5) + 2
4. What would be the result of the following 1 (logical)
expres- sions?
xor(5< 17, 10 > 11)
5. What would be the result of the following 0 (logical)
expres- sions?
10>6>4
6. What would be the result of the following 1 (logical)
expres- sions?
1<10<=2
7. 2\12+12/2-3^2 3
8. Generate a 5 x 4 matrix of integers, each
random real numbers, each in in the inclusive
the range (0,25) range from 15
to 42
9. Generate a 5 x 4 matrix of random real
numbers, each in the range (6,30)
10. Generate a 5 x 4 matrix of random
1/
16
, MATLAB EXAM 1 QUESTIONS AND ANSWERS
rand(5,4)*25
rand(5,4)*(30-6)+6
randi([15 42],5,4)
2/
16
, MATLAB EXAM 1 QUESTIONS AND ANSWERS
11. Generate a 4 x 4 matrix of random randi([-10 5],4)
integers, each in the inclusive range from -
10 to 5
12. Generate a (2×5)matrix with all 80s ones(2,5)*80
13. Delete the last column in a matrix mat(:,end)=[]
14. Using the colon operator and 12 10 8 6
also the linspace function, create the following
vec- tor:
-1 1 3 5 7 9 11
15. Using the colon operator
and also
the linspace function, create the following
vector: 8 5 2-1-4
16. Create a variable pounds to store a
weight in pounds. Convert this to kilogram
and assign the result to a variable kilos
17. Find an
efficient way
to generate the following
matrix mat=
7 8 9 10
12 10 8 6
18. refer to the element in the second row,
third col- umn of
mat=
7 8 9 10
3/
16
1. What would be the result of the following 1 (logical)
expres- sions?
'q' >= 'D' - 1
2. What would be the result of the following 0 (logical)
expres- sions?
5 ==5+ 2
3. What would be the result of the following 3
expres- sions?
(5==5) + 2
4. What would be the result of the following 1 (logical)
expres- sions?
xor(5< 17, 10 > 11)
5. What would be the result of the following 0 (logical)
expres- sions?
10>6>4
6. What would be the result of the following 1 (logical)
expres- sions?
1<10<=2
7. 2\12+12/2-3^2 3
8. Generate a 5 x 4 matrix of integers, each
random real numbers, each in in the inclusive
the range (0,25) range from 15
to 42
9. Generate a 5 x 4 matrix of random real
numbers, each in the range (6,30)
10. Generate a 5 x 4 matrix of random
1/
16
, MATLAB EXAM 1 QUESTIONS AND ANSWERS
rand(5,4)*25
rand(5,4)*(30-6)+6
randi([15 42],5,4)
2/
16
, MATLAB EXAM 1 QUESTIONS AND ANSWERS
11. Generate a 4 x 4 matrix of random randi([-10 5],4)
integers, each in the inclusive range from -
10 to 5
12. Generate a (2×5)matrix with all 80s ones(2,5)*80
13. Delete the last column in a matrix mat(:,end)=[]
14. Using the colon operator and 12 10 8 6
also the linspace function, create the following
vec- tor:
-1 1 3 5 7 9 11
15. Using the colon operator
and also
the linspace function, create the following
vector: 8 5 2-1-4
16. Create a variable pounds to store a
weight in pounds. Convert this to kilogram
and assign the result to a variable kilos
17. Find an
efficient way
to generate the following
matrix mat=
7 8 9 10
12 10 8 6
18. refer to the element in the second row,
third col- umn of
mat=
7 8 9 10
3/
16