1/36
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Computer
programmable machine designed to follow instructions
Program
Instructions in computer memory to make it do something
Programmer
Person who writes programs to make a computer perform a task
Without programmers _
No programs, a computer cannot do anything
Main Hardware Component Categories
Central Processing Unit
Main Memory
Secondary Memory/Storage
Input Devices
Output Devices
CPU
Comprised of:
Control Unit
Retrieves and decodes program instructions
Coordinates activities of all other parts of computer
Arithmetic and Logic Unit
Hardware optimized for high-speed numeric calculation
Hardware designed for true/false, yes/no decisions
Main Memory
Volatile, erased when program terminates or computer is turned off
Also called Random Access Memory
Organized as:
Bit:smallest piece of memory, has values 0 (off, false) or 1 (on, true)
Byte: 8 consecutive bits. Bytes have addresses.
Addresses
A unique number identifying each byte
Secondary Storage
Non-volatile: data retained when program is not running or computer is turned off
Comes in a variety of media:
magnetic: traditional hard drives that use a moveable mechanical arm to read/write
solid state: data stored in chips, no moving parts
optical: CD-ROM, DVD
flash drives: connected to USB port
Input Devices
Devices that send information to the computer from outside
Many devices can provide input:
keyboard, mouse, touchscreen, scanner, digital camera, microphone
Disk drives, CD drives, and DVD drives
Categories of Software
System software: programs that manage the computer hardware and the programs that run on them ex. OS, utility programs, software development tools
Application software: programs that provide services to the user ex. Word processing, games, programs to solve specific problems
Algorithm
A set of well-defined steps
True or false: The computer only executes machine language instructions
True
Machine Language
Instructions as binary numbers
True or false: Programmers write programs in machine language
False, programmers use programming languages
Types of programming languages
Low level: Used for communication with computer hardware directly, often written in binary machine code
High level: Closer to human language
List of common programming languages
C
C++
C#
Basic
Fortran
Cobol
Java
JavaScript
Ruby
Visual Basic
Swift
Rust
Go
Steps to turn a high-level program to an executable file
A) create file containing the program with a text editor
B) run preprocessor to convert source file directives to source code program statements
C) run compiler to convert source program into machine instructions
D) Run linker to connect hardware-specific code to machine instructions, producing an executable file
*B-D are often performed by a single command/click
*Errors detected at any step will prevent execution of following steps
Integrated Development Environments (IDEs)
Combines all tools needed to write, compile, and debug a program into a single software application ex. Microsoft Visual C++, Turbo C++ Explorer, CodeWarrior
Common elements in programming languages
Key words
Programmer-defined identifiers
Operators
Punctuation
Syntax
Key Words
Also known as reserved words
Have a special meaning in C++
Cannot be used for any other purpose
Key Words in Program 1-1
Using, namespace, int, double, return
Programmer-Defined Identifiers
Names made up by the programmer
Not part of the C++ language
Used to represent various things: variables (memory locations), functions, etc.
Programmer-Defined Identifiers in Program 1-1
hours, rate, pay
Operators
Used to perform operations on data
Many types
Arithmetic (+,-,*,/)
Assignment (=)
Operators in Program 1-1
«,»,=,*
Punctuation
Characters that mark the end of a statement, or that separate items on a list
Punctuation in Program 1-1
,,;
Syntax
The rules of grammar that must be followed when writing a program
Controls the use of key words, operators, programmer-defined symbols, and punctuation
Variables
A named storage location in the computer’s memory for holding a piece of data
Variables in Program 1
hours (hold the hours worked)
rate (hold the pay rate)
pay (hold the gross pay)
Variable Definitions
*required to create a variable definition
Aka, a variable declaration
Specifies the type of data a variable can hold, and the variable name
Statement from Program 1-1 defining variables
double hours, rate, pay;
Three steps that a program typically performs
1) gather input data (from keyboard or files on disk drives)
2) process the input data
3) display the results as output (send it to the screen or write to a file)
The Programming Process
Clearly define what the program is to do
Visualize the program running on the computer
Use design tools such as a hierarchy chart, flowcharts, or pseudocode to create a model of the program
Check the model for logical errors
Type the code, save it, and compile it
Correct any errors found during compilation (repeat 5-6 as needed)
Run the program with test data for input
Correct any errors found while running the program (repeat 5-8 as needed)
Validate the results of the program
Procedural Programming
Focus is on the process
Procedures/functions are written to process data
Object-oriented programming
Focus is on objects, which contain data and the means to manipulate the data
Messages sent to objects to perform operations