C H A P T E R 1. Introduction to Computers and Programming

Similar documents
Topics. Hardware and Software. Introduction. Main Memory. The CPU 9/21/2014. Introduction to Computers and Programming

Introduction. Arizona State University 1

Chapter 1: Why Program? Main Hardware Component Categories 8/23/2014. Main Hardware Component Categories: Why Program?

Chapter 1: Introduction to Computers and Programming

CHAPTER 1 Introduction to Computers and Java

Chapter 1: Why Program? Computers and Programming. Why Program?

HARDWARE. There are a number of factors that effect the speed of the processor. Explain how these factors affect the speed of the computer s CPU.

Chapter 1. Introduction to Programming and Visual Basic Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of

Chapter 1 Introduction to Computers and Programming

Chapter 1: Introduction to Computers and Java

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java

Week 0: Intro to Computers and Programming. 1.1 Why Program? 1.2 Computer Systems: Hardware and Software. Hardware Components

Fundamentals of Programming (Python) Basic Concepts. Ali Taheri Sharif University of Technology Spring 2018

Chapter 1: An Overview of Computers and Programming Languages. Objectives. Objectives (cont d.) Introduction

An Introduc+on to Computers and Java CSC 121 Spring 2017 Howard Rosenthal

Computer Fundamentals

An Introduction to Computers and Java CSC 121 Spring 2015 Howard Rosenthal

Chapter 1. Introduction to Computers and Programming. M hiwa ahmad aziz

CHAPTER 1: INTRODUCTION TO COMPUTERS AND PROGRAMMING. 1 Muhalim Mohamed Amin Faculty of

HANDOUT: COMPUTER PARTS

! Learn how to think like a computer scientist. ! Learn problem solving. ! Read and write code. ! Understand object oriented programming

BITG 1113: Introduction To Computers And Programming Language LECTURE 1 LECTURE 1 1

Computer Basics 1/24/13. Computer Organization. Computer systems consist of hardware and software.

CC411: Introduction To Microprocessors

MINI MOCK (MIMO) Computer Science 2210

Chapter 1. Data Storage Pearson Addison-Wesley. All rights reserved

8/16/12. Computer Organization. Architecture. Computer Organization. Computer Basics

SCSP Programming Technique C

1.1 Bits and Bit Patterns. Boolean Operations. Figure 2.1 CPU and main memory connected via a bus. CS11102 Introduction to Computer Science

The Programming Process Summer 2010 Margaret Reid-Miller

Computer Basics 1/6/16. Computer Organization. Computer systems consist of hardware and software.

Jianhui Zhang, Ph.D., Associate Prof. College of Computer Science and Technology, Hangzhou Dianzi Univ.

General Computing Concepts. Coding and Representation. General Computing Concepts. Computing Concepts: Review

Components of a personal computer

Intentionally Blank 0

Homeschool Enrichment. The System Unit: Processing & Memory

CSI31 Introduction to Computer Programming I. Dr. Sharon Persinger Fall

Bits, bytes, binary numbers, and the representation of information

Bits and Bit Patterns

AN INTRODUCTION TO THE COMPUTER

Computers Are Your Future

Programming 1. Lecture 1 COP 3014 Fall August 28, 2017

What is the typical configuration of a computer sold today? 1-1

TUTORIAL Describe the circumstances that would prompt you to use a microprocessorbased design solution instead of a hard-wired IC logic design.

Programming Principles and Techniques

COMPUTER BASICS Processing/Storage

Introduction to Computers

INTRODUCTION TO COMPUTERS

Computers Are Your Future

Microprocessors I MICROCOMPUTERS AND MICROPROCESSORS

Information Science 1

Data Storage. Slides derived from those available on the web site of the book: Computer Science: An Overview, 11 th Edition, by J.

Chapter 2: Computers: The Machines Behind Computing.

Chapter 1 INTRODUCTION

LECTURE SCHEDULE 2. Units of Memory, Hardware, Software and Classification of Computers

Chapter 1. Hardware. Introduction to Computers and Programming. Chapter 1.2

Computer is an electronic machine that can receive, store, transform and output data of all kinds (image, text, numeric, graphics and sound).

CMSC131. Hardware and Software. Hardware

CMSC131. Hardware and Software

Introduction. Chapter 1. Hardware. Introduction. Creators of Software. Hardware. Introduction to Computers and Programming (Fall 2015, CSUS)

What's in a computer?

Dec Hex Bin ORG ; ZERO. Introduction To Computing

An Overview of the Computer System. Kafui A. Prebbie 24

Computer Principles and Components 1

Fundamentals of Programming. Lecture 1: Introduction to C Programming

National 5 Computing Science Software Design & Development

St. Benedict s High School. Computing Science. Software Design & Development. (Part 2 Computer Architecture) National 5

The personal computer system uses the following hardware device types -

Parts are adapted from Windows 98 by Mark Twain Media, Inc. A Computer System has Hardware and Software

Week One: Introduction A SHORT INTRODUCTION TO HARDWARE, SOFTWARE, AND ALGORITHM DEVELOPMENT

Elements of Computers and Programming Dr. William C. Bulko. What is a Computer?

Question Bank. Fundamentals Of Computer FYBCA (SEM - I)

9/7/2012. Introduction. Peeking into Computer Science. Jalal Kawash Mandatory: Chapter 1 Optional: None. Reading Assignment

Programming 1 - Honors

Ch. 1: Computer System part I

Computer Systems. Communication (networks, radio links) Meatware (people, users don t forget them)

KULLEĠĠ SAN BENEDITTU Secondary School, Kirkop

Chapter 14: Files and Streams

CMSC 1513 Lecture 1.2

Computer Science Applications to Cultural Heritage. Introduction to computer systems

Chapter 0: IT Essentials Introduction Chapter 1: Introduction to the Personal Computer

COMPUTER SYSTEMS. Section 1

Grade 5 lesson 2 Computer storage and computer care and you

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

Homework 1 graded and returned in class today. Solutions posted online. Request regrades by next class period. Question 10 treated as extra credit

Introduction to Computers and Java

True/False Indicate whether the statement is true or false. Bubble A for True and B for False

True/False Indicate whether the statement is true or false. Bubble A for True and B for False

ST. MARY S COLLEGE FORM 4

DATA STORAGE. Chapter One. Chapter Summary. Comments

VISUAL SUMMARY PEOPLE INFORMATION SYSTEMS. Information Technology, the Internet, and You. Rev.Confirming Pages

Electricity: Voltage. Gate: A signal enters the gate at a certain voltage. The gate performs operations on it, and sends it out was a new signal.

User. Application program. Interfaces. Operating system. Hardware

System Unit Components Chapter2

Chapter 4 The Components of the System Unit

Machine Architecture and Number Systems

Name: Date: Hour: The abacus (still in use today) is about 5,000 years old. Not a computer.

Stonelaw High School. Computing Science. BGE - Computer Systems

Memory Study Material

Transcription:

C H A P T E R 1 Introduction to Computers and Programming

Topics Introduction Hardware and Software How Computers Store Data How a Program Works Using Python

Computer Uses What do students use computers for? Writing papers, searching for articles, sending email, online classes, etc What do people use computers for at work? Analyze data, make presentations, business transactions, communicate, control machines, etc. What do people use computers for at work? Paying bills, shopping online, communicating, playing games and videos, etc.

Programs Computers can be programmed Designed to do any job that a program tells them to Program: set of instructions that a computer follows to perform a task Commonly referred to as Software Programmer: person who can design, create, and test computer programs Also known as software developer

Python Language Easy to learn Programs can be written quickly Quick feedback on how program is doing Powerful and very popular with professional software developers Used by Google, NASA, YouTube, game companies, NYSE Used in AI, machine learning, Big Data, robotics

Hardware The physical devices that make up a computer Computer is a system composed of several components that all work together Typical major components: Central processing unit Main memory Secondary storage devices Input and output devices

Central processing unit (CPU) Part of the computer that actually runs programs Most important component Without it, cannot run software Used to be a huge device Microprocessors: CPUs located on small chips

Main Memory Where computer stores a program while program is running, and data used by the program Known as Random Access Memory or RAM CPU is able to quickly access data in RAM Uses volatile memory For temporary storage while program is running Contents are erased when computer is off

Secondary Storage Devices Can hold data for long periods of time Programs normally stored here then loaded to main memory when needed Types of secondary memory Disk drive: magnetically encodes data onto a spinning circular disk Solid state drive: faster than disk drive, no moving parts, stores data in solid state memory Flash memory: portable, no physical disk (Ex: USB drive) Optical devices: data encoded optically (CD, DVD, Blu-ray Disks (BD)

Input Devices Input: data the computer collects from people and other devices Input device: component that collects the data Examples: keyboard, mouse, touchscreen, scanner, camera Disk drives can be considered input devices because they load programs into the main memory

Output Devices Output: data produced by the computer for other people or devices Can be text, image, audio, or bit stream Output device: formats and presents output Examples: video display, printer Disk drives and USB drives can be considered output devices because data is sent to them to be saved

Software Everything the computer does is controlled by software General categories: Application software System software Application software: programs that make computers useful for everyday tasks Examples: word processing, email, games, and web browsers

System Software Programs that control and manage basic operations of a computer Operating system: controls operations of hardware components, storage, allows programs to run, user interface Utility Program: performs specific task to enhance computer operation or safeguard data Virus scanners, file compression, data backup Software development tools: used to create, modify, and test software programs Compilers, interpreters, assemblers

Checkpoint What is a program? What is hardware List five major components of a computer system What part of computer actually runs programs? Where are programs stored while running them? Where are programs stored for long term use? What computer parts get data from people and devices? What computer parts present data to people and devices?

How Computers Store Data All data in a computer is stored in sequences of 0s and 1s Byte: just enough memory to store letter or small number Divided into eight bits Bit: electrical component that can hold positive or negative charge, like on/off switch The on/off pattern of bits in a byte represents data stored in the byte Figure 1-6 Think of a byte as eight switches

Storing Numbers Bit represents two values, 0 and 1 Computers use binary numbering system Position of digit j is assigned the value 2 j-1 To determine value of binary number sum position values of the 1s Byte size limits are 0 and 255 0 = all bits off; 255 = all bits on To store larger number, use several bytes Figure 1-8 The values of binary digits as powers of 2

Binary Calculation For example: Figure 1-10 Determining the value of 10011101 Figure 1-11 The bit pattern for 157

Storing Characters Characters are stored in the computer s memory as binary number ASCII (American Standard Code for Information Interchange) is a coding scheme Figure 1-13 The letter A is stored in memory as the number 65

Storing Characters ASCII is a set of 128 numeric codes ASCII is limited Unicode is an extensive encoding scheme It is compatible with ASCII It represents characters for many languages in the world

Advanced Number Storage To store negative numbers and real numbers, computers use binary numbering and encoding schemes Negative numbers encoded using two s complement Real numbers encoded using floating-point notation

Other Types of Data Digital: describes any device that stores data as binary numbers Digital images are composed of pixels To store images, each pixel is converted to a binary number representing the pixel s color Digital music is composed of sections called samples To store music, each sample is converted to a binary number

How a Program Works CPU designed to perform simple operations on pieces of data Examples: reading data, adding, subtracting, multiplying, and dividing numbers Understands instructions written in machine language included in its instruction set Each brand of CPU has its own instruction set To carry out meaningful calculation, CPU must perform many operations

How a Program Works (cont d.) Program must be copied from secondary memory to RAM each time CPU executes it CPU executes program in cycle Fetch: read the next instruction from memory into CPU Decode: CPU decodes fetched instruction to determine which operation to perform Execute: perform the operation

How a Program Works (cont d.) Figure 1-16 The fetch-decode-execute cycle

From Machine Language to Assembly Language Impractical for people to write in machine language Assembly language: uses short words (mnemonics) for instructions instead of binary numbers Easier for programmers to work with Assembler: translates assembly language to machine language for execution by CPU

High-Level Languages High-Level language: allows simple creation of powerful and complex programs No need to know how CPU works or write large number of instructions More intuitive to understand Python, C, C++, C#, Java, JavaScript

Compilers and Interpreters Source code: statements written by programmer Programming languages are converted to machine language by Compiler All programming instructions are converted before executing a program Interpreter Each instruction is individually converted during execution, Ex: Python

Terminology Operators + - * / Perform arithmetic and other functions on data Syntax Set of rules that must be followed Syntax errors are caused by Misspelled word Missing punctuation character Incorrect use of an operator Similar to the set of rules that are followed when people speak a natural language

Terminology Program or code Consists of keywords, operators, punctuation arranged in proper logical sequence Key words or reserved words have specific meaning and purpose in the programming language Save, compile, link, executable program is produced

Installing Python Python must be installed and configured prior to use https://www.python.org/ Click on Downloads then click on Download Python 3.(latest version), ex: 3.7.0 Find downloaded file on your computer and execute it Choose defaults, but in Advanced Options make sure there is a check mark on Add Python to environment variables

Using Python Two environments are installed Python interpreter IDLE programming environment Integrated development environment Python interpreter can be used in two modes Interactive mode: enter statements on keyboard Script mode: save statements in Python script

Interactive Mode When you start Python in interactive mode Run Python3.7 or whichever version you downloaded Choose 32 or 64 bit version. Latest computers are 64 bits. You will see a prompt of >>> Indicates the interpreter is waiting for a Python statement to be typed Prompt reappears after previous statement is executed Error message displayed If you incorrectly type a statement Good way to learn new parts of Python

Writing Python Programs and Running Them in Script Mode Statements entered in interactive mode are not saved as a program To have a program use script mode Save a set of Python statements in a file using a text editor The filename should have the.py extension To run the file, or script, type python filename at the operating system command line

The IDLE Programming Environment IDLE (Integrated Development Program): A much more user friendly way of writing and testing Python programs Runs in interactive mode Has built-in text editor with features designed to help write Python programs

Summary This chapter covered: Main hardware components of the computer Types of software How data is stored in a computer Basic CPU operations and machine language Fetch-decode-execute cycle Complex languages and their translation to machine code Installing Python and the Python interpreter modes