This set of MATLAB online quiz focuses on “Customizing and Manipulating Graphics – 2”.

1. What is the output of the following code?

t=[0:.1*pi:pi];plot(t,sin(t),’MarkerIndices’,1:rms(sin(t)):length(sin(t))

a) Error

b) A sinusoid

c) A half wave sinusoid marked at interval of r.m.s. values

d) A green colored sinusoid

View Answer

Explanation: The interval for marking cannot be fractional. It has to be an integer and hence the above code will result in an error.

2. The fill command cannot take more than ______ inputs.

a) 1

b) 3

c) 2

d) Many

View Answer

Explanation: The fill command ca only take 2 inputs. MATLAB will return an error if more than 2 inputs are given to the fill command.

3. What is the output of the following code?

t=0:.000001:pi;x=sin(t);y=cos(t);fill(x,y)

a) An ellipse

b) Error

c) A semi-circle

d) A sinusoid

View Answer

Explanation: One less input has been given to the fill command. The color is to be mentioned in the input of the fill command or MATLAB will give an error.

4. What is the output of the following code?

w=[0:.1*pi:2*pi];plot(w,sin(w),’ ’)

a) A sinusoid

b) A blank graph

c) Error in plot command

d) A sinusoid with a phase difference

View Answer

Explanation: The output of the above code will only be a sinusoid. The input to within the ‘’ is empty so the default style of plotting with – will be used by the plot command.

5. What does the set command do?

a) The operation of the fill command

b) The operation of changing intervals of axes

c) The operation of the plot command

d) The operation of the figure command

View Answer

Explanation: The set command can edit the graphics objects created in MATLAB. It cannot plot a graph hence it does not perform the operation of the plot, stem or the figure command.

6. What is the nature of the 2^{nd} vector input in the following command?

set( X,vector_1, vector _2 );

a) a m*n matrix where m=length( vector_1 )

b) a m*n matrix where n=length( vector_1 )

c) a m*n matrix where m>length( vector_1 )

d) a m*n matrix where n>length( vector_1 )

View Answer

Explanation: The number of rows is equal to the number of inputs given into vector 1. The number of columns is equal to the number of elements in X.

7. A semi-log graph cannot be plotted in MATLAB.

a) True

b) False

View Answer

Explanation: The scales of the axes can be converted to a linear and logarithmic scales with the set command. Hence, the above statement is false.

8. What is the output of the following code?

t=[-2:1:2];plot(t,t);ax=gca;ax.Xscale=’Logarithmic’;

a) Error

b) Syntactical error

c) A semi-log graph of a ramp function

d) A ramp function

View Answer

Explanation: The Xscale property recognizes Logarithmic as a log. Hence, there is an error in the above code while assigning the x-axis logarithmic.

9. What is the output of the following code?

t=[-2:1:2];plot(t,exp(t));ax=gca;ax.Yscale=’Log’;

a) Error

b) An exponential graph

c) A logarithmic function

d) A ramp function

View Answer

Explanation: The scale of the y-axis is changed to a logarithmic nature. But an exponential function is plotted in the y-axis and hence the graph is being approximated to a straight line which follows the interval of the input only.

10. Using the set command for axes can be replaced by setting the ___ to a variable.

a) gca

b) gcf

c) gco

d) not possible

View Answer

Explanation: The gca is used as an object to represent the axes. The properties of the axes are contained in the gca. The gca can be assigned to a variable and now we don’t have to use the set command to edit the axes of the graph. The gcf is used to represent the graph plotted.

11. What is the output of the following code?

plot([-3:1:3],[-3:1:3]);cla;

a) Error

b) A ramp function

c) A graph of a ramp function with no axes

d) A window having two axes

View Answer

Explanation: A ramp function was plotted due to the plot command. But the cla command removed all graphics object from the window containing the graph and hence the correct option is a window having two axes.

12. How many objects are created for 24 texts written in the graph?

a) 22

b) 24

c) 21

d) 2

View Answer

Explanation: The text command would be created 24 objects in the memory for 24 texts added in the graph. It will be able to access those texts and edit them.

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

To practice all areas of MATLAB for online Quizzes, __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:**