## MATLAB Questions and Answers Part-4

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

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

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

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.

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

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

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.

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

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

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.

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

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