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

3/3

Page

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

What is the result of not True ?

Select an option to see the answer and solution.

What will be the output of the following Python code?
['f', 't'][bool('spam')]

Select an option to see the answer and solution.

What will be the output of the following Python expression?
0x35 | 0x75

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 output of the following Python expression if x=15 and y=12?
x & y

Select an option to see the answer and solution.

What is the result of 5 ^ 5 ?

Select an option to see the answer and solution.

What will be the output of the following Python expression?
int(1011)?

Select an option to see the answer and solution.

What will be the output of the following Python expression?
bin(29)

Select an option to see the answer and solution.

To find the decimal value of 1111, that is 15, we can use the function:

Select an option to see the answer and solution.

What is the result of 9 ^ (5 & 3) ?

Select an option to see the answer and solution.

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

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 `12 | 10 & 9` ?

Select an option to see the answer and solution.

It is not possible for the two's complement value to be equal to the original value in any case.

Select an option to see the answer and solution.

Bitwise . . . . . . . . gives 1 if either of the bits is 1 and 0 when both of the bits are 1.

Select an option to see the answer and solution.

What is the result of 5 & 6 ^ 6 ?

Select an option to see the answer and solution.

What is the result of 12 >> 2 ?

Select an option to see the answer and solution.

What is the result of `10 & 5 | 5` ?

Select an option to see the answer and solution.

What will be the output of the following Python code?
class Truth:
	pass
x=Truth()
bool(x)

Select an option to see the answer and solution.

What will be the output of the following Python expression?
~100?

Select an option to see the answer and solution.