Logical Expressions – 2 MCQ’s

Electronics & Communication Engineering MATLAB

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

1. What is the output of the following code?

sin(pi)~=0

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

2. What is the output of the following code?

sin(Inf)~=NaN

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

3. ‘=’ is a?
a) Relational operator
b) Arithmetic operator
c) Operational operator
d) Assignment operator

4. What is the output of the following code?

and(sin(pi),112312)

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

5. What is the output of the following code?

log(0)==Inf

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

6. All logical operators operate on at least two operands.
a) True
b) False

7. The ~ is ______
a) Quaternary operator
b) Relational Operator
c) Arithmetic Operator
d) Unary Operator

8. What is the output of the following code?

NaN==Inf

a) 0
b) 1
c) Nan
d) Inf

9. The precedence of : operator is after | and before &.
a) True
b) False

10. What is the output of the following code?

~xor(and(1,0),~xor(and(1,0),0))

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

11. What is the output of the following code?

Sin(Inf)==NaN

a) 0
b) 1
c) Nan
d) Inf

12. The precedence of Transpose operation is ____________
a) after &
b) after |
c) before .^
d) after ^

13. All relational operators operate on _______________
a) only real part of complex numbers
b) only imaginary part of complex numbers
c) complex numbers
d) numbers which are not complex

14. What is the output of the following code?

all[1, 2, 3, NaN]

a) Error due to NaN
b) 1
c) 0
d) Syntactical Error

15. What is the output of the following code?

any([])

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

Leave a Reply

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