This set of MATLAB Multiple Choice Questions & Answers (MCQs) focuses 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

Explanation: 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) %

View Answer

Explanation: 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

View Answer

Explanation: 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

View Answer

Explanation: 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.

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

View Answer

Explanation: 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

View Answer

Explanation: 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

View Answer

Explanation: 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.

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

View Answer

Explanation: 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

View Answer

Explanation: 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

View Answer

Explanation: 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

View Answer

Explanation: 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.

**Sanfoundry Global Education & Learning Series – MATLAB.**

To practice all areas of MATLAB, __here is complete set of 1000+ Multiple Choice Questions and Answers__.

**Next Steps:**

- Get Free Certificate of Merit in MATLAB
- Participate in MATLAB Certification Contest
- Become a Top Ranker in MATLAB
- Take MATLAB Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

**Related Posts:**