1_Computer Fundamentals.pdf

Full Transcript

PRG 155 – Programming Fundamentals Using C 1. Computer Computer is a programmable electronic device that has ability to accept data (inputs), store data, process information, and generate outputs according to a set of instructions called program. Types of computers:  Analog computer  Digital ...

PRG 155 – Programming Fundamentals Using C 1. Computer Computer is a programmable electronic device that has ability to accept data (inputs), store data, process information, and generate outputs according to a set of instructions called program. Types of computers:  Analog computer  Digital  Hybrid Types of digital computers according to size and power:  Embedded computers  Mobile devices  Personal computers  Midrange servers  Mainframe computer  Supercomputer Hardware Hardware is the physical part of a computer. Computer Architecture  Central Processing Unit (CPU) - CPU consists of 3 main parts: o ALU – Performs arithmetic and logical operations o Control Unit –Controls data movement and execution of instructions o Registers – Small, high speed storage areas  Memory is used for data storage. There are two types of memory: o Primary - Directly accessible to the CPU.  RAM (Random Access Memory)  ROM (Read-Only Memory) o Secondary – External storage device that is not directly accessed by CPU. It provides permanent long-term storage (examples: hard disk, DVD, USB, etc.).  Input devices - Examples: keyboard, mouse, web camera, barcode scanner, microphone, touch screen, etc.  Output devices - Examples: monitor, printer, speakers, projector, plotter, etc. 1 PRG 155 – Programming Fundamentals Using C Computer Architecture Online image. 16 Jan, 2017. https://naoreenchowdhury.files.wordpress.com/2013/05/computer.gif Software Software refers to the programs/instructions used to tell the computer hardware what to do. Computer programming refers to creating a sequence of instructions to be executed by a computer. Types of Software Word Processing Spreadsheets Web Browsers Operating Systems Electronic Mail Network Management Graphics Database Management Software Suites System Utilities Performance Monitors Accounting Software Security Monitors Customer Relationship E-Commerce Programming Languages Education Translators Science Programming Editors & Tools Entertainment Manufacturing 2 PRG 155 – Programming Fundamentals Using C System software – Programs designed to operate/control computer hardware and to run application programs. Application software – Programs designed for end user to perform specific tasks. Operating System – System software that manages and controls computer’s hardware, runs all other programs on a computer, and interfaces with the user. Operating system is responsible for tasks such as file management, memory management, handling inputs and outputs, etc. Examples of operating systems are Dos, Windows, Unix, Linux, and Mac OSX. Programming Languages Similar to human language High-level Languages Use a specific syntax and a set of reserved keywords Cobol, Basic, Portable C, C++, C#, Java Example: X = A + B Uses mnemonics (English- Assembly Language like terms) to create instructions Machine dependent Uses Binary code (1s and 0s) Example: ADD A, B to create instructions Machine Languages Machine dependent Example: 100101111 Hardware 3 PRG 155 – Programming Fundamentals Using C Program development life cycle (Rajinikanth) 1. Problem Definition 2. Problem 6. Maintenance Analysis 5. Testing & 3. Algorithm Debugging Development 4. Coding 1. Problem definition – Define the problem statement. 2. Problem analysis – A problem cannot be solved if not understood. 3. Algorithm development – Develop a step-by-step procedure (sequence of operation) to solve the problem. 4. Coding – Write the program. 5. Testing and debugging – A program must produce a desired output. If not, identify/fix possible error(s). 6. Maintenance – During this phase, the program is used by end users. If there are any problems and/or users want enhancements, the process begins from the step 1. Algorithm Development Methods of specifying algorithm:  Pseudocode – Specifies the steps of the algorithm using natural language (example: English).  Flowchart – Specifies the steps of the algorithm using a diagram (flowchart) that illustrates the flow of the program. 4 PRG 155 – Programming Fundamentals Using C Program Code Convertors Assembler – Converts a source code written in assembly language into machine code. Interpreter – Converts a source code written in high-level programming language into machine code on a step-by-step/line-by-line basis. It takes a single instruction as input. Compiler – Converts a source code written in high-level programming language into machine code (executable file with extension.exe). It takes entire program as input. After the source code file is submitted for compilation, Compiler will check if there are any errors. All errors must be corrected for Compiler to generate the object file. The object file is then linked to libraries, and the executable file (containing only binary code) is created. Online image. 16 Jan, 2017. https://abhijangda.files.wordpress.com/2014/07/compile.gif Structured Programming  Also known as Modular Programming  Focus is on logical structure rather than data.  Programming technique that follows top-down approach  Programs are divided into small, logically structured blocks of code – functions.  Each function performs a specific task.  Programs are easy to understand and modify 5 PRG 155 – Programming Fundamentals Using C References  Tan, H.H., and T.B. D’Orazio. C Programming for Engineering & Computer Science. USA: WCB McGRaw-Hill. 1999. Print.  Rajinikanth, B. “Computer Languages.” C Programming. BSC btechsmartclass. n.d. Web. 16 Jan, 2017. http://www.btechsmartclass.com/CP/computer-languages.htm  Rajinikanth, B. “Program Development Life Cycle.” C Programming. BSC btechsmartclass. n.d. Web. 16 Jan, 2017. http://www.btechsmartclass.com/CP/program-development.htm  “Compilers & Interpreters (high-level)” Computer science. 22 Mar, 2016. Web. 16 Jan, 2017. http://lolcatsandtanks.blogspot.ca/2016/03/compilers-and-interpreters.html  "Difference between Structured Programming and Object Oriented Programming | Structured Programming vs. Object Oriented Programming." FreeFeast.info. N.p., 06 June 2016. Web. 02 Mar. 2017.. 6

Use Quizgecko on...
Browser
Browser