Why do we need binary code and hexadecimal in computer science?
In computer science class we are taking a test about coding, but I don't understand what it has to do with computer science.
In computer science class we are taking a test about coding, but I don't understand what it has to do with computer science.
Binary code is needed because that's exactly what the PC works with. It's simply a lot of charged and uncharged capacitors that form the memory, and a lot of transistors that only know "power on" or "power off."
The hexadecimal system is simply the abbreviated version of the binary system because it is much easier to remember, for example, 03 E8 than 00000011 11101000.
A hexadecimal digit simply represents four binary digits. In the past, the "octal system" was often used for this, meaning three binary digits combined to form a number between 0 and 7. However, hex numbers have the advantage that two hex digits are exactly one byte. With the octal system, one bit is always left over.
It doesn't matter which system you use to represent numbers—whether it's our well-known decimal system, binary, octal, hexadecimal, or something else. You can even calculate with emojis if you first define the value of the individual symbols. Digital technology essentially only has two states: current flowing, current not flowing, zero, or one. But you can represent any number in any number system, regardless of the base.
Binary code is needed, for example, to understand subnetting in network technology. It also helps with understanding how to determine storage sizes and data transfer rates.
The hexadecimal representation is a convenient, compact representation for bytes. While it's not actually needed, it's often used for compactly defining colors in HTML or for displaying binary files when characters are involved that don't have a visual representation, such as the "up arrow" or "backspace."
In the end, binary code and hexadecimal code are more advantageous in terms of representation because they are chosen to match the technology concept (on/off, current flows/current does not flow, 0/1) and it is very easy to switch between the representations without having unnecessary data overhang.
Hexa is primarily used for IPv6 and other applications. Binary is used because computers only recognize two numbers: 0 and 1.
In other words, if you only had 2 fingers, you would come up with such a number system all by yourself 🙂
You don't understand what binary code or hexadecimal has to do with computers?
You're not serious.
A computer only knows 0 and 1
This is a binary number.
If you want to save this you speak of 1 bit
8 bits are combined to 1 byte
Larger units are grouped into 16Bit / 32Bit / 64Bit
For the computer, sequences of numbers with, for example, 32 ones and zeros are no problem!
Therefore, they are simplified using hexadecimal numbers.
They become shorter and more manageable for people
So of course you also need this information when, for example, memory is addressed, data is saved or hardware is controlled.
Without ones and zeros, no computer can function.
While they are working on computers that work with light, for example, and are supposed to have more than two states at once, they are probably still working with multiples of 2, so hexadecimal will likely continue to be used there.
Maybe someone will invent a computer with a decimal system.
Then you can use your fingers to count again. And your usual decimal numbers
But since this would have no real advantage, it is unlikely to happen.
When it comes to storage alone, the dual system will have to remain.
If a memory gets one more address line, it can generate twice as many addresses.
Technically conditioned binary system
Then you haven't heard much about computer science yet.
Because computers can only process data with binary code "out (value = zero)" and in (value = 1). All data elements are processed and stored this way; data input and output must be converted from human-readable characters to binary characters, or from binary characters to human-readable characters (decimal and alphabetic). Hexadecimal representation is used to compress binary representation.
When I was at school in the 1970s, we had to learn the binary and hexadecimal systems and other number systems even in elementary school math classes because back then, people correctly predicted that we would all have to work with computers in the future, and "wrongly predicted" that we would all have to master the binary and/or hexadecimal systems because computers don't understand anything else.
Hexadecimal
Decimal
Binary
and their transformations into each other, you constantly broke in computer science.
(Why are distances expressed in the speed of light when there are km).
When you get older, you can convert your age to hexadecimal numbers. "I'm 32" sounds better than "I'm 50."
A misconception is that some people think 32hex is pronounced "thirty-two hex".