30
CISC105 General Computer Science Class 1 – 6/5/2006

CISC105 General Computer Science Class 1 – 6/5/2006

Embed Size (px)

Citation preview

Page 1: CISC105 General Computer Science Class 1 – 6/5/2006

CISC105 General Computer Science

Class 1 – 6/5/2006

Page 2: CISC105 General Computer Science Class 1 – 6/5/2006

Important Notes!

• The lab session has been moved from 040 Smith Hall to 009 Willard Hall. It will meet at the same day and time.

Page 3: CISC105 General Computer Science Class 1 – 6/5/2006

Computer Hardware

Page 4: CISC105 General Computer Science Class 1 – 6/5/2006

Main Memory

• Memory Cells• Address• Memory content

– Data– Program Instruction

• RAM vs. ROM – Random Access

Memory = volatile– Read Only Memory =

non-volatile

Page 5: CISC105 General Computer Science Class 1 – 6/5/2006

Bits and Bytes

• Information stored in memory as bits

• 8 bits = 1 Byte• 1 b vs. 1 B• 1 KB = 1024 B • 1 GB = 1024 MB =

1,048,576 MB = 1,073,741,824 B

Page 6: CISC105 General Computer Science Class 1 – 6/5/2006

Secondary Storage

• Secondary Storage is used for long term storage of programs and information

• Information is stored in Files, directories and subdirectories

Page 7: CISC105 General Computer Science Class 1 – 6/5/2006

Central Processing Unit (CPU)

• “Brain” of the computer with 2 primary functions

– Coordinate all computer operations– Performing arithmetic and logical operations on data

• CPU follows instructions contained in a computer program

– Fetch Instruction -> Interpret Instruction -> retrieve data (if necessary) -> carry out instruction

– Uses Registers (high speed memory) to speed up retrieval

Page 8: CISC105 General Computer Science Class 1 – 6/5/2006

Input Devices

• Input Devices - Any device used to enter information into a computer– Keyboard, Mouse, Digitizer etc.

Page 9: CISC105 General Computer Science Class 1 – 6/5/2006

Output Devices

• Output Devices used to observe the results of the data manipulation

• Monitor, printer, etc.

Page 10: CISC105 General Computer Science Class 1 – 6/5/2006

Computer Network

• Local Area Network (LAN) – computers and peripherals connected together in order to share resources. Usually contained in a building.– Network Printers, Scanners, secondary storage (file

servers) etc.

Page 11: CISC105 General Computer Science Class 1 – 6/5/2006

Computer Network (WAN)

• Wide Area Network (WAN) – a network that attaches a large number of computers over a large geographic area.

• The Internet is the most well know WAN (WWW and GUI via Browser)

Page 12: CISC105 General Computer Science Class 1 – 6/5/2006

How to connect to Networks

• Modem - Use a telephone line (modulator / demodulator) - transmit up to 50,000 bps

• Digital Subscriber Line (DSL) – uses telephone line but can have simultaneous voice communication. (~1.5 Mbps)

• Cable Internet access – uses the coax cable that is used to deliver TV to your house

Page 13: CISC105 General Computer Science Class 1 – 6/5/2006

Computer Software

• Operating System

• Application Software

• Computer Languages

• Software Development Method

Page 14: CISC105 General Computer Science Class 1 – 6/5/2006

Operating System

• Operating System (OS) - Collection of programs that control the interaction of the user and computer hardware

• Booting a computer – loading the OS into memory

Page 15: CISC105 General Computer Science Class 1 – 6/5/2006

OS Responsibilities

• Communicating with the computer users

• Managing memory allocation, processor time and other resources

• Collecting input from Input devices

• Conveying output to screen, printer, etc

• Fetch data from secondary storage

• Write data to secondary storage

Page 16: CISC105 General Computer Science Class 1 – 6/5/2006

Application Software

• Application – software used for a specific task – word processing, email, accounting, etc

• Applications are made available by installing them.

• Must be compatible with the Hardware and operating system you are using.

Page 17: CISC105 General Computer Science Class 1 – 6/5/2006

Computer Languages

• Machine language – collection of binary numbers – Only understood by a specific CPU– Not very readable– Not standardized

• Assembly Language – mnemonic codes that correspond to machine language– Suffers from same problems as Machine

Language

Page 18: CISC105 General Computer Science Class 1 – 6/5/2006

Computer Languages

• High-Level language– CPU independent– Combine algebraic expressions

• A compiler will translate a high-level source file into machine code

• Syntax is very important!

• Some developers use an IDE to

Page 19: CISC105 General Computer Science Class 1 – 6/5/2006

Entering, Translating, and Running

a High-Level Language Program

Page 20: CISC105 General Computer Science Class 1 – 6/5/2006

Flow of information during program execution

Page 21: CISC105 General Computer Science Class 1 – 6/5/2006

Software Development Method

• PAD IT Man!– Problem Definition– Analyze the Problem– Design Algorithm– Implement the Algorithm– Test and verify the program– Maintain and Update the program

Page 22: CISC105 General Computer Science Class 1 – 6/5/2006

Software Development Method (example)

• Problem definition: Your job requires you to convert miles to kilometers.

• Analysis: – Program input: distance in miles– Program output: distance in kilometers– Relevant Formula: 1 mile = 1.609 kilometers

Page 23: CISC105 General Computer Science Class 1 – 6/5/2006

Software Development Method (example)

Design

1. Get the distance in miles

2. Convert the distance to kilometers1. Distance in kilometers is 1.609 times the

distance in miles

3. Display the distance in kilometersCheck the algorithm = 10 miles

times 1.609 = 16.09km

Page 24: CISC105 General Computer Science Class 1 – 6/5/2006

Software Development Method (example)

• Implement and test

Page 25: CISC105 General Computer Science Class 1 – 6/5/2006

Chapter 2

• C Language Elements• Variable Declaration and Data Types• Executable Statements• General Form of a C program• Formatting Numbers in Output• Interactive Mode, Batch Mode, and Data

Files• Common Programming Errors

Page 26: CISC105 General Computer Science Class 1 – 6/5/2006
Page 27: CISC105 General Computer Science Class 1 – 6/5/2006

Variable Declaration and Data Types

• Variable – a name associated with a memory cell whose value can change

• Variable Declaration – statements that communicate to the compiler the names of the variables in the program and the kind of information it stores.

• Data Types – a set of values and operations that can be performed on those values

Page 28: CISC105 General Computer Science Class 1 – 6/5/2006

Executable Statements• Assignment Statements – an instruction that

stores a value or a computational result in a variable

Page 29: CISC105 General Computer Science Class 1 – 6/5/2006

Executable Statements

Page 30: CISC105 General Computer Science Class 1 – 6/5/2006

I/O Statements - printf

• printf is an output statement supplied by the stdio.h library

• printf is executed by running a function call– printf(“That equals %f kilometers.\n”, kms);

• Function arguments• Format String (placeholders – multiple

placeholders)• Print list• \n and the cursor