Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Midterm Exam 2 Review Spring 2004: What's the underlying representation?

Comments, answers, and questions go here:

(Link back to Sp2004 Midterm 2 Review)




Internet addresses are four numbers, each of which is between 0 and 255. Does that help? Where did 256^4 come from? Mark Guzdial

i think its 2564.

ok thats supposed to be 256 times 4.

Be sure to check out the slides from the beginning of the semester that explain bits and bytes. It's in the lecture about luminance. Stephanie Weitzel

(a) If there are 32 bits, then that would mean the numbers represent 4 bytes, 1 byte for each number.

Are answers "a" and "c" in bits and the other two in bytes? Is that right?

There is one byte for each number. 8 bits make a byte, so the answer would be 32 bits in an internet address. 2^8=256 (0-255), so each number can be between 0 and 255. Is this right?
Kelli Webb

There are 32 bits in an Internet Address. 8 times 4=32; there are 8 bits, and 4 numbers(a byte for each number).
Jalencia Adams
We ask for bits for each – anyone want to answer b, c, or d? Mark Guzdial

b=2056 bits
c=24 bits
d=40 bits
(I am unsure about d. I am guessing bytes can only come in whole numbers...so you round up???)
Amelia Cipolla

b and d aren't right, Amelia. 2^x = 1024 – what's x? 2^y = 65536 (0 is one pattern) – what's y? Mark Guzdial

So these are the answers I got:
a. 32 bits
b. 16 bytes
c. 24 bits
d. 10 bytes

Are these correct?
Lindsey Richardson

I guess we've established that a) is 32 bits and that c) is 24 bits, but I'm totally confused on b and d....can anyone explain?
Summar Shoaib

the basic rule is 2^n= number of possible patterns; with n being the number of bits that it takes, and there are 8 bits in every byte.
(a)4x8=32 bits, 4 bytes
(b)2^16= 5535 patterns, so 16 bits, 2 bytes
(c) 2^8=256 patterns x 3 colors, so 24 bits, 3 bytes
(d)2^10= 1024 patterns, so 10 bits, 1.25 bytes

am I right?
Margaret McIntosh

i would concur!!!! Arseni Zaitsev

can someone explain b and d? And how they came up with them?

Way cool, Margaret! Mark Guzdial

(Your math is a little off on (b), but the argument is sound.) Mark Guzdial

Is there some way to calculate how many bits without multiplying 2 by itself until you get to the number of possible patterns? Is there a simpler formula? Maybe I need to use a better calculator.

try log of "number of patterns on base 2"... you get n = number of bits

One question about Margaret's answer. Can you have a fraction of a byte, or should the answer be rounded up?

Note that the question was number of bits. Mark Guzdial

Can anyone explain any of these responses at a more elementary level? I still don't understand this particular section. Thanks!! Karin Bowman

The question that you want to ask is "To get X number of patterns (or X-1 values), I need Y bits, where 2^Y is X." So, for example, to get 1024 patterns (assuming that index of 0 is a valid character), you solve 2^Y = 1024. Y is 10 here. So you need 10 bits. 10 bits can represent the values 0 to 1023. Make sense? Mark Guzdial


YES!!!! THANK YOU!!!!! I finally get it (and thanks too Ryan & Chris, too for also helping explain). Karin Bowman



Link to this Page