wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

MATLAB variables. Types. Declaration. Operations.

Total questions: 10

Worksheet time: 3mins

Name
Class
Date
1.

Select all variable types that exist in MATLAB.

a)

int10

b)

single

c)

logical

d)

array

e)

script

2.

What command will create the row vector a = ( 4 15 23 81 ) ?

a)

a = [4 15 23 81]

b)

a = [ 4, 15, 23, 81]

c)

a = [ 4; 15; 23; 81]

d)

a = [ 4,15 23, 81]

3.

What will be the last element of vec variable if the last one was generated using following MATLAB command:

>> vec = 1:3:110;

?

a)

MATLAB will display an compilation error

b)

112

c)

110

d)

109

4.

How many elements will have the array term generated by the MATLAB command:

>> linspace ( 3 , 3.1 );

?

a)

100

b)

1

c)

2

d)

15

5.

What MATLAB commands will generate a similar result?

a)

a = ones

b)

a = zeros

c)

a = eye

d)

a = eye(3)

6.

Select the MATLAB command that will generate equivalent results.

a)

b = [3, 2, 1]'

b)

b = [3; 2; 1]

c)

b = zeros(3, 2, 1)

d)

b = pascal (3, 2, 1)

7.

A matrix was declared as in the left-side image. Which command assigns to scalar s value 10?

a)

s = matrice(3,2)

b)

s = matrice(end,end)

c)

s = matrice(2,3)

d)

s = matrice(1,3)

8.

A matrix was declared as in the left-side image.

Select the right values for x components, if x was generated by the following MATLAB command

>> x = size(test);

a)

x (1) = 3

x (2) = 7

b)

x (1) = 5

x (2) = 15

c)

x (1) = 7

x (2) = 3

d)

x (1) = 15

x (2) = 5

9.

Suppose that matrix A and vector b are saved in MATLAB Workspace with the values represented in the left-side picture. Which result will be displayed by the following command rezultat = A*b; ?

a)
b)

c)

d)

10.

For two matrices A and B defined as in the left-side picture, what will be the result of command A./B?

a)
b)
c)
d)