19
CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

Embed Size (px)

Citation preview

Page 1: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

CS161Computer Programming

Instructor: Maria Sabir

Fall 2009

Lecture #1

Page 2: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

Introduction To ComputersComputer Hardware and Software, Number system, Computer data : Binary notation, Bits & Bytes, ASCII coding system, Computer Organization, Memory concepts, Files, Operating system

Page 3: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

Introduction To ComputersWhat is a COMPUTER?A computer is a device that works under the

control of stored programs, automatically accepting, storing, and processing data to produce information that is the result of that processing.

INPUT

PROCESS

STORAGE

OUTPUTDATA DATA

The basic functions of a Computer

Page 4: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

Computer Hardware and Software

HardwareRefers to objects that you can actually touch, like

disks, disk drives, display screens, keyboards, printers, boards, and chips.

Software Untouchable, Software exists as ideas, concepts, and symbols, but it has no substance.

Page 5: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

Types of softwareSystem softwareSystem software helps run the computer hardware

and computer system. It includes combination of the following:

device drivers, operating systems, servers, utilities, windowing systems

The purpose of systems software is to unburden the applications programmer from the details of the particular computer complex being used, including such accessory devices as communications, printers, readers, displays and keyboards, and also to partition the computer's resources such as memory and processor time in a safe and stable manner.

Page 6: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

Types of softwareProgramming software Programming software usually provides tools to assist a programmer

in writing computer programs, and software using different programming languages in a more convenient way. The tools include:

compilers debuggers interpreters linkers text editors An Integrated development environment (IDE) is a single

application that attempts to manage all these functions.

Page 7: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

Types of software Application software Application software allows end users to accomplish one

or more specific (not directly computer development related) tasks. Typical applications include:

industrial automation business software computer games quantum chemistry and solid state physics softwar

e

telecommunications (i.e., the internet and everything that flows on it)

Page 9: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

Numbering System

The term computer numbering formats refers to the schemes implemented in digital computer and calculator hardware and software to represent numbers.

Binary

Octal

Decimal

Hexadecimal

Page 10: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

Binary (Bits, bytes, nibbles)

BIT

The concept of a bit can be understood as a value of either 1 or 0, on or off, yes or no, true or false, or encoded by a switch or toggle of some kind. A single bit must represent one of two states:

one-digit binary value: decimal value:

0 0

1 1

Page 11: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

Bits

a string of two bits together are able to represent increasingly many unique values:

two-digit binary value: decimal value:

00 0

01 1

10 2

11 3

Page 12: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

Bits

bits in series (b): number of possible values (N):

1 2

2 4

3 8

4 16

5 32

6 64

7 128

8 256

2b = N

Page 13: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

Bytes

A byte is a sequence of eight bits or binary digits that can represent one of 256 possible values.

Modern computers process information in 8-bit units, or some other multiple thereof (such as 16, 32, or 64 bits) at a time.

A group of 8 bits is now widely used as a fundamental unit, and has been given the name of octet.

A computer's smallest addressable memory unit (a byte) is typically an octet, so the word byte is now generally understood to mean an octet.

0 1 0 1 1 1 0 0

Page 14: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

NibblesA unit of four bits, or half an octet, is often called a nibble (or nybble). It can encode 16 different values, such as the numbers 0 to 15.

0000 = decimal 00 1000 = decimal 08

0001 = decimal 01 1001 = decimal 09

0010 = decimal 02 1010 = decimal 10

0011 = decimal 03 1011 = decimal 11

0100 = decimal 04 1100 = decimal 12

0101 = decimal 05 1101 = decimal 13

0110 = decimal 06 1110 = decimal 14

0111 = decimal 07 1111 = decimal 15

Page 15: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

Decimal, Octal and Hexadecimal Numbers

In the decimal system, there are 10 digits (0 through 9) which combine to form numbers as follows:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ... In an octal system, there are only 8 digits (0 through 7):

0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 20 21 22 23 24 25 ... That is, an octal "10" is the same as a decimal "8", an octal "20" is a decimal 16, and so on.

In a hex system, there are 16 digits (0 through 9 followed, by convention, with A through F):

0 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B... That is, a hex "10" is the same as a decimal "16" and a hex "20" is the same as a decimal "32".

Page 16: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

Assignment

Conversion between bases

Octal to Decimal

Hexadecimal to Decimal

Binary to Octal

Binary to Decimal

Binary to Hexadecimal

And vice versa

Page 17: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

ASCII Coding System

American Standard Code for Information Interchange (ASCII), pronounced /ˈæski/[1] is the standard code used for information interchange and communication between data processing systems, including Internet.

The ASCII character set (or ASCII table) initially contained 128 7-bit coded characters including alphabetic, numeric, control and graphic characters.It has since been extended to include system or country specific characters

Page 18: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

ASCII Coding System

Page 19: CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1

Memory

19

1 byte

2 bytes

Memory is divided into blocks

Each block can store one byte of data.

Data consisting of multiple byte is stored in multiple blocks

Data always has a label which is used to access that memory location later.