Vidyalelo
Python · all questions

Python MCQs: Bitwise and Boolean Operations Chapter
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

60

Questions

1/3

Page

Pick an option on a question to see the right answer and solution.

What is the result of 5 & 3 ?

Select an option to see the answer and solution.

What is the result of `6 | 3` ?

Select an option to see the answer and solution.

What is the result of 10 ^ 6 ?

Select an option to see the answer and solution.

What is the result of 5 << 2 >> 1 ?

Select an option to see the answer and solution.

What is the result of `(6 | 3) ^ 5` ?

Select an option to see the answer and solution.

What is the result of 7 << 2 ?

Select an option to see the answer and solution.

What will be the value of x in the following Python expression, if the result of that expression is 2?
x>>2

Select an option to see the answer and solution.

Which of the following represents the bitwise XOR operator?

Select an option to see the answer and solution.

What is the result of ~(6 & 3) ?

Select an option to see the answer and solution.

What is the result of True ^ False ?

Select an option to see the answer and solution.

The one's complement of 110010101 is:

Select an option to see the answer and solution.

What will be the output of the following Python code snippet?
not(10<20) and not(10>30)

Select an option to see the answer and solution.

What is the result of not (3 > 5) ?

Select an option to see the answer and solution.

What is the result of not (True or False) ?

Select an option to see the answer and solution.

What is the result of `5 & 9 | 1` ?

Select an option to see the answer and solution.

What is the two's complement of -44?

Select an option to see the answer and solution.

Any odd number on being AND-ed with . . . . . . . . always gives 1. Hint: Any even number on being AND-ed with this value always gives 0.

Select an option to see the answer and solution.

What will be the output of the following Python code snippet?
not(3>4)
not(1&1)

Select an option to see the answer and solution.

What will be the output of the following Python code?
l=[1, 0, 2, 0, 'hello', '', []]
list(filter(bool, l))

Select an option to see the answer and solution.

Which of the following Boolean expressions is not logically equivalent to the other three?

Select an option to see the answer and solution.