JavaScript isn't enabled in your browser, so this file can't be opened. Enable and reload.
Python Binary Type Quiz
There are
20 questions based on Python
Binary
Type Quiz.
Sign in to Google
to save your progress.
Learn more
* Indicates required question
Q1. Which method converts a decimal number to binary in Python?
*
4 points
bin()
binary()
toBinary()
binaryConvert()tion 1
Q2. What is the output of bin(10)?
*
4 points
10
0b10
0b1010
1010
Q3. What does the prefix 0b indicate in Python?
*
4 points
Decimal Number
Binary Number
Hexadecimal Number
Octal Number
Q4. How do you represent the binary number 1011 in Python?
*
4 points
0b1011
1011b
bin(1011)
binary1011
Q5. Which of the following operations is valid for binary literals in Python?
*
4 points
Addition
Subtraction
Bitwise AND
All of the above
Q6. What will 0b110 & 0b101 return?
*
4 points
0b110
0b100
0b101
0b111
Q7. How can you left-shift a binary number in Python?
*
4 points
Using <<
Using >>
Using shiftLeft()
Using rotateLeft()
Q8. What is the result of 0b1101 >> 2?
*
4 points
0b11
0b1101
0b10
0b1
Q9. Which function is used to convert binary to decimal?
*
4 points
bin()
int()
toDecimal()
convertToDecimal()
Q10. What does ~0b1010 evaluate to?
*
4 points
-0b1010
0b0101
-0b1011
0b1111
Q11. Which operator is used for bitwise OR in Python?
*
4 points
&
|
^
~
Q12. What is the binary representation of the integer 15?
*
4 points
0b1111
0b1010
0b1001
0b1101
Q13. What does the ^ operator do in binary operations?
*
4 points
Logical AND
Logical OR
Bitwise XOR
Bitwise NOT
Q14. How do you represent the octal number 17 in Python?
*
4 points
017
0o17
17oct
oct17
Q15. What is the output of int('101', 2)?
*
4 points
5
101
2
10
Q16. What will bin(0b1010 | 0b0110) return?
*
4 points
0b1110
0b0110
0b1010
0b1000
Q17. Which bitwise operation is used to flip all bits in Python?
*
4 points
XOR
NOT
AND
OR
Q18. How do you right-shift 0b1001 by 1 in Python?
*
4 points
0b100
0b0100
0b0001
0b0010
Q19. What will bin(0b1100 ^ 0b1010) return?
*
4 points
0b0110
0b1110
0b0101
0b0011
Q20. What is the result of int('111', 2) + int('1', 2)?
*
4 points
4
8
7
2
Submit
Clear form
Forms
This content is neither created nor endorsed by Google.
Report Abuse
Terms of Service
Privacy Policy
Help and feedback
Contact form owner
Help Forms improve
Report