Sie sind auf Seite 1von 42

Introduction to Computers & Programming Languages

What is a Computer

What is a Computer?

A computer is an electronic device that accepts data and information, processes it and produces output.

Input

Processing/ Computation

Output

Storage

Computer Organization

1. 2.

3.
4. 5.

Input unit Output unit Memory unit Central processing unit (CPU) Secondary storage unit

1. Input Unit

Obtains information from input devices


Keyboard Mouse Scanner Digital camera Digitizer

2. Output Unit

Outputs information (from computer to outside world)

Monitor Printer Speakers etc

3. Memory Unit

Also called Primary storage or memory where the data and program that are currently in operation or being accessed are stored during use. Relatively fast and expensive. Programs and data can be stored temporarily Volatile: All information will be lost once the computers power is turned off.

4. The Central Processing Unit

The Central Processing Unit ( CPU)


Often referred to as the brain of the computer. Responsible for controlling overall activities of the computer system.

Contd

The 2 major components of the CPU are:


1.

2.

Arithmetic & Logic Unit (ALU) Performs arithmetic calculations (addition, subtraction...) and logical decisions (>, <, =, ...) Control Unit (CU) Decodes each instruction and sends signal to the other components for carrying out the instruction.

5. Secondary Storage

High capacity (in terms of space) Permanent memory Usually holds data/programs that are not actively being used by other units Takes longer time to access data in secondary memory Cost per unit < cost per unit of primary memory

Computer Hardware

Computer Hardware

Physical components of a computer system (objects that we can actually touch) Various devices comprising a computer:
Keyboard,

monitor mouse, disks, memory, CD-ROM, and processing units

Computer Software

Computer software

Software is a program or set of instructions that causes the Hardware to function in a desired way Two basic types

System software Designed to operate the computer hardware to provide basic functionality e.g. device drivers, operating system etc. Application software e.g. accounting software, office software, graphics software media players

A Layered View of the Computer


Application Programs
Word-Processors, Spreadsheets, Database Software, etc

System Software
Compilers, Interpreters, etc. Operating System, Device Drivers

Machine with all its hardware

Operating System

Type of system software consisting of programs and data, that runs on computers, manages computer hardware resources, and provides common services for execution of various application software

e.g. Microsoft windows DOS Linux Android

Functions of OS

Processor management Memory management Input / Output management File management Interpretation of commands and instructions. Facilitates easy communication between the computer system and the computer operator.

Activity

1.

Categorize each of the following as either hardware or software?


a)
b) c)

d)
e)

CPU MS. Word ALU Input unit Windows

2. Which logical unit of computer performs calculations? ________. 3. Which logical unit of computer makes logical decisions? ______. 4. RAM stores data permanently (T/F)

Number system

Binary (1, 0) Octal (0-7) Decimal (0-9) Hexadecimal (0-9, A-F)

Bits & Bytes


A bit is a single numeric value either 1or 0. that encodes a single unit of digital information. A byte is a sequence of bits. 8 bits=1 byte.

How to Communicate with computer?

Computer understands its own machine language (language of 0s and 1s).

Language instructs computer to perform tasks.


We need to understand computers language to communicate with it and to make it perform our desired functions. So we have.

Programming Language

Set of rules and symbols used to construct a computer program A language used to interact with the computer

Computer Languages

Machine Language

Uses binary code Machine-dependent Not portable Uses mnemonics Machine-dependent Not usually portable Uses English-like language Machine independent Portable (but must be compiled for different platforms) Examples: Pascal, C, C++, Java, Fortran, . . .

Assembly Language

High-Level Language (HLL)


Translators

A computer program or set of programs that transforms source code to object code.

Assembler: translates assembly language to machine language Compiler : translates high level language programs in to machine code.

Activity

1. What is the smallest unit of information? _________ 2. Machine language is a language of _________ 3. What is object code? ______________. 4. _______ translates the source code to object code.

ASCII Coding System


American Standard Code for Information Interchange (ASCII) Originally designed as a 7-bit code purpose was to standardize a binary code to give the computer user the capability of using several machines to process data regardless of the manufacturer for transmitting and processing data 8-bit version of ASCII

Programming and Problem solving


Algorithm A set of steps for solving a particular problem. Algorithms can be expressed in any language. From natural language (e.g. English) to high level language (VB, C++). Program An algorithm expressed in a language that computer can understand.

Flow Charts

A type of diagram that represents an algorithm or process showing the steps as boxes of various kinds, and their order by connecting these with arrows. used in analyzing, designing, documenting or managing a process or program in various fields

Flow Chart Building Blocks


Start & End Process Steps

Input/output

Conditional/Decisi on
Flow Control

Program Design Process


Problem solving phase Implementation phase

Typical C++ Development Environment

Contd

Program Errors

Syntax errors

Related to the error in grammar/syntax of a language


during execution indicate bugs example: un-handled exceptions, memory overrun. Bug in program that causes program to operate incorrectly, but not terminate.

Run time errors


Logical errors

Activity

1.

Differentiate between algorithm and program. By using an 8-bit code, how many characters or bit combinations can be represented?

2.

3.

List different phases involved in c++ development environment.

THANK YOU

Das könnte Ihnen auch gefallen