SlideShare a Scribd company logo
1 of 7
Download to read offline
University of Calgary 18/09/2012
Department of Mechanical and Manufacturing Engineering


Name:
.
.
.
.
.
.
.
.
.
.
.
.
 
 Please
DO
NOT
SEPARATE
these
pages


 At
the
end
of
the
exam
insert
the
answer
(Scantron)
page
inside
of
this
set
of
pages



Department
of
Mechanical
and
Manufacturing
Engineering

Schulich
School
of
Engineering

University
of
Calgary



Computing Tools for Engineering Design ‐ ENME 337 ‐ L2 
 
“color”



 Quiz #1 (MATLAB  1) 


16 mult. choice questions  ;   Duration: 20 minutes 
 
 
Note: 
 
1.
 Several
words
in
the
following
questions
may
have
multiple
meanings.
Use
the
meaning
rele‐
vant
to
MATLAB
and
its
applications,
or
to
the
commonly
used
mathematics
context.



2.
 Unless
explicitly
stated,
assume
in
each
problem
that MATLAB is in its basic initial state,
as

right
after
launching
it,
after
turning
the
computer
on.





 
 
Answer the  questions by marking the “bubbles” on the sheet for computerized evaluation 
(Scantron). Use No. 2 pencil. 
 
 
 
 
continued ... 
 
  2 
Q1.
Executing
in
the
Command
Window
the
following
code


 
a
=
(1:3)’ 
;

(a(1,2))’


 returns



a.
 error
message

b.
 1



c.
 2

d.
 1



2

e.
 none
of
above

 
Q2.
Executing
in
the
Command
Window
the
following
code


 

a
=
ones(3,4)
;

b
=
a(4,3)

,
size(b);


 returns



a.
 1

b.
 ‐1

c.
 1



1

d.
 error
message

e.
 none
of
the
above

 
Q3.
Executing
the
command
iskeyword size returns 0,
i.e.,
size is
not
a
MATLAB
keyword. Given

this
information,
which
of
the
following
statements
shows
the
result
of
executing
the
following
line

in
the
Command
Window



 
size
=
(1:3)’ 
;


size(size)

a.
 wrong
result
(i.e.,
at
least
one
of
the
commands
should
not
be
used
in
MATLAB)

b.
 1



2

c.
 2



1

d.
 2



2

e.
 none
of
above

 
 
 
continued ... 
  3 
Q4.
Executing
in
the
Command
Window
the
following
code


 

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


 returns



a.
 error
message

b.
 1



2

c.
 2



1

d.
 2

e.
 none
of
above

 
Q5.
Executing
in
the
Command
Window
the
following
code


 

a
=
1:2
;
size[a]


 returns



a.
 error
message

b.
 1



2

c.
 2



1

d.
 2

e.
 none
of
above

 
Q6.
 The
following
lines
show
collections
of
characters
(e.g.,
_xm,
m3)

that
either
can
or
can
not
be

valid
names
of
MATLAB
variables.
Which
line
contains
EXCLUSIVELY
valid
names
?




a.
 _xm
m3,
abc,
a_B



(wrong,
but
accepted
in
Quiz
1
‐>
“
_
“
not
allowed
as
1st

char
of
var.
name)

b.
 m3,
3_m,
m_3,
aB


c.
 AA,
for,
a‐b,
ab

d.
 AA,
BB,
m3,
a‐B

e.
 none
of
above

 
 
continued ... 
   
  4 
Q7.
Which
of
the
following
statements
is
correct
? 
a.
 Function
“clear”
clears
only
the
scalar
variables,
but
does
not
clear
arrays

b.
 Function
“clc”
clears
all
variables

c.
 Function
“clc”
clears
only
constants

d.
 Function
“clear
a”
clears
all
variables
of
the
type
“array”

e.
 None
of
the
above



Q8.
Executing
in
the
Command
Window
the
following
code


 A
=
eye(1,10)
;

size(A(2,2))


 returns



a.
 1

b.
 0

c.
 error
message

d.
 1



1

e.
 none
of
the
above

 
Q9.
Executing
in
the
Command
Window
the
following
code


 A
=
[1:1:5;;2:1:6]
;

size(A)


 returns



a.
 2



5

b.
 5



2

c.
 error
message

d.
 3



5

e.
 none
of
the
above

 
 
 
continued ... 
  5 
Q10.
Executing
the
command
iskeyword sin returns 0,
i.e.,
sin
is
not
a
MATLAB
keyword. Given
this

information,
which
of
the
following
statements
shows
the
result
of
executing,
in
the
Command

Window,
of
the
line



sqrt(sin(‐pi/2))

;

sin
=
size(1:5)

a.
 wrong
result
(i.e.,
at
least
one
of
the
commands
should
not
be
used)

b.
 1

c.
 1



5

d.
 i

e.
 none
of
above

 
Q11.
Which
of
the
following
statements
is
correct
? 
a.
 Function
“who”
returns
the
name
of
the
currently
logged
user

b.
 Function
“who”
returns
the
name
of
the
system
administrator

c.
 Function
“whos”
displays
the
user
IDs
for
all
accounts
on
the
computer

d.
 Function
“who”
displays
the
web
address
of
the
system
administrator

e.
 None
of
the
above

 
Q12.
After
executing
the
following
script
file
in
MATLAB


x
=
[2:4
;
‐1:1
;
1
2
3];

y=x(2,:);

size(y')

the
displayed
result
is



a.
 2



2


b.
 3



1

c.
 2



1

d.
 1



3

e.
 none
of
above





continued ... 




  6 
Q13.
After
executing
the
following
script
file
in
MATLAB


x
=
3i;

y
=
x/2*sqrt(‐1);

z
=
x
+
y

the
displayed
result
is

a.
 1.5
+
3
i

b.
 error
message


c.
 3
+
1.5
i

d.
 ‐1.5
+
3
i

e.
 none
of
above

 
Q14.
After
executing
the
following
script
file
in
MATLAB


x
=
‐i;

y
=
x*sqrt(‐1);

x
+
y

the
displayed
result
is

a.
 error
message

b.
 ‐i


c.
 
i

d.
 1
‐
1
i

e.
 none
of
above



Q15.
Executing
in
the
Command
Window
the
following
code


 

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


 returns



a.
 2
+
2
i

b.
 2
‐
2
i

c.
 error
message

d.
 NaN

e.
 none
of
the
above

  7 
Q16.
Executing
in
the
Command
Window
the
following
code


 

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


 returns



a.
 error
message

b.
 2

 
2


c.
 2

 3

d.
 3

 3

e.
 none
of
the
above

 


 
 



More Related Content

Similar to matlab example

Bca(rev syll ii-sem) assignment for july 2012 and jan 2013 sessionn
Bca(rev syll ii-sem) assignment for july 2012 and jan 2013 sessionnBca(rev syll ii-sem) assignment for july 2012 and jan 2013 sessionn
Bca(rev syll ii-sem) assignment for july 2012 and jan 2013 sessionnShripad Tawade
 
How to work on Matlab.......
How to work on Matlab.......How to work on Matlab.......
How to work on Matlab.......biinoida
 
Automatic generation of UML sequence diagrams from test counterexamples
Automatic generation of UML sequence diagrams from test counterexamplesAutomatic generation of UML sequence diagrams from test counterexamples
Automatic generation of UML sequence diagrams from test counterexamplesLaura M. Castro
 
GSP 125 Entire Course NEW
GSP 125 Entire Course NEWGSP 125 Entire Course NEW
GSP 125 Entire Course NEWshyamuopten
 
Midterm Exam Solutions Fall03
Midterm Exam Solutions Fall03Midterm Exam Solutions Fall03
Midterm Exam Solutions Fall03Radu_Negulescu
 
UML – Design the software for an Auto Teller Machine (ATM)
UML – Design the software for an Auto Teller Machine (ATM)UML – Design the software for an Auto Teller Machine (ATM)
UML – Design the software for an Auto Teller Machine (ATM)suresh ramanujam
 
Productive Use of the Apache Spark Prompt with Sam Penrose
Productive Use of the Apache Spark Prompt with Sam PenroseProductive Use of the Apache Spark Prompt with Sam Penrose
Productive Use of the Apache Spark Prompt with Sam PenroseDatabricks
 
Powell lynetta storyboard_week4
Powell lynetta storyboard_week4Powell lynetta storyboard_week4
Powell lynetta storyboard_week4Walden University
 
Content
Content Content
Content o3aroo
 
Basic VB problems
Basic VB problemsBasic VB problems
Basic VB problemsMukesh Das
 
21: Which method determines if a JRadioButton is selected?
21: Which method determines if a JRadioButton is selected?21: Which method determines if a JRadioButton is selected?
21: Which method determines if a JRadioButton is selected?sukeshsuresh189
 
6: Which of the following statements about creating arrays and initializing t...
6: Which of the following statements about creating arrays and initializing t...6: Which of the following statements about creating arrays and initializing t...
6: Which of the following statements about creating arrays and initializing t...sukeshsuresh189
 
Comp 328 final guide (devry)
Comp 328 final guide (devry)Comp 328 final guide (devry)
Comp 328 final guide (devry)sukeshsuresh189
 
10: In the Java graphics system, coordinate units are measured in ________.
10: In the Java graphics system, coordinate units are measured in ________.10: In the Java graphics system, coordinate units are measured in ________.
10: In the Java graphics system, coordinate units are measured in ________.sukeshsuresh189
 

Similar to matlab example (20)

Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
 
Bca(rev syll ii-sem) assignment for july 2012 and jan 2013 sessionn
Bca(rev syll ii-sem) assignment for july 2012 and jan 2013 sessionnBca(rev syll ii-sem) assignment for july 2012 and jan 2013 sessionn
Bca(rev syll ii-sem) assignment for july 2012 and jan 2013 sessionn
 
How to work on Matlab.......
How to work on Matlab.......How to work on Matlab.......
How to work on Matlab.......
 
Automatic generation of UML sequence diagrams from test counterexamples
Automatic generation of UML sequence diagrams from test counterexamplesAutomatic generation of UML sequence diagrams from test counterexamples
Automatic generation of UML sequence diagrams from test counterexamples
 
matlabchapter1.ppt
matlabchapter1.pptmatlabchapter1.ppt
matlabchapter1.ppt
 
GSP 125 Entire Course NEW
GSP 125 Entire Course NEWGSP 125 Entire Course NEW
GSP 125 Entire Course NEW
 
Midterm Exam Solutions Fall03
Midterm Exam Solutions Fall03Midterm Exam Solutions Fall03
Midterm Exam Solutions Fall03
 
UML – Design the software for an Auto Teller Machine (ATM)
UML – Design the software for an Auto Teller Machine (ATM)UML – Design the software for an Auto Teller Machine (ATM)
UML – Design the software for an Auto Teller Machine (ATM)
 
Simulation lab
Simulation labSimulation lab
Simulation lab
 
AJP
AJPAJP
AJP
 
Productive Use of the Apache Spark Prompt with Sam Penrose
Productive Use of the Apache Spark Prompt with Sam PenroseProductive Use of the Apache Spark Prompt with Sam Penrose
Productive Use of the Apache Spark Prompt with Sam Penrose
 
Powell lynetta storyboard_week4
Powell lynetta storyboard_week4Powell lynetta storyboard_week4
Powell lynetta storyboard_week4
 
Cognos Macros
Cognos MacrosCognos Macros
Cognos Macros
 
midterm_fa07.pdf
midterm_fa07.pdfmidterm_fa07.pdf
midterm_fa07.pdf
 
Content
Content Content
Content
 
Basic VB problems
Basic VB problemsBasic VB problems
Basic VB problems
 
21: Which method determines if a JRadioButton is selected?
21: Which method determines if a JRadioButton is selected?21: Which method determines if a JRadioButton is selected?
21: Which method determines if a JRadioButton is selected?
 
6: Which of the following statements about creating arrays and initializing t...
6: Which of the following statements about creating arrays and initializing t...6: Which of the following statements about creating arrays and initializing t...
6: Which of the following statements about creating arrays and initializing t...
 
Comp 328 final guide (devry)
Comp 328 final guide (devry)Comp 328 final guide (devry)
Comp 328 final guide (devry)
 
10: In the Java graphics system, coordinate units are measured in ________.
10: In the Java graphics system, coordinate units are measured in ________.10: In the Java graphics system, coordinate units are measured in ________.
10: In the Java graphics system, coordinate units are measured in ________.
 

Recently uploaded

How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17Celine George
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17Celine George
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfJerry Chew
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportDenish Jangid
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesPooky Knightsmith
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi RajagopalEADTU
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptxVishal Singh
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code ExamplesPeter Brusilovsky
 

Recently uploaded (20)

How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 

matlab example

  • 1. University of Calgary 18/09/2012 Department of Mechanical and Manufacturing Engineering 
 Name:
.
.
.
.
.
.
.
.
.
.
.
.
 
 Please
DO
NOT
SEPARATE
these
pages
 
 At
the
end
of
the
exam
insert
the
answer
(Scantron)
page
inside
of
this
set
of
pages
 
 Department
of
Mechanical
and
Manufacturing
Engineering
 Schulich
School
of
Engineering
 University
of
Calgary
 
 Computing Tools for Engineering Design ‐ ENME 337 ‐ L2    “color”
 
  Quiz #1 (MATLAB  1)  
 16 mult. choice questions  ;   Duration: 20 minutes      Note:    1.
 Several
words
in
the
following
questions
may
have
multiple
meanings.
Use
the
meaning
rele‐ vant
to
MATLAB
and
its
applications,
or
to
the
commonly
used
mathematics
context.
 
 2.
 Unless
explicitly
stated,
assume
in
each
problem
that MATLAB is in its basic initial state,
as
 right
after
launching
it,
after
turning
the
computer
on.
 
 
     Answer the  questions by marking the “bubbles” on the sheet for computerized evaluation  (Scantron). Use No. 2 pencil.          continued ...   
  • 2.   2  Q1.
Executing
in
the
Command
Window
the
following
code
 
 
a
=
(1:3)’ 
;

(a(1,2))’
 
 returns
 
 a.
 error
message
 b.
 1


 c.
 2
 d.
 1



2
 e.
 none
of
above
   Q2.
Executing
in
the
Command
Window
the
following
code
 
 

a
=
ones(3,4)
;

b
=
a(4,3)

,
size(b);
 
 returns
 
 a.
 1
 b.
 ‐1
 c.
 1



1
 d.
 error
message
 e.
 none
of
the
above
   Q3.
Executing
the
command
iskeyword size returns 0,
i.e.,
size is
not
a
MATLAB
keyword. Given
 this
information,
which
of
the
following
statements
shows
the
result
of
executing
the
following
line
 in
the
Command
Window

 
 
size
=
(1:3)’ 
;


size(size)
 a.
 wrong
result
(i.e.,
at
least
one
of
the
commands
should
not
be
used
in
MATLAB)
 b.
 1



2
 c.
 2



1
 d.
 2



2
 e.
 none
of
above
       continued ... 
  • 3.   3  Q4.
Executing
in
the
Command
Window
the
following
code
 
 

a
=
[1:2]’
;
size(a)
 
 returns
 
 a.
 error
message
 b.
 1



2
 c.
 2



1
 d.
 2
 e.
 none
of
above
   Q5.
Executing
in
the
Command
Window
the
following
code
 
 

a
=
1:2
;
size[a]
 
 returns
 
 a.
 error
message
 b.
 1



2
 c.
 2



1
 d.
 2
 e.
 none
of
above
   Q6.
 The
following
lines
show
collections
of
characters
(e.g.,
_xm,
m3)

that
either
can
or
can
not
be
 valid
names
of
MATLAB
variables.
Which
line
contains
EXCLUSIVELY
valid
names
?
 

 a.
 _xm
m3,
abc,
a_B



(wrong,
but
accepted
in
Quiz
1
‐>
“
_
“
not
allowed
as
1st 
char
of
var.
name)
 b.
 m3,
3_m,
m_3,
aB

 c.
 AA,
for,
a‐b,
ab
 d.
 AA,
BB,
m3,
a‐B
 e.
 none
of
above
     continued ...     
  • 4.   4  Q7.
Which
of
the
following
statements
is
correct
?  a.
 Function
“clear”
clears
only
the
scalar
variables,
but
does
not
clear
arrays
 b.
 Function
“clc”
clears
all
variables
 c.
 Function
“clc”
clears
only
constants
 d.
 Function
“clear
a”
clears
all
variables
of
the
type
“array”
 e.
 None
of
the
above
 
 Q8.
Executing
in
the
Command
Window
the
following
code
 
 A
=
eye(1,10)
;

size(A(2,2))
 
 returns
 
 a.
 1
 b.
 0
 c.
 error
message
 d.
 1



1
 e.
 none
of
the
above
   Q9.
Executing
in
the
Command
Window
the
following
code
 
 A
=
[1:1:5;;2:1:6]
;

size(A)
 
 returns
 
 a.
 2



5
 b.
 5



2
 c.
 error
message
 d.
 3



5
 e.
 none
of
the
above
       continued ... 
  • 5.   5  Q10.
Executing
the
command
iskeyword sin returns 0,
i.e.,
sin
is
not
a
MATLAB
keyword. Given
this
 information,
which
of
the
following
statements
shows
the
result
of
executing,
in
the
Command
 Window,
of
the
line


 sqrt(sin(‐pi/2))

;

sin
=
size(1:5)
 a.
 wrong
result
(i.e.,
at
least
one
of
the
commands
should
not
be
used)
 b.
 1
 c.
 1



5
 d.
 i
 e.
 none
of
above
   Q11.
Which
of
the
following
statements
is
correct
?  a.
 Function
“who”
returns
the
name
of
the
currently
logged
user
 b.
 Function
“who”
returns
the
name
of
the
system
administrator
 c.
 Function
“whos”
displays
the
user
IDs
for
all
accounts
on
the
computer
 d.
 Function
“who”
displays
the
web
address
of
the
system
administrator
 e.
 None
of
the
above
   Q12.
After
executing
the
following
script
file
in
MATLAB

 x
=
[2:4
;
‐1:1
;
1
2
3];
 y=x(2,:);
 size(y')
 the
displayed
result
is
 
 a.
 2



2

 b.
 3



1
 c.
 2



1
 d.
 1



3
 e.
 none
of
above
 
 
 continued ...  
 

  • 6.   6  Q13.
After
executing
the
following
script
file
in
MATLAB

 x
=
3i;
 y
=
x/2*sqrt(‐1);
 z
=
x
+
y
 the
displayed
result
is
 a.
 1.5
+
3
i
 b.
 error
message

 c.
 3
+
1.5
i
 d.
 ‐1.5
+
3
i
 e.
 none
of
above
   Q14.
After
executing
the
following
script
file
in
MATLAB

 x
=
‐i;
 y
=
x*sqrt(‐1);
 x
+
y
 the
displayed
result
is
 a.
 error
message
 b.
 ‐i

 c.
 
i
 d.
 1
‐
1
i
 e.
 none
of
above
 
 Q15.
Executing
in
the
Command
Window
the
following
code
 
 

y
=
a
+
b
,
a
=
2
;
b
=
sqrt(‐4)
;
 
 returns
 
 a.
 2
+
2
i
 b.
 2
‐
2
i
 c.
 error
message
 d.
 NaN
 e.
 none
of
the
above

  • 7.   7  Q16.
Executing
in
the
Command
Window
the
following
code
 
 

x = [1:3.4; -6:3.5:0.5] ; size(x)
 
 returns
 
 a.
 error
message
 b.
 2

 
2

 c.
 2

 3
 d.
 3

 3
 e.
 none
of
the
above