Introduction to Computers and Programming PDF
Document Details
Uploaded by Deleted User
Tags
Summary
This document provides an introduction to computer science concepts, covering hardware (CPU, RAM, storage), software (programs), and basic programming ideas. It also describes different programming approaches and different types of errors in programming.
Full Transcript
Program is a set of instructions that a computer follows to perform a task SOFTWARE Programmer is a person who can create designand test computer programs SOFTWARE DEVELOPER Hardware Physical devices thatmake up a computer Typical Majorcomponents of a computer 1 Centralproce...
Program is a set of instructions that a computer follows to perform a task SOFTWARE Programmer is a person who can create designand test computer programs SOFTWARE DEVELOPER Hardware Physical devices thatmake up a computer Typical Majorcomponents of a computer 1 Centralprocessing unit CPO 2 MainMemory 3 Secondarystoragedevices 4 Inputandoutputdevices CPU Mostimp component Brain of thecomputer Takes Action Thepartthat runs the programs or software Responsible for controlling stuff Microprocessors CPUs located on smallchips The same as CPU justslower Main Memory where computerstores a program while program is running and datausedby program RAM Random Access Memory CPUquicklyaccess data in RAM Erased when computer isoff Volatile whenthepoweris switchedoff it loses its data Secondary storage Canhold dataforlongperiodof time More storage Types of secondary storage 1 DiskDrive Magneticallyencodes dataonto a spinning circulardisk 2 SolidStateDrive fasterthan 1 nomovingparts and storesdata in solidstatememory 3 FlashMemory portableand nophysical disk 4 OpticalDevice dataencodedoptically Input Data thecomputercollects frompeopleand otherdevices InputDevice Componentsthatcollectsthe data Output Data produced bythecomputer forotherpeople or devices ex Text Audio Image or bit stream OutputDevice formatsand presents output Input Both Output Keyboard Fax Printer Mouse CD Headphones Camera DVD Speakers Microphone Flash memory Screen Monitor Scanners Touch Screen video display Software A set of programswritten to perform specifictasks D 1 System Programs Controlthecomputer Microsoft Windows Linux MacOS Android 2 Application Programs perform a specifictask Word Java Chrome Notes Gmail How Computersstores Data In sequence of Os and 1s Byte enough memory tostore letter or smallnumber tsan 8bits 7Byte Byte size limits are 255 allbitson Bits electrical component that can holdpositive or negativecharges ex on off switch represent Os and Is Most Imp Coding Scheme is ASCII definescode foronly 128 characters CPU executes program in cycle 1 Fetch RAM CPU 2 Decode Translates to determinewhich operation to perform 3 Execute performtheoperation Machine Language Assembly Language Highlevel language Assembly Language usesshortwordsinsteadofbinarynumbers Assembler translates the assemblylanguagetomachinelanguage forexecution byCPU Low level language close in natureto machine language ex Assembly language Highlevel language Allowssimplecreationof powerful andcomplex programs no need to write largenumberof instructions Predefinedwords used towrite keyWords programs in high level language Operators Perform operation on data Syntax setofrules to befollowed when writing a program statement individual instruction used in high levellanguage High level language Machine language Compiler translates a highlevel language programinto a separate machine language program Interpreter translates and executes instruction in high level languageprogram Interprets one instruction at a time Source code statements writtenbyprogrammers Syntax error prevents code from being translated checksthe stake pmi Program Bytecode Machinecode Compiler Interpreter a set of instructions collects the packagetosend to theinterpreter Python High level language Python interpreterhasTWO MODES 1 Interactive Mode statements onthekeyboard conversationbetweenthe developerand machine 2 ScriptMode Statements in pythonscript no interaction itwill just run it foryou IDLE Integrated Development Program Environment a single programprovidesyouthetool to write execute and test a program runs in interactive mode Typesof Errors 1 Syntax error Developeris responsible compiler will help ex prin instead of print 2 Runtimeerror Happens whenthecode is running Tryto avoid it ex f 3 Logical error youput thelogicincorrectly ex using instead of Algorithm A step step problemsolvingprocess by Problem solvingprocess Analyze ON A 1 Analyze Ea LOI 2 Implement Maintain To Implement 3 Maintain Programming Design Approaches 1 Structured Design 2 Object oriented Design Pseudocode English like statements Detailed Description of What a computer program Must Do Flowchart Graphical Representation of an Algorithm OVAL Shape 0 start End Parrelgram to Read Print Rectangle Logical operations Diamond Decision can be used with loops