250+ TOP MCQs on The MATLAB Interface and Answers

MATLAB Multiple Choice Questions on “The MATLAB Interface”.

1. Which functions help you to save and load variables?
a)

>> save Lays [a,b]
>> load('myfile.mat')

b)

>> save Lays {a b}
>> load myfile.mat

c)

>> save Lays “a,b”
>> load(myfile.mat)

d)

>> save Lays a b
>> load('myfile.mat')

View Answer

Answer: d
Clarification: There is a pre-defined function in MATLAB to store the variable values from your workspace permanently called ‘save filename’. Option d is the correct command syntax for calling it.

Output: 
>>a=5;b=a;
>> save Lays a b;     % Now go to workspace and delete the variables
>> load('Lays.mat');%Check workspace.

 
 

2. To add comments in MATLAB, use _________
a) //
b) %/
c) /%
d) %
Answer: d
Clarification: The only format for adding and storing comments in MATLAB is to use the % symbol. One can choose to end a comment using %, but it is not needed.

3. To display comments of M-file, we use ____________
a) echo on
b) comment on
c) show %
d) Cannot be displayed
Answer: a
Clarification: The echo command is used to display commands present in an M-file. If the M-file has any comments, the echo command will also display the comments.

4. Where do we need to store a function to call it in other programs?
a) The bin folder
b) Anywhere
c) The MATLAB folder
d) Desktop
Answer: a
Clarification: M-files containing only a function has to be written separately and has to be stored as .m files in the bin folder. If it stored in any other folder, MATLAB won’t be able to access the function file.

  250+ TOP MCQs on Differentiation – 2 and Answers

5. What are the difference between the ‘help’ and the ‘look for’ command?
a) No difference
b) Syntactical difference
c) Help returns the entire set while look for returns specific commands
d) Help returns all the toolbox while look for returns a single toolbox
Answer: c
Clarification: The ‘help’ command is used to return all the commands surrounding a particular toolbox name entered along with it. The ‘look for’ command is used to return a particular function or set of functions whose name matches with the keyword entered in along with the ‘look for’ command.

6. What will the following set of commands do when they are present in a script file?

stem[y1,y2];
title(‘p’);
print -deps p

a) Plot the discrete graph of y1 and y2
b) There is no stem command in MATLAB
c) Store the graph as a separate file
d) Cannot be determined
Answer: c
Clarification: The given format of the print statement is used to store the graphs of y1 and y2 generated due to previous definitions of y1 and y2. If we only use the print command, the graph y1 and y2 will get displayed.

7. The function to close the windows containing graphs generated from MATLAB is __________
a) close all
b) close graphs
c) delete graphs
d) end all
Answer: a
Clarification: The command close all is a pre-defined function in MATLAB. When it is called, MATLAB will automatically shut down the separate windows that have been opened to view graphs separately. The rest of the options are wrong.

  250+ TOP MCQs on Logical Expressions – 2 and Answers

8. What is not displayed by the Workspace?
a) Time of variable generation
b) Standard deviation of the variable values
c) Class of the variables
d) Nature of the variables
Answer: a
Clarification: By right clicking on the Workspace header, we will get to know the characteristics of the variables which are stored in the Workspace and what it can display. The time of variable generation is not present in the Workspace. It can only be seen if the variables from the workspace are saved separately using the command ‘save filename’.

9. MATLAB allows modelling of different control systems using ___________
a) Simulink
b) Control System Toolbox
c) Not available in MATLAB as of yet
d) ezplot
Answer: a
Clarification: Simulink is a separate package which is present in MATLAB. It helps to model and analyze a control system which makes MATLAB a very powerful tool for simulating dynamic systems.

10. How to stop the execution of a chain of commands?
a) Press Ctrl +c
b) Cannot be stopped
c) Only usage of debugging mode is possible in MATLAB
d) Quit
Answer: a
Clarification: It may so happen that we want to pause the execution of a set of commands at a certain point. We only need to press Ctrl and C together to pause it. On the other hand, quit causes the MATLAB software to shut down. Debugging modes are also available in MATLAB.

11. What are MEX files in MATLAB?
a) No such thing as MEX files
b) Helps to analyse commands in MATLAB
c) Allows the user to combine C source files with Matlab files
d) Same as MAT files

Answer: c
Clarification: MEX files are one of the kinds of file modes available in MATLAB. They are saved with a .mex extension. These files help in the association of C source files into the programs written in MATLAB.

Scroll to Top