Q. Logical Operators' practice (Interactive mode)


x = 29.0, y = 13, z = 2, p = 0.5, q = 12.79, i = 13, j = 29.0, k = y – 11, a = ''(empty string), b = '', c = 'great', d = 'Great', e = 'GREAT', f = 'Great', g = 'GREAT', h = ' great', l = (3 + 4.5j), m = (3 + 4.5j)

 
S. No. Expression Result Reason
1 x > y and y > z
2 x > y or y > z
3 not x > y
4 not x > y or y > z
5 not (x > y or y > z)
6 x - y * 2 > y * 2 or y * p > y
7 x - y * 2 > y * 2 and y * p > y
8 not x - y * 2 > y *2 and y * p > y
9 not (x - y * 2 > y *2 and y * p > y)
10 x - y * 2 > y * 2 and not y * p > y
11 x - y * 2 > y * 2 or not y * p > y
12 x > y > z
13 i < j > k
14 y & z
15 y | z
16 y ^ z
17 ~ y

Answer :-


 
S. No. Expression Result Reason
1 x > y and y > z True If both are true then and operator return True.
2 x > y or y > z True If both are true then or operator return True.
3 not x > y False not operator return opposite of answer.
4 not x > y or y > z True If one of them is True then or operator return True
5 not (x > y or y > z) False not operator return opposite of answer.
6 x - y * 2 > y * 2 or y * p > y False We should know the precedence order of operators.
7 x - y * 2 > y * 2 and y * p > y False We should know the precedence order of operators.
8 not x - y * 2 > y *2 and y * p > y False If both are not true then and operator return False.
9 not (x - y * 2 > y *2 and y * p > y) True not operator return opposite of answer.
10 x - y * 2 > y * 2 and not y * p > y False We should know the precedence order of operators.
11 x - y * 2 > y * 2 or not y * p > y True If one of them is True then or operator return True
12 x > y > z True If all condition is True then it will return True.
13 i < j > k True If all condition is True then it will return True.
14 y & z
15 y | z
16 y ^ z
17 ~ y

6 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. bro, where's 14, 15, 16, 17's answers

    ReplyDelete
  2. Ans of 14 to 17

    ReplyDelete
  3. Can I get the answers of 14 to 17 questions please....And also thanks for the given answers,those were really very helpful to me😊

    ReplyDelete
  4. 14,15,16,17 where r the answers... Only questions...

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post