Chapter 1: Introduction to Computers and Programming PDF
Document Details
Uploaded by BullishMint3770
Suez Canal University
2012
Tags
Related
- Introduction to Computers and Programming PDF
- Introduction to Computers and Programming PDF
- Ch.01-Introduction to Computers and Programming (1) PDF
- Lecture 1 Introduction to Python Programming PDF
- Introduction To Computer & Programming PDF
- Lecture 1: Introduction to C++ Programming and Computer Science PDF
Summary
This document is an introduction to computer science, covering computer hardware and software, programs and programming languages, and related concepts. The document includes a look at algorithms and examples used to calculate gross pay, in addition to questions about the topic.
Full Transcript
Chapter 1: Introduction to Computers and Programming Copyright © 2012 Pearson Education, Inc. Marks Midterm 25 Quiz 10 (5+5) Practical 10 Tasks...
Chapter 1: Introduction to Computers and Programming Copyright © 2012 Pearson Education, Inc. Marks Midterm 25 Quiz 10 (5+5) Practical 10 Tasks 5 Copyright © 2012 Pearson Education, Inc. Why Program? Copyright © 2012 Pearson Education, Inc. Why Program? Computer – programmable machine designed to follow instructions Program – is a set of instructions that a computer follows to perform a task Programmer – person who writes instructions (programs) to make computer perform a task SO, without programmers, no programs; without programs, a computer cannot do anything Copyright © 2012 Pearson Education, Inc. Why Program? Programs are commonly referred to as software. Software is essential to a computer because without software, a computer can do nothing. PowerPoint and Word are examples of programs. Copyright © 2012 Pearson Education, Inc. Why Program? Programming is considered art and science. Art: Every part of program should be carefully designed. Science: A lot of testing, correction, and redesigning is required. Copyright © 2012 Pearson Education, Inc. Computer Systems: Hardware and Software Copyright © 2012 Pearson Education, Inc. ENIAC computer Copyright © 2012 Pearson Education, Inc. Microprocessor Copyright © 2012 Pearson Education, Inc. Main Hardware Component Categories: 1. Central Processing Unit (CPU) 2. Main Memory 3. Secondary Memory / Storage 4. Input Devices 5. Output Devices Copyright © 2012 Pearson Education, Inc. Main Hardware Component Categories Figure 1-2 Copyright © 2012 Pearson Education, Inc. CPU Organization Figure 1-3 Copyright © 2012 Pearson Education, Inc. Central Processing Unit (CPU) Comprised of: Control Unit Retrieves and decodes program instructions Coordinates activities of all other parts of computer. Arithmetic & Logic Unit Hardware optimized for high-speed numeric calculation. Hardware designed for true/false, yes/no decisions Copyright © 2012 Pearson Education, Inc. CPU (fetch/decode/execute) cycle Copyright © 2012 Pearson Education, Inc. Main Memory It is volatile. Main memory is erased when program terminates or computer is turned off Also called Random Access Memory (RAM) Organized as follows: – bit: smallest piece of memory. Has values 0 (off, false) or 1 (on, true) – byte: 8 consecutive bits. Bytes have addresses. Copyright © 2012 Pearson Education, Inc. Main Memory Addresses – Each byte in memory is identified by a unique number known as an address. Copyright © 2012 Pearson Education, Inc. Main Memory The number 149 is stored in the byte with the address 16, and the number 72 is stored at address 23. Copyright © 2012 Pearson Education, Inc. Secondary Storage Non-volatile: data retained when program is not running or computer is turned off Comes in a variety of media: – magnetic: floppy disk, hard drive – optical: CD-ROM, DVD – Flash drives, connected to the USB port Copyright © 2012 Pearson Education, Inc. Input Devices Devices that send information to the computer from outside Many devices can provide input: – Keyboard, mouse, scanner, digital camera, microphone – Disk drives, CD drives, and DVD drives Copyright © 2012 Pearson Education, Inc. Software-Programs That Run on a Computer Categories of software: – System software: programs that manage the computer hardware and the programs that run on them. Examples: operating systems, utility programs, software development tools. – Application software: programs that provide services to the user. Examples: word processing, games, programs to solve specific problems. Copyright © 2012 Pearson Education, Inc. Questions List the five major hardware components of a computer system. Word processing programs, spreadsheet programs, e-mail programs, Web browsers, and game programs belong to what software category? What do you call a program that performs a specialized task, such as a virus scanner, a file- compression program, or a data-backup program? Copyright © 2012 Pearson Education, Inc. Programs and Programming Languages Copyright © 2012 Pearson Education, Inc. Programs and Programming Languages A program is a set of instructions that the computer follows to perform a task We start with an algorithm, which is a set of well-defined steps. Copyright © 2012 Pearson Education, Inc. Example Algorithm for Calculating Gross Pay Copyright © 2012 Pearson Education, Inc. Copyright © 2012 Pearson Education, Inc. Machine Language Although the previous algorithm defines the steps for calculating the gross pay, it is not ready to be executed on the computer. The computer only executes machine language instructions Copyright © 2012 Pearson Education, Inc. Machine Language Machine language instructions are binary numbers, such as: 1011010000000101 Rather than writing programs in machine language, programmers use programming languages. Copyright © 2012 Pearson Education, Inc. Programs and Programming Languages Types of languages: – Low-level: used for communication with computer hardware directly. Often written in binary machine code (0’s/1’s) directly. – High-level: closer to human language. Copyright © 2012 Pearson Education, Inc. Some Well-Known Programming Languages C++ BASIC Ruby FORTRAN Java Visual Basic C# JavaScript C Python Copyright © 2012 Pearson Education, Inc. Source code and Source file Source code: The statements written by the programmer in the text editor. Source file: Is the file the source code saved in. Copyright © 2012 Pearson Education, Inc. From a High-Level Program to an Executable File a) Create file containing the program with a text editor. b) Run preprocessor to read source code and convert source file directives to source code program statements. c) Run compiler to convert source program into machine instructions (object code in object file) d) Run linker to connect hardware-specific code to machine instructions, producing an executable file. e) Steps b–d are often performed by a single command or button click. Errors detected at any step will prevent execution of these steps. Copyright © 2012 Pearson Education, Inc. From a High-Level Program to an Executable File Copyright © 2012 Pearson Education, Inc. Integrated Development Environments (IDEs) An integrated development environment, or IDE, combine all the tools needed to write, compile, and debug a program into a single software application. Examples are Microsoft Visual C++. Copyright © 2012 Pearson Education, Inc. Integrated Development Environments (IDEs) Copyright © 2012 Pearson Education, Inc.