0% found this document useful (0 votes)
56 views6 pages

CS Unit 1

Bit patterns are used to represent various types of information like numbers, images, and text in computing systems. Boolean logic uses 0s and 1s to represent true/false values in operations like AND, OR, and XOR. Gates are electronic circuits that perform basic Boolean operations and form the building blocks of computers. Memory uses bit patterns stored in cells that can be randomly accessed by address. Mass storage like disks and flash drives supplement main memory with larger but slower storage. Various encoding schemes exist to represent different data types as bit patterns, such as ASCII for text, binary for numbers, and sampling for sound. Programming languages allow users to manipulate and process digital information stored as bit patterns.

Uploaded by

mcgowinamazon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views6 pages

CS Unit 1

Bit patterns are used to represent various types of information like numbers, images, and text in computing systems. Boolean logic uses 0s and 1s to represent true/false values in operations like AND, OR, and XOR. Gates are electronic circuits that perform basic Boolean operations and form the building blocks of computers. Memory uses bit patterns stored in cells that can be randomly accessed by address. Mass storage like disks and flash drives supplement main memory with larger but slower storage. Various encoding schemes exist to represent different data types as bit patterns, such as ASCII for text, binary for numbers, and sampling for sound. Programming languages allow users to manipulate and process digital information stored as bit patterns.

Uploaded by

mcgowinamazon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Bit: Binary Digit

Bit patterns are used to represent information


- Numbers
- Images

Boolean Operation: An operation that manipulates one or more true/false values


Specific operations
- AND: if there is a 0 (false), the output is false
- OR: always chooses the 1 (true)
- XOR
- NOT
- 0 = False
- 1 = True

0 0 1 1
AND 0 AND 1 AND 0 AND 1
--------- --------- --------- ---------
0 0 0 1
_________________________________________________________

0 0 1 1
OR 0 OR 1 OR 0 OR 1
--------- --------- --------- ---------
0 1 1 1
_________________________________________________________

0 0 1 1
XOR 0 XOR 1 XOR 0 XOR 1
--------- --------- --------- ---------
0 1 1 0
_________________________________________________________

Gate: a device that computes a Boolean operation


- Often implemented as small electronic circuits called transistors
- Can be constructed from a variety of other technologies
- Provide the building blocks from which computers are constructed
Flip-flops
● Circuits builts from gates that act as a fundamental unit of computer memory
○ One input line is used to set its store value at 1
○ One input line is used to set its store value at 0
○ While both input lines are 0, the most recently stored value is preserved

Hexadeciaml Notation
● A shorthand notation for long bit patterns
○ Divides a pattern into groups of four bits each
○ Represents each group by a single symbol
● Example: 1011 0101 ceomes 0xB5

Main Memory
● Cell: a unit of main memory (typically 8 bits which is one byte)
○ Most significant bit: the bit at the left (high order) end
○ Least significant bit: the bit at the right (low order) end
● Address: a “name” that uniquely identifies one cell in the computer’s main memory
○ The names are actually numbers
○ These numbers are assigned consecutively starting at zero
○ Numbering the cells in this manner associates an order with the memory cells
● Random Access Memory (RAM): Memory in which individual cells can be easily accessed in
any order
● Dynamic Memory (DRAM): RAM composed of volatile memory
Additional Mass Storages
● Magnetic Disks
● CDs
● DVDs
● Magnetic Tapes
● Flash Drives
● Solid-state Drives
Advantages over main memory
● Less volatility
● Larger storage capacities
● Low cost
● In many cases can be be removed
Mass Storage Performance
● Bandwidth: The total amount of bits that can be transferred in a unit of time
● Latency: The total time between the request for data transfer and its arrival
Hard Disks
● The hard disk arms nive the read/write head, which reads items and writes items in the drive
○ Location often is referred ti by its cylinder
● A head crash occurs when a read/write head touches the surface of a platter
● Always keep a backup of your hard disk
Flash Drives
● Flash Memory - circuits thats traps electrons in tiny silicon dioxide chambers
● Repeated erasing slowly damages the media
● Mass storage of choice for:
○ Digital cameras
○ Smartphones
● SD Cards provide GBs of storage
Representing Information as Bit Patterns
Many different kidns of information can be encoded as bit patterns
Systems for encoding information have been established for
● Text
● Numeric Data
● Sound
● Images
● Other Data
Representing Text
● Each character (letter, punctuation, etc.) is assigned a unique bit pattern
○ ASCII: uses patterns of 7-bits to represent most symbols used in written English text
○ ISO developed a number of 8 bit extensions to ASCII, each designed to accommodate a
major language group
○ Unicode: uses patterns up to 21-bits to represent the symbols the symbols used in
languages world wide, 16-bits for world’s commonly usde languages
Representing Numeric Values
● Binary Notation: uses bits to represent a number stored in sequences of 0s and 1s
● Counting from 0 to 8:
○ 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000
Representing Images
● Bit map techniques
○ Pixel: “picture element” represents one dot
○ RGB: Red, green, blue components
○ Luminance and chrominance
○ Problems with scaling up images
● Vector techniques
○ Represent images with geometric structs
○ Scakabke
○ TrueType and PostScript
Representing Sound
● Sampling techniques that record actual audio
○ Long-distance telephone: 8000 samples/sec
○ CD sound: 44,100 samples/sec
● MIDI stores directions for making sound
○ Used in music synthesizers
○ Encodes which instrument, note, and duration

Storing Integers
● Two’s complement notation: The most popular means of representing integer values
● Excess notation: Another means of representing integer values
The Problem of Overflow
● There is a limit to the size of the values that cna be represented in any system
● Overflow
○ Occurs when a computation produces a value that falls outside the range of values that
can be represented in the machine
○ If the resulting sign bit is incorrect, an overflow has occurred
○ 16 bit systems have been upgrades to 32 bit systems
Storing Fractions
● Floating-point Notation: consists of a sign bit, a mantissa field, and an exponent field
○ Normalized form: fill the mantissa starting with the left-most 1
2 5/8
10.101
1010 1 ------> "Lost Bit"
0 110 1010

Python: a popular programming language for applications, scientific computation, and as an introductory
language for students
An interpreted language
- Typing
print('Hello, World!')
- Results
Hello, world!
Variables: name values for later use
Analogous to mathematic variables in algebra
s = 'Hello, world!'
print(s)
my_integer = s
my_floating_point = 26.2
my_Boolean = True

my_sting = 'characters'
my_integer = 0xff
Operators and Expressions
print(3 + 4) #Prints 7
print(5 - 6) #Prints -1
print(7 * 8) #Prints 56
print(45 / 4) #Prints 11.25
print(2 ** 10) #Prints 1024

s = 'hello' + 'world'
s=s*4
print(s)

Currency Converstion
# A converter for currency exchange
USD_to_GBP = 0.66 #Today's exchange rate
GBP_sign = '\u00A3' #Unicode value for E
dollars = 1000 #Number dollars to convert

#Conversion Calculations
pounds = dollars *USD_to_GBP

#Printing the results


print('Today, $' +str(dollars))
print('converts to ' + GBP_sign + str(pounds))

Debugging
Syntax errors
print(5 +)
SyntaxError: invalid syntax
pront(5)
NameError: name 'pront' is not defined
Semantic Errors
Incorrect expressions like
total_pay = 40 + extra_hours * pay_rate
Runtime Errors
Unintentional divide by zero

Data Compression
Lossy versus lossless
Run-length encoding
Frequency-depending encoding
(Huffman codes)
Relative encoding
Differential Encoding
Dictionary encodings (Includes adaptive dictionary encoding such as LZW encoding)

Communication Errors
Goal: to reduce errors and increase the reliability of computing equipment
Parity bits (even versus odd)
Checkbytes
Error correcting codes
Hamming Distance

You might also like