Chapter 1, 2, 3 Flashcards
(88 cards)
A set of instructions that a computer follows to perform a task
Program
Alternate Names:
- Software (e.g. Microsoft Word and PPT)
What does a computer’s hardware include?
- CPU (microprocessors)
- RAM (main memory)
- Secondary Storage Devices (e.g. traditional disk drives, solid-state drives) => internal to the computer
- External Storage Devices
- Input devices (e.g. keyboard, mouse, camera, scanner)
- Output devices (printer, displays, monitors, disk drives)
What is the CPU’s function
to RUN or EXECUTE programs
- most important component in a computer
- need to be told what to do via programs written in machine language
What is the RAM’s function?
What is the physical device called?
Is it permanent storage?
Random-Access Memory
- computer’s “work area”
- volatile type of memory for TEMPORARY STORAGE WHILE the program is running
- contents of RAM are erased when your computer is turned off
- Stored as memory chips
What types of Software exist?
Definitions of each?
- SYSTEM Software: Control and manage the BASIC OPERATIONS of a computer
- Operating System (controls INTERNAL OPERATIONS of computer’s hardware, manages all connected devices, and allows other programs to run on the computer)
- Utility Programs (specialized tasks to enhance computer’s operations or safeguard data, like virus scanners, file compression programs)
- Software Development Tools (assemblers, compilers, and interpreters) for programmers to create, modify and test software
- Application Software: programs that make the computer USEFUL for everyday tasks
e. g. Chrome, Word, PPT, excel, games
How do computers store data?
Data is stored in a sequence of 0s and 1s, called Machine Language (binary numbers)
Stored in locations called BYTES (8 bits)
- bits = on and off switches (binary digit)
- characters (letters, punctuation marks) are CONVERTED to decimal value, then CONVERTED to binary and stored
How do you convert a decimal number to Binary?
e.g. 79
Binary structure:
- base 2
- Right to Left, starting with 2^0 (or 1)
- 1(2^x) or 0(2^x)
- positions of 0s and 1s are important!
- SUM of positions should equal decimal value
How to convert decimal to Binary:
- start with the LARGEST power, then go all the way back to 2^0
e.g.
79 = 1(2^6) + 0(2^5) + 0(2^4) + 1(2^3) + 1(2^2) + 1(2^1) + 1*(2^0) = 1001111
PYTHON CHECK: bin(79)
How to interpret Numeric Types:
Binary (2)
Octal (8)
Hexadecimal (16)
- digit ranges
- Python form
In Python:
0b____ (0 or 1)
0o____ (0 to 7)
0x____ (0 to 9, A, B, C, D, E, F)
How many numeric codes are in the ASCII?
128 numeric codes for lower case and upper case letters, punctuation, spaces etc.
- starts with 0, ends with 127
- convert character to decimal value using the ASCII chart
- Convert decimal value into binary
If binary can only represent positive integer numbers, how do computers store negative numbers and fractional numbers?
Use encoding schemes along with binary numbering system
NEGATIVE numbers are encoded using TWO’S COMPLEMENT
REAL numbers are encoded using FLOATING-POINT NOTATION
What does “digital” refer to?
Anything that uses BINARY NUMBERS
(digital devices, digital data)
> need to be converted to binary first
e. g. Images = Pixels => converted to numeric code => stored in memory as a binary number
e. g. song samples = converted to binary number
Define instruction set
the entire set of instructions for each operation the CPU is capable of performing
*each brand of microprocessor has its own unique machine language instruction set
How does the secondary storage device, RAM and CPU work together to run programs?
What is the cycle the CPU engages in to execute programs called?
- Program is stored in the secondary storage device (disk drive)
- When the program is run, it is COPIED from the secondary storage to main memory
- Fetch-Decode-Execute cycle
- fetch the next instruction from the main memory to the CPU
- decode instructions
- execute and perform the operation
What is the name of the language that uses SHORT WORDS known as MNEMONICS?
Assembly Language
- type of LOW-level language (very close to ML)
- e.g. “add”, “mul”, “mov” have special meaning
- each brand of microprocessor has its own assembly language as well
(like you are assembling parts together using basic words)
Can the CPU directly understand Assembly Language?
No
- need an ASSEMBLER to translate an assembly language to a machine language program
What are high-level languages?
What are the pre-defined words used to write a program called?
- allow humans to create powerful, complex programs without writing low-level instructions
e. g. Python, C++, C#, Java etc. - pre-defined words called KEY WORDS or RESERVED WORDS
(cannot be used for other purposes like variable, function names)
Can the CPU directly understand high-level languages?
What is the translation device called?
No
- need either a COMPILER or INTERPRETER to translate into ML
Compiler - 1. compile (translates into machine language program) 2. then execute
(two SEPARATE processes)
- machine language program can be executed at any time
Interpreter - program that translates AND executes the instructions
- no separate machine language program
- immediately executes instructions
What does source code mean?
Statements written in a high-level language
What does a syntax error mean? Can the code run?
“An error in a program that involves a violation of language rules will be detected at____”
Code containing at least one syntax error CANNOT be compiled or interpreted or executed
(interpreter will just stop)
- error will be detected at COMPILE stage
- different than a logical error (program will run, but produce incorrect results)
Python Interpreter versus IDLE
- Interpreter (black screen) has two modes (1. Interactive Mode and Script Mode)
- IDLE (integrated development environment) also has an Interactive mode (Python Shell) and Script mode
An extensive encoding scheme that can represent characters for many languages in the world is _____
Unicode
In the ____ part of the fetch-decode-execute cycle, the CPU determines which operation it should perform
Decode
T/F any piece of data that is stored in a computer’s memory must be stored as a binary number?
True
- data is stored in bytes, which comprise of eight bits equalling 0 or 1
Q: Convert the following message in binary to normal text:
1001000 1100101 1101100 1101100 1101111 100000 1110111 1101111 1110010 1101100 1100100 100001
E.g. 1001000
= 1(2^6) + 1(2^3) = 64 + 8 = 72 = H