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

Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhleson0603
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnershipsexpandedwebsite
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxLimon Prince
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code ExamplesPeter Brusilovsky
 
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
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMELOISARIVERA8
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptxPoojaSen20
 

Recently uploaded (20)

Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
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
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 

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