Lesson 2 - Learning Goals
2.1 Review of quick quiz
2.2 Computer Concepts and Terminology
2.3 Learn the Four basic data types
2.4 Learn how to use the Assignment statement
2.5 Learn about the Accuracy of numeric results
Computer Concepts and Terminology
Computer Architecture Overview
The Von Neumann Model
1. Programs and Data both in main memory
2. One CPU - Central Processing Unit
3. Program instructions fetched, decoded and executed by CPU
4. Data is loaded from memory into CPU registers.
5. Operations + - * / < = > performed by CPU
6. Results stored back in data area in memory
C Programming Language
- a program in one of the above languages.
- created with an Editor
- a translator from source to binary form produces an object module
( *.OBJ in DOS )
- combines object module to create an executable module (*.exe)
- also searches libraries for routines (e.g. SIN, SQRT, etc.)
- finds executable on disk and place them in RAM
- starts execution
- Central Processing Unit
- Random Access Memory
- Main Memory program must be in RAM before they can execute
ROM - Read Only Memory - special systems area for startup
- Hertz = 1 cycle per second
- 1 million Hz (used to measure
CPU speed - 25,33,50,75,90,100,200)
- Binary digIT ( 0 or 1)
- 4 BITS !! (e.g. 1010 in binary = 10 decimal )
- 8 bits (used to store a character)
- Kilobytes = 1024 bytes
- Megabytes = 1024 KB
- Hard disks for permanent storage.
- 3.5'' stores 1.44 MB (removeable, transportable).
CD ROM - Compact Disk ROM store
633 MB of read only storage.
- MOdulate/DEModulate (to communicate between computers)
- Bit/second (measure of data bandwidth (..., 14 400, 28 800,...)
- A check bit used to verify communications. Can be EVEN, ODD or
NONE. A count of the 1 bits.
- Video Graphic Adapter - 640 x 480 , 256 colours
- Super VGA ( 1024 X 768 )
FIELD - A group of characters ( e.g. Last Name, ...)
RECORD - A group of fields ( e.g. Name, Address, Grades, ... )
FILE - A group of records (e.g. Source module,...)
DATABASE - A group of files (e.g. McGill Student Records, ... )
EBCDIC - Extended Binary Coded Decimal Interchange Code used on IBM mainframes (an 8 bit code )
ASCII - American Standard Code for Information Interchange used on microcomputers ( a 7 bit code )
UNICODE - New 16 Bit Code for ALL languages : Chinese, Japanese, Arabic, etc.
- A quantity that can vary
- A location in RAM
- A NAME for one of the above
- One of a number of different types of data
- INTEGER, REAL, CHARACTER, LOGICAL
- Main ones used in 308-208.
- A constant of one of the types above
- e.g. 27 3.14159 'JEAN' .FALSE.
- Used to define the types of data and variables.
INTEGER :: I,MAX,AGE
REAL :: SUM,TOTAL,Z
CHARACTER :: LAST,FIRST,TITLE
LOGICAL :: SINGLE,DRIVER
- Used to do calculations and assign new values
AGE = 19
Z = -5.7
TOTAL = 0.0
TOTAL = TOTAL + Z
LAST = 'SPILLER'
DRIVER = .TRUE.
I/O - Input/Output
- PRINT and READ statements in FORTRAN
READ *, TITLE, LAST, AGE
PRINT *, LAST, AGE
10E2 10E1 10E0 10E-1 10E-2 10E-3
= 0x10E2 + 1x10E1 + 2x10E0 +
3x10E-1 + 3x10E-2 + 3x10E-3
= 12 333/1000 = 12 1/3 (approx.)
How can you tell what ''12.333''
is ''exactly'' ?
What is ''exact'' in one base
may not be ''exact'' in another.
In decimal, 3.6 is ''exact'',
but in binary,
3.6 = 1x21 + 1x20 +1x2-1 + 0x2-2 + 0x2-3 + 1x2-4 +1x2-5 . . .
= (11.100110011001...) 2
= ( 11.1001 )2
and thus can NEVER be represented ''exactly'' no matter HOW many digits you have !
! TEST ACCURACY OF REAL
PRINT *, 1.0E0
PRINT *, 1.0E2
PRINT *, 1.0E4
PRINT *, 1.0E6
PRINT *, 1.0E8
PRINT *, 1.0E10
END PROGRAM ACCURACY
PROGRAM OUTPUT :
Go back to lecture menu
Go back to main page