Logical Expressions – 2 MCQ’s

Read Time:1 Minute, 21 Second

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

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

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

Previous post Logical Expressions – 1 MCQ’s
Next post More about Loops – 1 MCQ’s