Deck 15: Computational Engineering Tools: Matlab
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/38
Play
Full screen (f)
Deck 15: Computational Engineering Tools: Matlab
1
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
A)x = 0.66666666667
B)x = 0.6667
C)x = 0.67
D)x = 2/3
C
2
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
A)x = 0.66666666666666666666667
B)x = 0.66666666666667
C)x = 0.67000000000000
D)x = 2/3
B
3
To clear the contents of the Command Window, type
A)clear
B)clr
C)clc
D)shift-c
A)clear
B)clr
C)clc
D)shift-c
C
4
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
A)x = 2;2;20
B)x = 2:2:20
C)x = 2:20:2
D)x = 2,20,2
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
5
Shown below are MATLAB inputs.Complete each output:
>> E = [10:-2:0];
>> F = 20./E
>> F =
>> E = [10:-2:0];
>> F = 20./E
>> F =
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
6
Shown below are MATLAB inputs.Complete each output:
>> A = [1:4];
>> B = 3.*A
>> B =
>> A = [1:4];
>> B = 3.*A
>> B =
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
7
In the MATLAB environment, you can assign values to a variable or define the elements of a matrix.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
8
The following matrices have already been defined in MATLAB:
What would be the outputs of the following MATLAB inputs:
>> A(4:8)

>> A(4:8)
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
9
Shown below are MATLAB inputs.Complete each output:
>> A = [2:5];
>> B = 4*A
>> B =
>> A = [2:5];
>> B = 4*A
>> B =
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
10
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
A)x = 0.66666666667
B)x = 0.6667
C)x = 0.67
D)x = 2/3
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
11
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
A)x = 0.66666666667
B)x = 0.6667
C)x = 0.67
D)x = 2/3
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
12
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.
A)menu bar.
B)current folder.
C)command window.
D)command history window.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
13
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.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
14
Shown below are MATLAB inputs.Complete each output:
>> C = [1,3,-2,0];
>> D = 3./C
>> D =
>> C = [1,3,-2,0];
>> D = 3./C
>> D =
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
15
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 (;)
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
16
In MATLAB, you cannot transfer old commands from the Command History Window to the Command Window.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
17
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
A)ans = 3 6 9
B)ans = 1 2 3 2 4 6
C)ans = 6 12
D)ans = 18
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
18
The following matrices have already been defined in MATLAB:
What would be the outputs of the following MATLAB inputs:
>> B(2:5)

>> B(2:5)
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
19
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
A)ans = 3 6 9
B)ans = 1 2 3 2 4 6
B)ans = 2 8 18
C)ans = 6 12
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
20
Shown below are MATLAB inputs.Complete each output:
>> A = [2:5];
>> B = 4.*A
>> B =
>> A = [2:5];
>> B = 4.*A
>> B =
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
21
The following matrices have already been defined in MATLAB:
What would be the outputs of the following MATLAB inputs:
>> A(2:3,:)

>> A(2:3,:)
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
22
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.
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.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
23
The following matrices have already been defined in MATLAB:
What would be the outputs of the following MATLAB inputs:
>> length (A)

>> length (A)
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
24
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
A)Coefficients = polyfit(2, x,y)
B)Coefficients = polyfit(x,2,y)
C)Coefficients = polyfit(x,y,2)
D)none of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
25
The following matrices have already been defined in MATLAB:
What would be the outputs of the following MATLAB inputs:
>> A(:,3)

>> A(:,3)
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
26
Find the corresponding MATLAB output:
>> factorial(3)
ans =
>> factorial(3)
ans =
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
27
Which of the following commands are commonly used while plotting in MATLAB?
A)plot
B)title
C)grid
D)all of the above
A)plot
B)title
C)grid
D)all of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
28
The following matrices have already been defined in MATLAB:
What would be the outputs of the following MATLAB inputs:
>> B(:,3:4)

>> B(:,3:4)
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
29
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
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
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
30
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
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
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
31
The following matrices have already been defined in MATLAB:
What would be the outputs of the following MATLAB inputs:
>> B(2:3, 2:4)

>> B(2:3, 2:4)
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
32
an M-file is used to when you write a program that is more than a few lines long.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
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)
A)e^x
B)exp(x)
C)exp^x
D)exponent(x)
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
34
The following matrices have already been defined in MATLAB:
What would be the outputs of the following MATLAB inputs:
>> max(B)

>> max(B)
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
35
What is the MATLAB command for calculating the square root of a number?
A)square_root
B)sqrt
C)sqr
D)sq_rt
A)square_root
B)sqrt
C)sqr
D)sq_rt
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
36
The following matrices have already been defined in MATLAB:
What would be the outputs of the following MATLAB inputs:
>> min(A)

>> min(A)
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
37
Find the corresponding MATLAB output:
>> A = [2,3,4,5;1,-3,-7,4;2,3,2,1];
>> max (A)
ans =
>> A = [2,3,4,5;1,-3,-7,4;2,3,2,1];
>> max (A)
ans =
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
38
What would be the result of the following MATLAB commands?
F1x = sym('x^2-25');
solve(F1x)
F1x = sym('x^2-25');
solve(F1x)
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck