Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.

Similar presentations


Presentation on theme: "Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers."— Presentation transcript:

1 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers Lecture 1 by Jumail Bin Taliba Faculty of Computer Science & Information System

2 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 2 Today’s Topics Computer Systems Computing Environments Computer Languages System Development

3 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 3 Figure 1-1: A computer system

4 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 4 Figure 1-2: Basic hardware components

5 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 5 Computer Hardwares –Five main components Input devices –Allows communication to the computer Output devices –Allows communication to the user Processor (CPU) Main memory (primary storage) –Memory locations containing the running program Secondary memory (auxiliary storage) –Permanent record of data often on a disk

6 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 6 Computer Memory Main Memory –Long list of memory locations Each contains zeros and ones Can change during program execution –Binary Digit or Bit A digit that can only be zero or one –Byte Each memory location has eight bits –Address Number that identifies a memory location

7 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 7

8 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 8 Larger Data Items Some data is too large for a single byte –Most integers and real numbers are too large –Address refers to the first byte –Next few consecutive bytes can store the additional bits for larger data

9 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 9 Data or Code? ‘A’ may look like 01000001 65 may look like 01000001 An instruction may look like 01000001 How does the computer know the meaning of 01000001? –Interpretation depends on the current instruction

10 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 10 Secondary Memory Main memory stores instructions and data while a program is running. Secondary memory –Stores instructions and data permanently –A file stores data or instructions in secondary memory

11 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 11 Secondary Memory Media A computer might have any of these types of secondary memory –Hard disk Fast Fixed in the computer and not normally removed –Floppy disk Slow Easily shared with other computers –Compact disk Slower than hard disks Easily shared with other computers Can be read only or re-writable

12 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 12 The Processor Typically called the CPU –Central Processing Unit –Follows program instructions –Typical capabilities of CPU include: add subtract multiply divide move data from location to location

13 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 13 Figure 1-3: Types of software

14 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 14 Figure 1-4: Software

15 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 15 Figure 1-5: Personal computing environment

16 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 16 Figure 1-6: Time-sharing Environment

17 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 17 Figure 1-7: Client-server environment

18 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 18 Figure 1-8: Types of computer languages

19 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 19 Machine Language: the only language understood by a computer 0101 1000 0001 0000 0101 1011 0001 0000 0101 0000 0001 0000 MOVE #$1,D1 MOVE #$8,D0 ADD D0,D1 Assembly/Symbolic language High-level language Example:

20 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 20 Figure 1-9: Building a C program

21 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 21 Figure 1-10: Executing programs

22 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 22 Figure 1-11: Process of system development Building programs Edit Compile Link Run

23 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 23 Figure 1-11: Process of system development Understand the problem: Input Output Process Algorithm is the steps to solve problems Develop the solution ( Algorithm ): Structure chart Pseudocode Flowchart Converting design to computer codes. e.g: Flowchart -> C program

24 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 24 Testing and Debugging Bug –A mistake in a program Debugging –Eliminating mistakes in programs –Term used when a moth caused a failed relay on the Harvard Mark 1 computer. Grace Hopper and other programmers taped the moth in logbook stating: “First actual case of a bug being found.”

25 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 25 Program Errors Syntax error –Violation of the grammar rules of the language –Discovered by the compiler Error messages may not always show correct location of errors Run-time error –Error detected by the computer at run-time Logic error –Error in the program’s algorithm –Most difficult to diagnose –Computer does not recognize it.

26 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 26 Program Errors (cont.) Syntax error example x = 2; y = 3 z = x + y; This line consists an error. Each statement must be ended with a semi-colon ‘;’

27 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 27 Program Errors (cont.) Run-time error example x = 0; y = 3/x; This line produces an error, because the division by zero. This error is only discovered when the program runs.

28 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 28 Program Errors (cont.) Logic error example Enter a number >> 10 Enter another number >> 25 The total of those two numbers is 15 This is a logic error. The total should be 35 not 15.

29 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 29 Program Design Structure Chart Pseudo-code Flowchart

30 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 30 Structure Chart Represents a program as a collection of sub-programs (modules) Example:

31 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 31 Describe an algorithm in English-like statements Example: Algorithm for multiplying two numbers 1.Get the first number, let say A 2.Get the second number, let say B 3.Calculate the result let say C, C= A * B 4.Display the result, C Pseudo code

32 Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 32 Represents an algorithm in graphical symbols Example: Algorithm for multiplying two numbers Flowchart


Download ppt "Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers."

Similar presentations


Ads by Google