MATLAB Multiple Choice Questions on “Fine Tuning”.
1. How will one escape from printing graphs of variables, whose value gets changed for the program?
a) Use the clear all command at the beginning
b) Use the close all command at the beginning
c) Use the clc command
d) Cannot be escaped
Answer: a
Clarification: The clear all command keeps all the local variables of the function unaffected i.e. they prevent their values from getting changed due to some previous usage of the function. The close all command closes all the graphs the clc command removes the written code.
2. A loop is used to avoid repetitive writing of the same function in the code.
a) True
b) False
Answer: a
Clarification: The purpose of using loops is to avoid writing the same line multiple times. The same line may be a particular function which computes a certain value. For the sake of accuracy, we may run the function multiple times, within a loop.
3. How will you return to execution from debugging mode?
a) Use the dbcont command
b) Use the return command
c) Use the dbcont & return command
d) Use the keyboard command
Answer: c
Clarification: While debugging, the user can choose to insert a set of instruction to change the nature of the already written program. To return to continue execution, the user can enter either dbcont or the return command.
4. The plotting of 3d plots and 2d plots requires separate windows. But the user has entered the hold on command. What is to be done?
a) Use the pause command
b) Use the hold off command
c) Use the close command
d) Nothing can be done
Answer: a
Clarification: The hold off command is necessary to plot multiple graphs in the same window. Thus multiple 2d graphs or multiple 3d graphs can be drawn on the same window. But the pause command is used to keep the plot of 2d graphs and wait before generating 3d graphs. The close command closes any existing graphs.
5. What will be the output of the following code?
T=-5:1:5; y=sin(T); plot(T,y)
a) No output
b) A perfect sine curve
c) A broken sine curve
d) Cannot be determined
Answer: c
Clarification: The sine curve is a continuous signal or a discrete signal. So the tendency of every point in the curve has to follow a radian frequency and not a step frequency. Here the frequency of time is stepping up by 1, so the sine curve will only consist of 11 values, which will lead to the sine curve appearing to be broken.
Output:
