Reputation: 61
I was doing TryHackMe and I encountered this question. I got this answer by looking through some help from the TryHackMe forum but I could not find an explanation to why 16 is the shorthand for base 2?
Can someone explain to me why 16 is the correct answer in this case but not Base 8?
Thank you for your help
Upvotes: 4
Views: 24169
Reputation: 1
Let's see how it works with an example,
Consider a decimal value of 777.
If you convert it into binary ,it would be 1100001001.
Imagine you are in need to pass this binary message to one of your friend. But unfortunately the platform through which you are sending doesn't allow more than 3 character to be sent at a time.Neither you cannot send raw data as it is.
In that case,Hexadecimal representation of 1100001001 would be 309. Thus it allows us to send the binary data in shorthand[here 309 is shorthand of 1100001001].
So base 16 is a shorthand of base 2.
Upvotes: 0
Reputation: 51
Hexidecimal is used extensively as a shorthand for binary. Because it is base 16 with 16 being a power of 2, conversion from binary to hex is clean. All the possible values in a 4 digit binary number can be represented by a 1 digit hex number using all its possible values. A 4 digit binary number can represent values 0-15 (decimal), and a 1 digit hex number can represent values 0-15 (decimal).
To convert from binary to hex, so can use the same process, but the numbers being multiplied and added need to be hex numbers. For example, 10010b = 124 + 023 + 022 + 121 + 020 = 110 + 08 + 04 + 12 + 01 = 0x12. Note that each number is in hex, and the first term, 110, would be 116 in decimal.
In practice, I think most folks convert from binary to decimal and then from decimal to hex. Something like: 10010b has a 16 plus a 2 which is 18. That’s more than 16 and less than 32, so the second position has a 1 which is 16 leaving 2, so 0x12 is the answer.
Source:- https://practicalee.com/binary/
I had the same question n this is what I found! hope it helps.
Upvotes: 5
Reputation: 1
Binary is base 2 and uses just 0 and 1 We also use hexidecimal, which is base 16, but this is really just used as shorthand for binary as you will see.
Upvotes: -3
Reputation: 21
I got off on the wrong foot on this one.
So a binary number can be represented as 110011, for example (base 2). In reality, you would not use that. People use either octal or hex. So the question becomes: which one is the most common, and how would you name it?
Upvotes: 1
Reputation: 1
The way they've phrased the question makes it look like any numbering system could be a possible answer.
Base 16 would be better because you can represent 4 binary digits using a single hexadecimal digit whereas one octal digit can represent 3 binary digits.
Therefore you can represent large number of values using fewer hexadecimal digits.
Upvotes: 0