Parts in this series

Part 4: Binary, bits, and bytes

This is part 4 of my series on the order to study topics related to programming. This series aims to give people a gentle path to follow in order to be able to dabble in this field. It is oriented toward people who are easily frustrated and therefore give up quickly.

In the first three parts of this series, I covered Markdown, HTML, and SQL. These are all good stepping stones to become familiar with how different syntaxes have specific effects. Hopefully this guided tour has been gentle enough that you are eager to start with your first “real” programming language.

You’ll start that in part 5, but in order to reduce some confusion once you get there, I suggest you do a little theoretical research to become familiar with the idea of binary numbers and how they relate to each other.

This is a short post, and the research should probably only take a few hours of your time. You do not need a deep understanding of these concepts to program effectively, but you do need a vague idea of what’s going on in your processor.

I’m going to structure this post like a virtual scavenger hunt. I’ll give you a series of questions to answer, and you’ll have to come up with the appropriate web searches to answer them. Being able to effectively search for information is an incredibly valuable skill to be an effective programmer. If you know how to find stuff quickly, you don’t need to memorize it!

Most of these questions can be answered using Wikipedia, but obviously your favourite search engine might come up with sites that provide more approachable information.

I also suggest you start getting familiar with Stack Overflow a question and answer community for technical questions. Programming is sometimes jokingly described as “copy-pasting code from Stack Overflow”. All programmers search for answers to their questions on Stack Overflow (or follow links to Stack Overflow from a seach engine result); it’s not just for beginners.

I want to make this very clear: You are not a failure as a programmer if you have to look concepts up, even concepts that you have studied in the past. We all do it, every day. My only regret is that Stack Overflow wasn’t available when I first started programming (I didn’t even have Internet access… I have no idea how I managed to learn anything at all).

The questions

Here’s the list of questions. This isn’t a quiz to see what you know, it’s just hints for things that it will be beneficial to know:

  • What is a binary number?
  • How do you convert a binary number to a “normal” (base 10) integer?
  • How do you add or subtract two binary numbers?
  • What is a bit?
  • What is a byte?
  • What are the powers of two up to 212?
  • What is ASCII?
  • What integers are used to represent the phrase “Hello World” in ASCII?
  • Instead of integers, what is the binary representation of “Hello World”?
  • What is a space in ASCII?
  • What are octal numbers?
  • What are hexadecimal numbers?
  • What is the integer number 42 in:
    • Binary
    • Octal
    • Hexadecimal
    • ASCII
  • How are colours represented in binary numbers?
  • What colour is the hexadecimal value #FF0000?
  • What is a boolean value in programming?

For bonus points

These ones are a bit tricky, and the answers can go pretty deep. You can totally skip any or all of them without losing anything. If you do choose to answer them, just find a quick shallow answer, don’t get stuck in the rabbit hole.

  • What is a floating point value?
  • What do the acronyms CPU, ALU, GPU, and RAM actually mean?
  • Why is unicode better than ASCII?
  • What is meant by “little-endian” and “big-endian”?