01 Introduction To Computers and Programming Repetition
01 Introduction To Computers and Programming Repetition
1
How Computers Store Data
• All data in a computer is stored in sequences of 0s and 1s
• Byte: just enough memory to store letter or small number
– Divided into eight bits
– Bit: electrical component that can hold positive or negative charge, like on/off switch
– The on/off pattern of bits in a byte represents data stored in the byte
2
Counting
3
Storing Characters - Character Sets
• Data stored in computer must be stored as binary number
• Characters are converted to numeric code, numeric code stored in memory
– Most important coding scheme is ASCII
∗ ASCII is limited: defines codes for only 128 characters
– Unicode coding scheme becoming standard
∗ Compatible with ASCII
∗ Can represent characters for other languages
High-Level Languages
• Low-level language: close in nature to machine language
– Example: assembly language
• High-Level language: allows simple creation of powerful and complex programs
– No need to know how CPU works or write large number of instructions
– More intuitive to understand
4
Key Words, Operators, and Syntax: an Overview
• Key words: predefined words used to write program in high-level language
– Each key word has specific meaning
• Operators: perform operations on data
– Example Addition +
∗ 12 + 12
– Example Assignment =
∗ magic_number = 42
• Syntax: set of rules to be followed when writing program
• Statement: individual instruction used in high-level language