Thursday 3 September 2015

Matlab Objective type Questions and Answers

11. Which of these is the way to access the first element in a vector named v (assuming there is at 
least one element in the vector)? 
a) v(0)
b) v(1)
c) v
d) v(: , 0)
e) none of the above   Ans: b

12. Which of the following is used to see if two elements are equal in MATLAB? 
a) !=
b) ==
c) isequal
d) =
e) none of the above
Ans: b

13. If vector = [1 2 3 4; 11 24 92 100; 345 65 90 1]. What will the value of a be equal to if this 
code is entered into MATLAB >>[a b] = size (vector)? 
a) 1 2 3 4
b) 12
 c) 1
d) 4
e) 3
 Ans: e

14. What is the value of ans that is printed when the following code is run: isnumeric(32) 
a) 1
 b) 0
 c) 32
d) yes
e) true
Ans: a

15. If I want to save a formatted string to memory, but don’t want to print it out, which 
command should I use? 
a) fprintf
 b)sprintf
c) disp
d) echo
Ans: b

16.?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?
Ans: a

17.?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?
Ans: d

18.?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?  Ans: a

19.?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?
Ans: c

20.?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?

More Questions & Answers:-
Page1 Page2 Page3 Page4

1 comment: