What is the difference between binary and decimal numbers?
Binary numbers use only two digits (0 and 1) and represent values in base-2, while decimal numbers use ten digits (0-9) and represent values in base-10. Binary is the fundamental language of computers.
How do I convert a decimal number to binary?
To convert decimal to binary, repeatedly divide the number by 2 and record the remainders in reverse order. For example, 13 in decimal is 1101 in binary (13 ÷ 2 = 6 remainder 1, 6 ÷ 2 = 3 remainder 0, 3 ÷ 2 = 1 remainder 1, 1 ÷ 2 = 0 remainder 1).
What are bitwise operations?
Bitwise operations perform calculations on individual bits of binary numbers. Common operations include AND, OR, XOR, and NOT. These are fundamental in computer programming and digital electronics.
Why do computers use binary?
Computers use binary because electronic circuits can easily represent two states (on/off, high/low voltage). Binary is also mathematically efficient for digital logic operations and error detection.
What is hexadecimal and why is it used?
Hexadecimal is a base-16 number system using digits 0-9 and letters A-F. It's commonly used in programming because it's more compact than binary (4 binary digits = 1 hexadecimal digit) and easier to read.