# Quiz 15: Computational Engineering Tools: Matlab

Engineering

Q 1Q 1

Engineers can use MATLAB to solve a wide range of engineering problems.They take advantage of built-in functions of the software and also they can write their own programs in MATLAB.

Free

True False

True

Q 2Q 2

The part of the screen where you enter variables and issue MATLAB commands is known as the
A)menu bar.
B)current folder.
C)command window.
D)command history window.

Free

Multiple Choice

C

Q 3Q 3

In the MATLAB environment, you can assign values to a variable or define the elements of a matrix.

Free

True False

True

Q 4Q 4

In MATLAB, you cannot transfer old commands from the Command History Window to the Command Window.

Free

True False

Free

Multiple Choice

Q 6Q 6

If you define x = 2/3, and then type format long, how will the value of x be displayed?
A)x = 0.66666666666666666666667
B)x = 0.66666666666667
C)x = 0.67000000000000
D)x = 2/3

Free

Multiple Choice

Q 7Q 7

If you define x = 2/3, and then type format short, how will the value of x be displayed?
A)x = 0.66666666667
B)x = 0.6667
C)x = 0.67
D)x = 2/3

Free

Multiple Choice

Q 8Q 8

If you define x = 2/3, and then type format rat, how will the value of x be displayed?
A)x = 0.66666666667
B)x = 0.6667
C)x = 0.67
D)x = 2/3

Free

Multiple Choice

Q 9Q 9

If you define x = 2/3, and then type format bank, how will the value of x be displayed?
A)x = 0.66666666667
B)x = 0.6667
C)x = 0.67
D)x = 2/3

Free

Multiple Choice

Q 10Q 10

In MATLAB, the elements of the matrix are enclosed in brackets [ ] and are separated by blank space, and the elements of each row are separated by a semicolon (;)

Free

True False

Q 11Q 11

To generate the set of x even numbers in the range of two to twenty, what should you enter in the Command Window?
A)x = 2;2;20
B)x = 2:2:20
C)x = 2:20:2
D)x = 2,20,2

Free

Multiple Choice

Q 12Q 12

Suppose you have defined x = [1,2,3] and y = [2,4,6] in the Command Window.Determine the result of the following MATLAB operation: >>x + y
A)ans = 3 6 9
B)ans = 1 2 3 2 4 6
C)ans = 6 12
D)ans = 18

Free

Multiple Choice

Q 13Q 13

Suppose you have defined x = [1,2,3] and y = [2,4,6] in the Command Window.Determine the result of the following MATLAB operation: >>x .* y
A)ans = 3 6 9
B)ans = 1 2 3 2 4 6
B)ans = 2 8 18
C)ans = 6 12

Free

Multiple Choice

Free

Essay

Free

Essay

Free

Essay

Free

Essay

Free

Essay

Q 19Q 19

The following matrices have already been defined in MATLAB: What would be the outputs of the following MATLAB inputs:
->> B(2:5)

Free

Essay

Q 20Q 20

The following matrices have already been defined in MATLAB: What would be the outputs of the following MATLAB inputs:
->> A(4:8)

Free

Essay

Q 21Q 21

The following matrices have already been defined in MATLAB: What would be the outputs of the following MATLAB inputs:
->> A(:,3)

Free

Essay

Q 22Q 22

The following matrices have already been defined in MATLAB: What would be the outputs of the following MATLAB inputs:
->> B(:,3:4)

Free

Essay

Q 23Q 23

The following matrices have already been defined in MATLAB: What would be the outputs of the following MATLAB inputs:
->> A(2:3,:)

Free

Essay

Q 24Q 24

The following matrices have already been defined in MATLAB: What would be the outputs of the following MATLAB inputs:
->> B(2:3, 2:4)

Free

Essay

Q 25Q 25

The following matrices have already been defined in MATLAB: What would be the outputs of the following MATLAB inputs:
->> length (A)

Free

Essay

Q 26Q 26

The following matrices have already been defined in MATLAB: What would be the outputs of the following MATLAB inputs:
->> max(B)

Free

Essay

Q 27Q 27

The following matrices have already been defined in MATLAB: What would be the outputs of the following MATLAB inputs:
->> min(A)

Free

Essay

Free

Essay

Free

True False

Q 30Q 30

Which of the following commands are commonly used while plotting in MATLAB?
A)plot
B)title
C)grid
D)all of the above

Free

Multiple Choice

Q 31Q 31

What is the MATLAB command for calculating the square root of a number?
A)square_root
B)sqrt
C)sqr
D)sq_rt

Free

Multiple Choice

Q 32Q 32

What does the following MATLAB function do? log2(x)
A)returns the value of base-2 logarithm of x.
B)returns the value of base-10 logarithm of 2 and assigns it to x.
C)returns the value of common log of 2x.
D)returns the value of natural logarithm of 2 and assigns it to x.

Free

Multiple Choice

Q 33Q 33

Which of the following MATLAB commands would calculate the value of ex?
A)e^x
B)exp(x)
C)exp^x
D)exponent(x)

Free

Multiple Choice

Free

Essay

Q 35Q 35

In the MATLAB Command Window, if you type the following commands, what would be the result?
scores = [80 90 50 70 80 60 65 95 70 40];
for i=1:1:10
if scores (i) <60
fprintf ('\t %g \t\t\t\t\t FAILING\n', scores (i))
end
end

Free

Essay

Q 36Q 36

In the MATLAB Command Window, if you type the following commands, what would be the result?
scores = [80 90 50 70 80 60 65 95 70 40];
for i=1:1:10
if scores (i) >60
fprintf('\t %g \t\t\t\t\t PASSING\n', scores (i));
else
fprintf('\t %g \t\t\t\t\t FAILING\n', scores (i))
end
end

Free

Essay

Q 37Q 37

To obtain the coefficients of the second order polynomial that best fits a given set of x and y data, you will type the following sequence of commands:
A)Coefficients = polyfit(2, x,y)
B)Coefficients = polyfit(x,2,y)
C)Coefficients = polyfit(x,y,2)
D)none of the above

Free

Multiple Choice

Free

Essay