1 / 38

Prepared By Mrs.Sandhya Gundre

Fundamentals Of Programming Language-I. Prepared By Mrs.Sandhya Gundre. To acquire the fundamental principles, concepts and constructs of computer programming To develop competency for the design, coding and debugging

alfredoa
Download Presentation

Prepared By Mrs.Sandhya Gundre

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Fundamentals Of Programming Language-I Prepared ByMrs.SandhyaGundre

  2. To acquire the fundamental principles, concepts and constructs of computer programming • To develop competency for the design, coding and debugging • To build the programming skills using 'C' to solve real world problems Course Objectives

  3. On completion of the course, learner will be able to– • Use modular programming approach in diversified problem domains • Apply programming logic to solve real world problems • Decide effectiveness of computer based solutions Course Outcomes:

  4.  Unit I (02 Hrs): Introduction to Computer • Unit II (03 Hrs) : Programming language 'C‘ • Unit III (03 Hrs) : Decision Control Structures, loop control structures and Pointers in 'C': • Unit IV (04 Hrs) : Arrays, Functions and Strings in 'C': Course Contents

  5. Block diagram of typical Computer, hardware, software. • Introduction to System Software- Operating System, Editor, Complier, Assembler, Linker, Loader. • Problem solving using computers • Introduction to computer programming • Introduction to program planning tools- algorithm, flowcharts, pseudo codes • Software Development Life Cycle • Introduction to open source operating systems and programming languages • Introduction to program development environments: BOSS and GCC. Unit I (02 Hrs): Introduction to Computer

  6. Block diagram of typical Computer

  7. Output Unit • Input Unit • Storage Unit (Primary and Secondary) • Cache Memory • Flash Memory • CPU (ALU, CU, Registers) • Registers (PC, IR, DR, MAR, MBR, ACC, GPR) Components of Typical Computer

  8. Difference Between Primary and Secondary Memory

  9. There are two types of software. a) System Software b) Application Software. • System Software: System software is a computer software designed to provide services to other software. Examples: Operating System, Compiler, Assembler, BIOS etc • Features of System Software Introduction to System Software

  10. Application software is computer software designed for end users to satisfy their requirements. Application software engineers are going to develop Application Software with the help of various system software designed by system software engineers. • Examples: Web browsers, spreadsheets, word processors, media player, Inventory Management Software, Ticket Reservation Software, Payroll Software, Microsoft Office, Internet Banking Software etc • Features: Application Software

  11. Operating System is an interface between user and computer hardware. • Ex. Microsoft Series OS, Unix, Linux, Mac OS etc • Linux is Unix clone written by Linus Torvalds. Linux is open source. • Functions of Operating System Operating System:

  12. Services of Operating System Types of Operating System • 1. Simple Batch Operating System • 2. Time Sharing Operating System • 3. Distributed Operating System • 4. Network Operating System • 5. Real Time Operating System

  13. Properties of OS

  14. Editor: Sometimes called text editors is a program that enables users to create, edit, store and print text files. Ex.xedit, vi, emacs, gedit, sedetc Types of Editors: • Line Editors: • Stream Editors: ex. sed • Screen Editors:ex. vi editor • Word Processors: ex. MS word, Google Docx, LibreOffice Writer, Ted, Kwordetc • Structure Editors: ex. Procompass editor, 4d editor etc Note: Line and stream editors are suitable for text only documents. Editors

  15. Preprocessors: Preprocessors programs perform Preprocessing. Preprocessing is done before compilation. It includes operations like expanding macros, replacing header files with its corresponding source code, removing comments. Preprocessors:

  16. A compiler is a software program that converts high-level source code into low-level object code (binary code) in machine language. This process of converting high-level program into machine language is called as compilation. Important task of compiler is the detection and reporting of errors and warnings. Phases in Compilation: • Lexical Analyzer • Syntax Analyzer • Semantic Analyzer • Intermediate Code Generator • Code optimizer • Code Generator Compilers

  17. An assembler converts assembly language program into its equivalent machine language program. It also produces some information for the loader. An assembler is referred as compiler of assembly language. It also provides services of an interpreter. A linker is a program that combines two or more separate object programs and supplies the information needed to allow references between them Loader (one of the operating system utility) is a program which takes object code as input, prepares it for execution and loads the executable code into the memory. Loader is responsible for initiating the execution of the process. Assemblers, Linker & Loader

  18. Source Program in High Level Language (example.c) --> • [Preprocessor] --> Preprocessed Program (example.i) --> • [Assembler] --> Equivalent assembly language code (example.s) --> • [Compiler] --> Object or Target Code in Machine Language (example.o)--> • [linker] --> Executable Code (example.exe)--> • [Loader] Building Process of C Programming

  19. 1. Analysis: Understand (Define) the problem statement. 2. Specification: Specify what the solution must do. 3. Generic Solution: Specify problem solving approach, suitable data structures etc 4. Verify: Checking the correctness of the solution. Check whether the proposed solution really solves the problem. 5. Implementation: Implement the algorithm using any suitable programming language 6. Testing: Test your program. Your program should give legitimate output for all legitimate inputs. If not, find the cause and rectify them. 7. Deployment: Deploy at the end user side 8. Maintain: Modify the program to meet changing requirements. Problem Solving using Computers

  20. Classification of Computer Programs

  21. Algorithms • Flowcharts • Pseudo Codes Introduction to Program Planning Tools

  22. Definition 1: An algorithm is a step by step procedure to solve a problem. • Definition 2: An algorithm is a sequence of unambiguous instructions for obtaining a required output for any legitimate input in a finite amount of time. Algorithms

  23. Simple Language: Should be written in simple English. • Non-ambiguity: It should be clear and precise. There should not be any conflicts • Range of Input: should be specified, if not algorithm will move to infinite state • Definitive (Definiteness): Every statement should be definitive. • Multiplicity: Same algorithm can be represented in several ways. • Speed: should be fast • Effectiveness: Algorithm should do the right thing • Finiteness: Algorithm should terminate after performing required operation. Properties of Algorithms

  24. Algorithm Addition (a,b) • //Problem Description: Addition of two numbers • //Input: Two integers a and b • //Output: Addition of a and b • Step 1: START • Step 2: Add a and b. Store result in c. • Step 3: Print c. • Step 4: STOP Algorithms Example

  25. Algorithm GCD_Euclid (a,b) • //Problem Description: Algorithm for computation of GCD of two numbers a and b using Euclid’s method • //Input: Two integers a and b • //Output: GCD of a and b • Step 1: START • Step 2: Divide a by b. Let r be the reminder. • Step 3: If r is 0 then b is the answer. Print b. STOP. If r is not 0, Go to step 4. • Step 4: Set a=b, b=r and go back to Step 2. Algorithms Example

  26. Algorithm Factorial (n) • //Problem Description: Algorithm for calculating factorial of a number • //Input: Integers n • //Output: Factorial of n • Step 1: START • Step 2: Initialize factorial=1 and i=1 • Step 3: If i>n, Print factorial and STOP. Else go to Step4. • Step 4: factorial=factorial*i; • Step 5: i=i+1; • Step 6: Go to Step 3. Algorithms Example

  27. Definition: Flowchart is a diagrammatic representation of an algorithm. Flowcharts are helpful when explaining (Knowledge Transfer, KT) programs to others. Benefits of flowcharts are grasping will be easy and fast. Advantages of Flowcharts: • Effective Communication, Analysis, Coding, Debugging • Proper Documentation • Easy Maintenance Flowcharts

  28. Basic Flowchart Symbols

  29. Flow Chart for GCD Program (using Euclid’s algorithm)

  30. Pseudocodeis a simple way of writing programming code in English. It is not an actual programming language. Pseudocode does not necessarily have the correct syntax for any programming language and can’t be used immediately. Pseudocode can be used as base for writing programs in any programming language. Pseudo Codes

  31. Start • Input p and q • sum=p+q • print sum • Stop Pseudocode for adding two numbers

  32. Start • Input a,b and c • sum=a+b+c • avg=sum/3 • print avg • Stop Pseudocode for calculating average of three numbers

  33. Software Development Life Cycle (SDLC) defines the phases in the building of software. Phases of SDLC are • 1. Requirement Gathering and Analysis: All the relevant information required to develop software is gathered and analysis of the same is done. • 2. Design: Defining overall system architecture • 3. Implementation or coding: Implement using suitable programming language • 4. Testing: Your system should give legitimate output for all legitimate inputs. If not, find the cause and rectify them. • 5. Deployment: Deploy the system at the end user side • 6. Maintenance: Modify the system to meet changing requirements of end user. Software Development Life Cycle:

  34. A SDLC model is a standardized format for planning, organizing and running a new development project. There are many SDLC Models are available. Some of the popular models are • 1. Waterfall Model • 2. Iterative and incremental development • 3. Spiral Model • 4. Agile Development • 5. Rapid Prototyping • 6. Unified Process SDLC models

  35. Open Source Software (OSS): OSS is usually developed as a public collaboration. OSS's source code is made available to the public at free of cost. Anybody can get the source code from internet or from any other sources. You can use the source code for your use, for study purpose, you can modify if you want and redistribute it. • Open Source Operating System: • Open Source Programming Languages: Introduction to open source operating systems and programming languages

  36. BOSS (Bharat Operating System Solutions) is a GNU/Linux distribution developed by C-DAC, Chennai in order to benefit the usage of Free/Open Source Software in India and is customized to suit Indian's digital environment. • BOSS Variants • BOSS Desktop: An Indian GNU/Linux distribution customized for Indian environment. • EduBOSS: An educational variant of BOSS GNU/Linux focusing Indian schools. • Advanced Server: Server variant of BOSS GNU/Linux supports Intel and AMD architectures. • BOSS MOOL: MOOL aims at redesigning the linux kernel with minimal core OO components. • Source:https://bosslinux.in Introduction to Program Development Environments: BOSS

  37. The GNU Compiler Collection (GCC) is an integrated collection of compilers developed by GNU project. • The GCC includes front ends for C, C++, Objective-C, FORTRAN, Java, Go and ADA. • The Free Software Foundation (FSF) distributes GCC under the GNU General Public License (GNU GPL). • GCC is a key component of the GNU tool-chain. • GCC was originally written as the compiler for the GNU Operating System. • The GNU system was developed to be free (it respects the user's freedom) software. • The goal of GCC is to be a useful compiler for general use. • The design and development goals of GCC are to support new languages, new optimizations, and faster debug cycle, improved run time libraries GCC:

  38. 1. To install gcc in fedora, run $sudo yum install gcc-c++ • 2. Open any editor and give file name. ex. $vi hello.c • 3. Press I to insert. Write complete code. • 4. To save and quit: press ESC, SHIFT, : and type wq • 5. To compile: $gcchello.c • 6. To run: $./a.out How to use GCC?

More Related