Matlab Multiple choice Questions & Answers

Posted On:May 31, 2019, Posted By: Latest Interview Questions, Views: 13661, Rating :

Best Matlab Objective type Questions and Answers

Dear Readers, Welcome to Matlab Objective Questions and Answers have been designed specially to get you acquainted with the nature of questions you may encounter during your Job interview for the subject of Matlab Multiple choice Questions. These Objective type Matlab are very important for campus placement test and job interviews. As per my experience good interviewers hardly plan to ask any particular question during your Job interview and these model questions are asked in the online technical test and interview of many IT & Non IT Industry.

 

1. What does Matlab stand for? | MatLab Mcqs

a) Math Laboratory

 b) Matrix Laboratory 

c) Mathworks 

d) Nothing 

e) none of the above 

Ans: b

Objective Type Questions On Matlab

2. What symbol precedes all comments in Matlab? | MatLab Mcqs 

a) “ 

b) % 

c) // 

d) < 

e) none of the above 

 Ans: e

 

3. Which of the following is not a pre-defined variable in Matlab. | MatLab Mcqs 

a) pi 

b) inf

 c) i 

d) gravity 

e) j 

 Ans: d

 

4. This Matlab command clears all data and variables stored in memory: | MatLab Mcqs 

a) clc 

b) clear 

c) delete 

d) deallocate 

e) none of the above 

 Ans: b

 

5. Characters in Matlab are represented in their value in memory. | MatLab Mcqs 

a) decimal 

b) ASCII 

c) hex 

d) string 

e) none of the above 

Ans: b

 

6. Which is these is not an aspect of a for/while loop: | MatLab Mcqs 

a) update

 b) initialization 

c) runner 

d) condition 

e) all are aspects of loops  

Ans: c

 

7. To better manage memory and prevent unnecessary memory allocations, Matlab uses: | MatLab Mcqs 

a) vectors 

b) scalars 

c) matrix math 

d) delayed copy 

e) licenses  

Ans: d

 

8. To print a newline in a fprintf statement, you must use the following escape character: | MatLab Mcqs 

a) \t 

b) \nl

 c) \nxt 

d) \n

 e) none of the above 

 Ans: d

 

9. In Matlab, this keyword immediately moves to the next iteration of the loop: | MatLab Mcqs 

a) update 

b) goto 

c) continue 

d) break 

e) none of the above  

Ans: c

 

10. Which of the following will correctly define x, y, and z as symbols? | MatLab Mcqs 

a) sym (x, y, z) 

b) syms x y z 

c) syms x, y, z

 d) sym x, y, z 

e) none of the above  

Ans: b

 

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)? | MatLab Mcqs 

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? | MatLab Mcqs

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)? | MatLab Mcqs 

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) | MatLab Mcqs 

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?  | MatLab Mcqs

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? 

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

 

 

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

Ans: e

?

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

Ans: c

 

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

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

Ans: c

 

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

Ans: e

 

27.?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?  Ans: b

 

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

Ans: d

 

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

Ans: d

 

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

Ans: c

 

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

 

32.     To add a comment to the mfile, the MATLAB command is

A )  % 

B )  ; 

C )  comment(' ') 

D )  &

Ans: a

 

33.  When used in the fprintf command, the %g is used as the

A )  single character display 

B )  fixed point display 

C )  string notation display 

D )  default number display

Ans: d

 

34.  When used in the fprintf command, the \n is used to

A )  add a space between any two characters 

B )  add a line space (enter key) 

C )  place a number into the comment 

D )  clear the comment

Ans: b

 

35.  To display 'Question 2' in the command window, the correct command is

A )  disp(Question 2) 

B )  display('Question 2') 

C )  disp('Question 2') 

D )  Question 2

Ans: c

 

36.  The clc command is used to

A )  clear the command window 

B )  erase everything in the mfile 

C )  clean the desktop 

D )  save the existing mfile

Ans: a

 

37.  The num2str command

A )  converts a number to string 

B )  converts string to a number 

C )  concatenates numbers and strings 

D )  concatenates strings

Ans: a

 

38. The output of the last line is 

aa=2

as=num2str(aa)

cat=['cat' as]

 

A )  cat2 

B )  cat 2 

C )  ??? Undefined function or variable 'as' 

D )  cat aa

Ans: a

 

39.  To join one or more strings into a single string is known as

A )  concatenation 

B )  joining 

C )  string conversion 

D )  string theory

Ans: a

 

40.   The output of

      cat=['cat'   'dog']

is

A )  catdog 

B )  cat dog 

C )  cat&dog 

D )  CatDog

Ans: a

Also Read 100+ MATLAB Interview Questions