0% found this document useful (0 votes)
360 views7 pages

Matlab Quiz

This document appears to be a quiz for a MATLAB course. It contains 16 multiple choice questions about MATLAB syntax, functions, and operations. The questions cover topics like variable assignment, array indexing and size functions, valid variable names, clearing variables, and basic arithmetic operations on complex numbers. The student is instructed to mark their answers on an included scantron sheet for automated grading.

Uploaded by

Sujit Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
360 views7 pages

Matlab Quiz

This document appears to be a quiz for a MATLAB course. It contains 16 multiple choice questions about MATLAB syntax, functions, and operations. The questions cover topics like variable assignment, array indexing and size functions, valid variable names, clearing variables, and basic arithmetic operations on complex numbers. The student is instructed to mark their answers on an included scantron sheet for automated grading.

Uploaded by

Sujit Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

University of Calgary

Department of Mechanical and Manufacturing Engineering

18/09/2012

Name:............

PleaseDONOTSEPARATEthesepages

Attheendoftheexaminserttheanswer(Scantron)pageinsideofthissetofpages

DepartmentofMechanicalandManufacturingEngineering
SchulichSchoolofEngineering
UniversityofCalgary

ComputingToolsforEngineeringDesignENME337L2

color

Quiz#1(MATLAB1)

16mult.choicequestions;Duration:20minutes

Note:

1. Severalwordsinthefollowingquestionsmayhavemultiplemeanings.Usethemeaningrele
vanttoMATLABanditsapplications,ortothecommonlyusedmathematicscontext.

2. Unlessexplicitlystated,assumeineachproblemthatMATLABisinitsbasicinitialstate,as
rightafterlaunchingit,afterturningthecomputeron.

Answerthequestionsbymarkingthebubblesonthesheetforcomputerizedevaluation
(Scantron).UseNo.2pencil.

continued...

Q1.ExecutingintheCommandWindowthefollowingcode

a=(1:3);(a(1,2))

returns

a. errormessage
b. 1
c. 2
d. 12
e. noneofabove

Q2.ExecutingintheCommandWindowthefollowingcode

a=ones(3,4);b=a(4,3),size(b);

returns

a. 1
b. 1
c. 11
d. errormessage
e. noneoftheabove

Q3.Executingthecommandiskeywordsizereturns0,i.e.,sizeisnotaMATLABkeyword.Given
thisinformation,whichofthefollowingstatementsshowstheresultofexecutingthefollowingline
intheCommandWindow

size=(1:3);size(size)

a. wrongresult(i.e.,atleastoneofthecommandsshouldnotbeusedinMATLAB)
b. 12
c. 21
d. 22
e. noneofabove

continued...

Q4.ExecutingintheCommandWindowthefollowingcode

a=[1:2];size(a)

returns

a. errormessage
b. 12
c. 21
d. 2
e. noneofabove

Q5.ExecutingintheCommandWindowthefollowingcode

a=1:2;size[a]

returns

a. errormessage
b. 12
c. 21
d. 2
e. noneofabove

Q6. Thefollowinglinesshowcollectionsofcharacters(e.g.,_xm,m3)thateithercanorcannotbe
validnamesofMATLABvariables.WhichlinecontainsEXCLUSIVELYvalidnames?

a. _xmm3,abc,a_B(wrong,butacceptedinQuiz1>_notallowedas1stcharofvar.name)
b. m3,3_m,m_3,aB
c. AA,for,ab,ab
d. AA,BB,m3,aB
e. noneofabove

continued...

Q7.Whichofthefollowingstatementsiscorrect?
a. Functionclearclearsonlythescalarvariables,butdoesnotcleararrays
b. Functionclcclearsallvariables
c. Functionclcclearsonlyconstants
d. Functionclearaclearsallvariablesofthetypearray
e. Noneoftheabove

Q8.ExecutingintheCommandWindowthefollowingcode

A=eye(1,10);size(A(2,2))

returns

a. 1
b. 0
c. errormessage
d. 11
e. noneoftheabove

Q9.ExecutingintheCommandWindowthefollowingcode

A=[1:1:5;;2:1:6];size(A)

returns

a. 25
b. 52
c. errormessage
d. 35
e. noneoftheabove

continued...

Q10.Executingthecommandiskeywordsinreturns0,i.e.,sinisnotaMATLABkeyword.Giventhis
information,whichofthefollowingstatementsshowstheresultofexecuting,intheCommand
Window,oftheline
sqrt(sin(pi/2));sin=size(1:5)
a. wrongresult(i.e.,atleastoneofthecommandsshouldnotbeused)
b. 1
c. 15
d. i
e. noneofabove

Q11.Whichofthefollowingstatementsiscorrect?
a. Functionwhoreturnsthenameofthecurrentlyloggeduser
b. Functionwhoreturnsthenameofthesystemadministrator
c. FunctionwhosdisplaystheuserIDsforallaccountsonthecomputer
d. Functionwhodisplaysthewebaddressofthesystemadministrator
e. Noneoftheabove

Q12.AfterexecutingthefollowingscriptfileinMATLAB
x=[2:4;1:1;123];
y=x(2,:);
size(y')
thedisplayedresultis

a. 22
b. 31
c. 21
d. 13
e. noneofabove

continued...

Q13.AfterexecutingthefollowingscriptfileinMATLAB
x=3i;
y=x/2*sqrt(1);
z=x+y
thedisplayedresultis
a. 1.5+3i
b. errormessage
c. 3+1.5i
d. 1.5+3i
e. noneofabove

Q14.AfterexecutingthefollowingscriptfileinMATLAB
x=i;
y=x*sqrt(1);
x+y
thedisplayedresultis
a. errormessage
b. i
c. i
d. 11i
e. noneofabove

Q15.ExecutingintheCommandWindowthefollowingcode

y=a+b,a=2;b=sqrt(4);

returns

a. 2+2i
b. 22i
c. errormessage
d. NaN
e. noneoftheabove

Q16.ExecutingintheCommandWindowthefollowingcode

x = [1:3.4; -6:3.5:0.5]

size(x)

returns

a. errormessage
b. 2 2
c. 2 3
d. 3 3
e. noneoftheabove

You might also like