Top Banner
1 CSC 1401 S1 Computer Programming I Hamid Harroud Hamid Harroud School of Science and Engineering, Akhawayn School of Science and Engineering, Akhawayn University University [email protected] http://www.aui.ma/~H.Harroud/CSC1401 Spring 2009
28

CSC 1401 S1 Computer Programming I

Jan 17, 2016

Download

Documents

Dinesh Tewatia

CSC 1401 S1 Computer Programming I. Hamid Harroud School of Science and Engineering, Akhawayn University [email protected] http://www.aui.ma/~H.Harroud/CSC1401 Spring 2009. Overview of Computers and Programming. Lecture 1. Lecture 1: Introduction. Objectives. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CSC 1401 S1 Computer Programming I

1

CSC 1401 S1 Computer Programming I

Hamid HarroudHamid HarroudSchool of Science and Engineering, Akhawayn School of Science and Engineering, Akhawayn

[email protected]

http://www.aui.ma/~H.Harroud/CSC1401

Spring 2009

Page 2: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction

Overview of Computers and Programming

Lecture 1

Page 3: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 3

Objectives Overview of the development of computers. Computer system components. Software categories and languages. Process of writing, compiling, and executing

high-level language programs.

Page 4: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 4

What Is Computing Science?

Is the study of the theoretical foundations of information and computation and their implementation and application in computer systems.

Page 5: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 5

Fields of computing science

Algorithms and data structures Programming languages and compilers Concurrent, parallel, and distributed systems Software engineering System architecture Theory of computation Communications Databases Artificial intelligence Visual rendering (or Computer graphics) Human-Computer Interaction Scientific computing

Page 6: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 6

What Is a Computer? A machine that can be programmed to

receive data, store it and process it into information.

Data: raw facts representing people and events Information: data that is organized,

meaningful, and useful

Page 7: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 7

Fundamental Characteristics

Speed Reliability Storage Capability

Page 8: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 8

Computer System Components

Hardware Equipment associated with the system

Software Instructions that tell the hardware what to do

People Computer programmer: writes software User: purchases and uses software

Often called end-user

Page 9: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 9

Computer Components Memory:

Main Memory Secondary Storage

CPU I/O devices

Page 10: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 10

Central Processing Unit (CPU)

The CPU has two roles: Coordinating all computer operations Performing arithmetic and logical operations in data

The processor above can execute a simple instruction such as an integer addition in one six-billionth of a second.

Page 11: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 11

The Machine Cycle

The time required to retrieve,

execute, and store an operation

Page 12: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 12

Memory Memory cells Address Contents Main Memory

Random Access Memory Read-Only access Memory

Secondary Memory CD, DVD, etc.

Page 13: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 13

Memory Units 1 Memory Cell = 1 or more Bytes 1 Byte = 8 Bits (Binary Digit) A Bit is either a 0 or a 1 Units for measuring the memory capacity:

KB: Kilo Byte = 210 = 1024 1000 Byte MB: Mega Byte = 220 1 million Byte GB: Gega Byte = 230 1 billion Byte TB: Tera Byte = 240 1 trillion Byte

Page 14: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 14

Data Representation

Computers understand two things: on and off

Data represented in binary form Binary (base 2) number system Contains only two digits, 0 and 1

Corresponds to two states, on and off

Page 15: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 15

Coding Schemes Provide a common way of representing a character

of data Needed so computers can exchange data

Coding Scheme ASCII (American Standard Code for Information

Interchange). 128 characters (256 characters in Extended ASCII) A is encoded as 01000001 (66th character) 3 is encoded as 00110011.

EBCDIC (used by IBM)-256 characters Unicode - 65536 characters. Two bytes are needed to

store a character.

Page 16: CSC 1401 S1 Computer Programming I

ASCII Table

Page 17: CSC 1401 S1 Computer Programming I

ASCII Table

Page 18: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 18

Computer Software: Operation System (OS)

Command-Line Interface UNIX MS-DOS

Graphical User Interface Macintosh OS Windows

Page 19: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 19

Operating System

A set of programs that lies between applications software and the hardware Manages computer’s resources

(CPU, peripheral devices) Establishes a user interface

Determines how user interacts with operating system

Provides and executes services for applications software

Page 20: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 20

Kernel Manages the operating system

Loaded from hard drive into memory when computer is booted

Booting refers to starting the computer

Loads other operating system programs from disk storage as needed

Page 21: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 21

The Language of a Computer

Since inside the computer digital signals are processed, the language of a computer is a sequence of 0’s and 1’s.

The computer language is called the Machine Language.

A sequence of 0s and 1s is also referred as a Binary Number Code.

Page 22: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 22

The Evolution of Programming Languages Early computers were programmed in machine language.

Example: Suppose we want to represent the equation Wages = Rate X Hours

to calculate the weekly wages in machine language.

100100 0000 010001100110 0000 010010100010 0000 010011

100100 stands for LOAD 100110 stands for MULTIPLY 100010 stands for STORE

Page 23: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 23

Assembly languages

Assembly languages: an instruction in assembly language is an easy-to-remember form called a mnemonic.

Using the assembly language instructions, the equation to calculate the weekly wages can be written as follows:

LOAD rateMULT hourSTOR wages

Assembler: An assembler is a program that translates a program written in assembly language into an equivalent program in machine language.

Page 24: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 24

High-Level Languages: In order to calculate the weekly wages, the equation

wages = rate X hours

in C, can be written as follows:

wages = rate * hours;

Compiler: is a program that translates a program written in a high level language to an equivalent machine language.

Page 25: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 25

High-Level LanguagesLanguage Applications Areas Origin of Name

FORTRAN Scientific programming Formula Translation

COBOL Business data processing Common Business-Oriented Language

LISP Artificial Intelligence List processing

C Systems programming After B

Prolog Artificial Intelligence Logic programming

Ada Real-time distributed systems Ada Augusta Byron

Smalltalk GUI, object-oriented programming Objects “talk” to one another.

C++ Supports objects and object-oriented programming

Incremental modification of C

Java Support Web programming Originally named “Oak”

Page 26: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 26

Computer Languages Machine Language

Collection of binary numbers Not standardized

Assembly Language Represented by Mnemonic codes Not standardized

High-Level Language Independent of the CPU

Page 27: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 27

High-Level Language Program

Page 28: CSC 1401 S1 Computer Programming I

Lecture 1: Introduction 28

Flow of Information During Program Execution