Docsity

Introduction to Computer Science I - Bits and Bytes - Notes | CS 110, Study notes of Computer Science

Toggle sidebar
bg1
CS 110: Introduction to Computer Science Spring 2008
Bits and Bytes
We want to speak English or some natural language to computers,
but there's really only electric currents running inside them.
Levels of Abstraction
Electric currents
0s and 1s- ON current is 1 and an OFF current is 0
Machine Lanaguage - Numbers for commands and data
Assembly Language
Some symbols allowed, e.g., Mov X,3456
Still dealing directly with machine: Refer directly to memory
cells, registers, devices, etc.
pf3

Partial preview of the text

Download Introduction to Computer Science I - Bits and Bytes - Notes | CS 110 and more Study notes Computer Science in PDF only on Docsity!

Bits and Bytes

We want to speak English or some natural language to computers, but there's really only electric currents running inside them.

Levels of Abstraction

Electric currents 0s and 1s- ON current is 1 and an OFF current is 0 Machine Lanaguage - Numbers for commands and data Assembly Language Some symbols allowed, e.g., Mov X, Still dealing directly with machine: Refer directly to memory cells, registers, devices, etc.

High-Level Language (Java, C++, Python) Symbolic and logical , with few if any direct references to addresses, registers, or other hardware components Natural Language, e.g., English

Bits to bytes, integers and strings

We have only 0s and 1s, but we want to represent numbers and characters and other data which require numerous 0s and 1s. A bit is a single 0/ A byte is 8 bits, e.g., 01010101 A word , which is used to store integers, is often 32 bits (4 bytes) To represent a positive integer, we must convert binary (the 32 bits) into decimal. We do this by assigning bit i with the value bit*2i Another way to put it is that, starting from the right most bit and going left, we assign 1,2,4,8,16,32, etc. to each bit that is 1. So 1010 is: 8+0+2+0= The decimal 155 is: