CommerceBitwise And Boolean MCQs
Practice Bitwise And Boolean MCQs for competitive exams.
Bitwise And Boolean MCQs
Practice questions from this topic.
Which of the following expressions can be used to multiply a given number 'a' by 4?
- A. a<<2
- B. a<<4
- C. a>>2
- D. a>>4
Correct Answer: A
What will be the output of the following Python expression? 4^12
- A. 2
- B. 4
- C. 8
- D. 12
Correct Answer: C
What will be the output of the following Python code? if (9 < 0) and (0 0) or False: print("good") else: print("bad")
- A. error
- B. hello
- C. good
- D. bad
Correct Answer: C
What will be the output of the following Python code snippet? ['hello', 'morning'][bool('')]
- A. error
- B. no output
- C. hello
- D. morning
Correct Answer: C
What will be the value of the following Python expression? bin(10-2)+bin(12^4)
- A. 0b10000
- B. 0b10001000
- C. 0b1000b1000
- D. 0b10000b1000
Correct Answer: D
What is the value of the following Python expression? bin(0x8)
- A. '0bx1000'
- B. 8
- C. 1000
- D. '0b1000'
Correct Answer: D
What is the result of `(8 >> 2) | (1 << 2)` ?
- A. 10
- B. 5
- C. 9
- D. 4
Correct Answer: A
What will be the output of the following Python code if the system date is 21st June, 2017 (Wednesday)? [] or {} {} or []
- A. [] {}
- B. [] []
- C. {} []
- D. {} {}
Correct Answer: C
What is the result of `(4 | 2) & 6` ?
- A. 0
- B. 6
- C. 2
- D. 4
Correct Answer: C
Which of the following Boolean expressions is not logically equivalent to the other three?
- A. not(-610)
- B. -6>=0 and -6<=10
- C. not(-6<10 or-6==10)
- D. not(-6>10 or-6==10)
Correct Answer: D
What will be the output of the following Python code snippet? not(3>4) not(1&1)
- A. True True
- B. True False
- C. False True
- D. False False
Correct Answer: B
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.
- A. 10
- B. 2
- C. 1
- D. 0
Correct Answer: C