# 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

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.
Note: Join free Sanfoundry classes at Telegram or Youtube

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’

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?

Take MATLAB Mock Tests - Chapterwise!
Start the Test Now: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
`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

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.

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

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.

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

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

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 0])```

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

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 0 0])```

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

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

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. 