MATLAB Quiz 6 With Complete Solutions 100% correct
The following is typed into the MATLAB command prompt.
>> x = 2 : 3 : 7
Which of the following value for x will MATLAB display?
Select one:
a. 2 5 7
b. 2 3 7
c. 2 7
d. 2 5 - ANSWER d. 2 5
Consider that x is a new variable, which is created by using the following Matlab
statement,
x = [-8: -1: -12; -2: 2];
How many elements will the generated variable x have?
Select one:
a. 10
b. 12
c. 0; because there is an error in the assignment
d. 5 - ANSWER a. 10
, Which of the following is a valid function header?
Select one:
a. function [ ] = fx(input)
b. function ret = fx(34)
c. function ret1, ret2 = fx(input)
d. [ret1, ret2] = fx(input1, input2) - ANSWER a. function [] = fx(input)
If a = randi([0,10],10,5);and b = randi([0,10],5,10); what are the dimensions of a*b?
Select one:
a. A 10x10 matrix
b. Error: Matrix dimensions must agree
c. A 10x5 matrix
d. A 5x5 matrix - ANSWER a. A 10x10 matrix
What does the function zeros(5,8) return?
Select one:
a. A zero matrix with 5 rows, 5 columns and 8 dimensions
b. A zero matrix with 5 rows and 8 columns
c. A zero matrix with 8 rows, 8 columns and 5 dimensions
d. An 8 by 5 zero matrix - ANSWER b. A five by eight zero matrix
What does a semicolon at the end of a line of MATLAB code do?
Select one:
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Easton. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $13.99. You're not tied to anything after your purchase.