MATLAB Questions and Answers – Spelling Error – 2

This set of MATLAB Multiple Choice Questions & Answers (MCQs) focuses on “Spelling Error – 2”.

1. What is the output of the following code?

plot([0:1:4],one(1,5))

a) A pulse function from 0 to 4 units in time
b) A step function
c) A ramp function
d) Error
View Answer

Answer: d
Explanation: The ones command isn’t completely written i.e an s is missing which leads to an error. The output would’ve been a pulse function from 0 to 4 units in time but due to this, there is an error as an output.
advertisement
advertisement

2. What is the error when MATLAB finds an unknown command or function?
a) Undefined function
b) Undefined function or variable ‘command name’
c) Undefined variable or function
d) Undefined function or variable ‘command name’
View Answer

Answer: b
Explanation: The error message shown when a command is not recognized by MATLAB is the undefined function or variable ‘command name’. This is pre-defined in MATLAB.

3. What is the output of the following code?

Note: Join free Sanfoundry classes at Telegram or Youtube
stem([0:1:1],zero(1,2))

a) An empty graph extending from 0 to 1 unit in x axis and 0 to 2 in the y axis
b) An empty graph extending from 0 to 1 unit in y axis and 0 to 2 in the x axis
c) Syntactical Error
d) Error in zero command
View Answer

Answer: d
Explanation: The zeros command isn’t fully written, an s is missing at the end and this leads to an error in MATLAB. If the ‘s’ was not missing.
advertisement

4. What is the output of the following code?

sine(pi/2)

a) Error due to pi
b) Error due to sine
c) 1
d) Cannot be determined
View Answer

Answer: b
Explanation: The output would’ve been 1 but the command to find the sine of an angle is sin() whereas we have added an extra ‘e’ in the above command. MATLAB won’t recognize this command and will give an error in the code.
advertisement

5. A user defined function can be used by neglecting case sensitivity.
a) True
b) False
View Answer

Answer: b
Explanation: A user-defined command cannot be used by neglecting case sensitivity. MATLAB won’t be able to recognize the particular m.file and if we call the function by neglecting case sensitivity, it will result in an error.

6. What is the output of the following code?

decon([6 12 18],[ 1 2 3])

a) 6
b) 0
c) Cannot be determined
d) Error
View Answer

Answer: d
Explanation: The deconv command isn’t written completely, a ‘v’ is missing at the end. If the ‘v’ was not missing, the output would’ve been 6. But here, MATLAB returns an error.

7. What is the output of the following code?

syms t;
ipulse([1],[1 0])

a) A step function
b) A ramp function
c) Logical error
d) Spelling error
View Answer

Answer: d
Explanation: The answer could’ve been a step function. But there’s a spelling error in the above code, an ‘m’ is missing- the entire command would be ‘impulse’.

8. What is the output of the following code?

syms t; 
stip([1],[1 0 0])

a) A step function
b) A ramp function
c) Logical error
d) Spelling error
View Answer

Answer: d
Explanation: There is a spelling error in the above code. The real command is ‘step’ but it has been misspelled as ‘stip’ which results in an error. If there was no error, the answer would’ve been a parabola.

9. What is the output of the following code?

laplacet(t^2);

a) Error in the input
b) Error in the command
c) 2/s^3
d) Cannot be determined
View Answer

Answer: b
Explanation: There is an error in the input since t is not defined as symbolic. But the command has been misspelled as ‘laplacet’- the t is extra and it should not be there. The answer would’ve been 2/s^3 if the command was written properly and t was defined as symbolic.

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.