CPSC 110-08: Computing on Mobile Phones
Spring 2012

Homework: Powers of Two
Due: Friday 2/3 (before class)

CS Principles

This activity addresses the concept of abstraction. It focuses, in part, on the following learning objectives:

Introduction

This topic was covered in class on Monday.

Representing Things with Bits (Binary Strings)

A byte is an 8-bit sequence. Historially an 8-bit byte was used to represent a single character in computer memory.

The length of a binary sequence -- a sequence of 0s and 1s -- determines the number of different sequences that can be generated and therefore the number of different things that can be represented by such a sequence.

For example, with 1 bit, you can have two different sequences, 0 or 1, which can stand for two different colors, say, 0 stands for white and 1 for black. With 2 bits, you can have four different sequences, 00, 01, 10, or 11, which can represent four different colors, white, black, red, green. And so on.

In general, an n-bit sequence can represent 2n different things. Here's how:

Number of bitsNumber of thingsRepresentations
12 (i.e., 21)0, 1
24 (i.e., 22)00, 01, 10, 11
38 (i.e., 23)000, 001, 010, 011, 100, 101, 110, 111
416 (i.e., 24)0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111
532 (i.e., 25)  
664 (i.e., 26)  
7128 (i.e., 27)  
8256 (i.e., 28)  

Quiz Yourself

To see if you understand these concepts, try the following quizzes. If you can get ten-in-a-row correct, that's a pretty good indication that you get it.

Getting Help

The TAs are available on Sunday, Tuesday, and Thursday evenings in MCEC 136. See the syllabus for their hours.

In Class on Friday

We will have a quiz on this material.