Suppressing Output

MATLAB

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

1. Graphs are not suppressed by the ‘;’.
a) True
b) False

2. What will be the output of the following code?

close all;
for x = 1.5 : .5 : 2;
y=3; 
x=y+3
 clc
end

a) No value will be stored
b) The result will be printed
c) The result will be printed twice but no value will remain in the Workspace
d) The loop will not run

3. What will be the output of the following code?

for i = 1 :4: 5
y=i+1
clear i
end

a) y=5; i=2
b) y=5, printed twice
c) Loop will run once, y=2
d) Infinite loop





4. Clear will removes all graphs.
a) True
b) False

5. What will be the output of the following code?

for i=1 : 3
i=i-1
end

a) i will be printed thrice as 0,1,2 successively
b) Infinite loop
c) No output
d) i=2

6. How can we close all graphs in MATLAB?
a) Using the close command
b) Using the clear all command
c) Using the close all command
d) Using the clear command

7. clc in a function will clear the function.
a) True
b) False

8. What will be the output of the following code?

for i = 1 : 1
p=i-1
i=i+1;
clc
end

a) i=2
b) p will be printed
c) Error
d) Cannot be determined

9. ___________ will give a hint that the file is closed.
a) Fopen
b) Fclose
c) Gclose
d) clc

10. To delete one variable but not the entire workspace, we need to mention the variable name after the clear command.
a) True
b) False

Leave a Reply

Your email address will not be published. Required fields are marked *