MATLAB Questions and Answers – Presenting Results

This set of MATLAB Multiple Choice Questions & Answers (MCQs) focuses on “Presenting Results”.

1. How would you plot multiple graphs in MATLAB?
a) Using the hold function
b) Using the mplot function
c) Using the mstem function
d) It cannot be done in MATLAB
View Answer

Answer: a
Explanation: The hold command is a pre-defined function in MATLAB. It allows the control to remain in the window where which was generated by MATLAB, the first time we type a command to plot any kind of graph. Then on we can plot multiple graphs on the same window.

2. How do you show the program of an MAT file?
a) The program should contain the echo command
b) The program should contain the showprog command
c) The program should contain the diary command
d) The program cannot be shown while running a MEX file
View Answer

Answer: d
Explanation: MEX files are not M-files. They are binary files which store the values of variables present in the workspace. So there is no question of showing the program of a MAT file.

3. The help command works only for a pre-defined function in MATLAB.
a) True
b) False
View Answer

Answer: a
Explanation: The help command will only show the nature of functions of any command which is already existing in the MATLAB directory. If we want to show the purpose of our written function, we have to add comments in our m-file and then enter the echo command.
advertisement
advertisement

4. What is the equivalent of subplot (1, 1, 1)?
a) subplot()
b) plot
c) It is not possible
d) axes
View Answer

Answer: d
Explanation: While using subplot (1,1,1), we have allocated memory as a 2-D matrix for only 1 graph. This is similar to the axes command which generates an empty graph. This is pre-defined in MATLAB.

5. It is not possible to store graphs as MAT-file.
a) True
b) False
View Answer

Answer: a
Explanation: MAT files save data from the workspace. A graph, plotted among different variables, cannot be stored in MATLAB since MAT-files are files used to store values from the workspace.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. The command used to reflect the files from a disk into the workspace is _______
a) load
b) show
c) disp()
d) it is not possible
View Answer

Answer: a
Explanation: The load function is pre-defined in MATLAB. It is used to load variables and/or data from the disk to the workspace.

7. The format for 5 digit representation along with exponent is __________
a) short e
b) short g
c) short exp
d) 4 digit along with exponent value can be represented
View Answer

Answer: a
Explanation: The short e format is used to represent a result with 5 digits and an exponent term. Now, this is pre-defined in MATLAB. Short g and short exp are not present in MATLAB. We cannot use a representation of 4 digits and an exponent as it is not defined in MATLAB, as of yet.
advertisement

8. Which operator is used to prevent the printing of insignificant zeros?
a) %o
b) %nz
c) %g
d) It is not possible
View Answer

Answer: c
Explanation: %g is used to represent any number, which has a fixed number of digits or a number with an exponent, with no insignificant zeros. This is present in the MATLAB directory only.

9. The function to plot a graph with both axes on logarithmic scales is __________
a) loglog
b) log
c) semilog
d) not possible
View Answer

Answer: a
Explanation: There is no command called semilog or log to plot a graph with logarithmic scales. However, we have the loglog function, pre-defined in MATLAB, which allows us to plot a graph of two variables where both the variables are scaled logarithmically.
advertisement

10. We cannot plot a discrete and continuous relationship in the same graph.
a) True
b) False
View Answer

Answer: b
Explanation: We can plot a discrete and continuous relationship in the same graph. We have to use the hold command and change the scaling of the variables a bit if at all needed, so that the discrete and continuous relationship looks prominent enough in the same graph. We have to use the hold command efficiently.

Sanfoundry Global Education & Learning Series – MATLAB.

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

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.