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
Review
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
FORTRAN
PASCAL
C Programming Language
...
Source Module
- a program in one of the above languages.
- created with an Editor
Compiler
- a translator from source to binary form produces an object module
( *.OBJ in DOS )
Linker
- combines object module to create an executable module (*.exe)
- also searches libraries for routines (e.g. SIN, SQRT, etc.)
System Loader
- finds executable on disk and place them in RAM
- starts execution
CPU
- Central Processing Unit
RAM
- Random Access Memory
- Main Memory program must be in RAM before they can execute
ROM - Read Only Memory - special systems area for startup
Hz
- Hertz = 1 cycle per second
Mhz
- 1 million Hz (used to measure
CPU speed - 25,33,50,75,90,100,200)
BIT
- Binary digIT ( 0 or 1)
NIBBLE
- 4 BITS !! (e.g. 1010 in binary = 10 decimal )
BYTE
- 8 bits (used to store a character)
KB
- Kilobytes = 1024 bytes
MB
- Megabytes = 1024 KB
DISK
- Hard disks for permanent storage.
Floppy disk
- 3.5'' stores 1.44 MB (removeable, transportable).
CD ROM - Compact Disk ROM store
633 MB of read only storage.
MODEM
- MOdulate/DEModulate (to communicate between computers)
BAUD
- Bit/second (measure of data bandwidth (..., 14 400, 28 800,...)
PARITY
- A check bit used to verify communications. Can be EVEN, ODD or
NONE. A count of the 1 bits.
VGA
- Video Graphic Adapter - 640 x 480 , 256 colours
SVGA
- 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.
VARIABLE
- A quantity that can vary
- A location in RAM
- A NAME for one of the above
DATA TYPE
- One of a number of different types of data
- INTEGER, REAL, CHARACTER, LOGICAL
- Main ones used in 308-208.
DATA CONSTANTS
- A constant of one of the types above
- e.g. 27 3.14159 'JEAN' .FALSE.
- Used to define the types of data and variables.
IMPLICIT NONE
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
_0____1___2____3___3____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
! NUMBERS
PROGRAM ACCURACY
PRINT *, 1.0E0
PRINT *, 1.0E2
PRINT *, 1.0E4
PRINT *, 1.0E6
PRINT *, 1.0E8
PRINT *, 1.0E10
STOP
END PROGRAM ACCURACY
PROGRAM OUTPUT :
1.00000000
100.000000
10000.0000
1000000.00
100000000.
0.999999898E+10
Go back to lecture menu
Go back to main page