# Syntax Error – 2 MCQ’s

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

1. What is the final value of i?

```for i=[1:10]
end```

a) 0
b) 1
c) Error
d) 10

```syms p q;
x=p+2q;
findsym[x]```

a) Syntactical Error
b) p,q
c) No such command
d) p

3. What is the output of the following code?

```for ( i=1:10 )
if{i<3}
break
end
end```

a) Syntactical Error
b) Logical Error
c) i=1
d) i=2

4. What is the output of the following code?

`solve[‘x^2+1=0’]`

a) x=j,-j
b) x=+i,-i
c) Syntactical Error
d) Logical Error

5. What is the output of the following code?

```syms p q;
x=p+2*q;
diff[x];```

a) 1
b) 0
c) Syntactical Error
d) Logical Error

6. What is the output of the following code?

```syms pi;
p=2sin[pi]/cos[pi] + tan[3pi];```

a) 0
b) A value very close to 0
c) Syntactical Error
d) Error in the expression

7. Vectors defined by [] can be cellular vectors.
a) True
b) False

8. What is the output of the following code?

`tf2zp({1 2}, {2 1})`

a) 0
b) Returns the zeros and poles of the transfer function (s+2)/(2s+1)
c) Syntactical Error
d) Logical Error

9. What is the output of the following code?

`syms [p,q]`

a) Establishes p and q as symbolic variables
b) Syntactical Error
c) Logical Error
d) Only p is symbolically defined

10. What is the output of the following code?

`error{“404”}`

a) 404
b) Error in the command
c) Error 404
d) Syntactical Error

11. What is the output of the following code?

`syms ‘t’,’p’;`

a) Both t and p are defined as symbolic
b) Only t gets defined as symbolic
c) Only p gets defined as symbolic
d) Nothing happens

12. What is the output of the following code?

`warning(“a”)`

a) Warning: a
b) Error in the code
c) Syntactical Error
d) Logical Error

13. What is the output of the following code?

`poly{1,2}`

a) Syntactical Error
b) 1 3 2
c) Cannot be determined
d) 0 5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%