Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Chapter 5( programming) answer


Published on

Published in: Technology
  • Be the first to comment

Chapter 5( programming) answer

  1. 1. Chapter : Basic Programming Concepts Is a series of organized instructions that directs a computer to perform tasks. Without programs, computer are useless PROGRAM Is a creation of a set of commands or instruction which directs a computer in carrying out a task. A set of words, symbols and codes that enables humans to Communication with computers. Someone who writes computer programs. PROGRAMMING PROGRAMMING LANGUAGE PROGRAMMER
  2. 2. GENERATIONS OF PROGRAMMING LANGUAGE Provides little or no abstraction from Computer’s microprocessor. More abstract, easier to use, & more portable across platforms. Low level PL High Level PL 1 GL Machine Language Eg: Binary code 2 GL Assembly Language 5 GL Visual programming Language / natural language Eg: Prolog, Mercury 4 GL Non-procedural Language Eg: SQL, NOMAD, FOCUS 3 GL Procedural Language Eg: PASCAL, FORTRAN, BASIC, COBOL, C++..
  3. 3. Open programming language (OPL) Is an embedded programming language found in portable devices that run the Symbian Operating system. Eg: mobile telephones and PDAs.
  4. 4. Programming Approaches <ul><li>Uses a top- down design model </li></ul><ul><li>whole program is broken down </li></ul><ul><li>Into smaller sections. </li></ul><ul><li>Object –oriented programming (OOP) </li></ul><ul><li>Type of programming approach </li></ul><ul><li>That Combines data with functions </li></ul><ul><li>to create object. </li></ul>Ada, Pascal, Fortran Smalltalk, Java, Visual Basic, C++ Structured Programming Examples: Examples:
  5. 5. Translator Computer program for Translating assembly language Into machine Language Used to interpret & execute Program direct from its source Without compiling it first. Source code will be Converted into Machine Code which is a file consisting Of binary machine code that is executed On a computer. If any errors, it record them in the program listing file. BASIC, LOGO, SMALLTALK MACRO-80, Microsoft MASM C++, PASCAL, COBOL Examples Examples Examples Assembler interpreter Compiler
  6. 6. 5 Basic Element in programming Data type Variables Constants Operators Control structure
  7. 7. Constant & Variables Const Margin = 10 Differences between constant and variables Constant variables Margin = 10 Variable ‘ Definition Characteristics Usage Examples Elements Is a virtual data container that Stores information. Is a virtual data container that Stores information. Value is not changeable during the Course of the program Value can be changed anytime during the Course of the program When you want to declare something that won’t change midway in your program execution. Use variable to store data that May or will change during the Running of the program.
  8. 8. Data Types Definition: determines the type of data a variable can store. Data types Definition Examples Sample usage Integer Number value does not have fractional part 0, 1, 25, 99 …. Dim Double Contain a fractional part 41.5, 31.4 String Sequence of characters Kok Leong, Amira String Boolean Consists either True or False TRUE, FALSE
  9. 9. Operators Operators Definition Examples/ symbols Mathematical operators Are notations that tell the computer To perform mathematic operations +, -, *, / , Relational Operators Logical Operators Performs comparison between Two elements Performs logical operations , Checking the condition of two Boolean values. =, >,<, <=, >= AND, OR, NOT
  10. 10. Examples A = B A = B A = B A >= B A <= B Equal to Greater than Less than Greater than or equal to Less than or equal to
  11. 13. Logical operator AND OR NOT “ NOT” OPERATORS “ AND” OPERATORS “ OR” OPERATORS 1 REPRESENT “TRUE”, 0 REPRESENT “FALSE” VALUE TRUTH VALUE X Y X AND Y 0 0 0 0 1 0 1 0 0 1 1 1 VALUE TRUTH VALUE X Y X OR Y 0 0 0 0 1 1 1 0 1 1 1 1 VALUE TRUTH VALUE X NOT X 0 1 1 0
  12. 14. PSEUDO CODES <ul><li>DEF: is text only sentences that describe </li></ul><ul><li>the logic and program flow of a computer program. </li></ul><ul><li>Pseudo code esembles plain English. </li></ul><ul><li>Do not have any specific progamming language snytax and grammar. </li></ul>
  13. 17. Flow chart Begin End READ Length, Width, Height DISPLAY Volume of Cuboid Volume of cuboid= Length* Width* Height
  14. 18. ELEMENTS IN FLOWCHART Elements Description Terminator Shows the beginning or end of a program Flowline and arrowhead Connect symbols and indicate the sequences of operation Input or Output Shows either an input operation (an INPUT from the user) or an output operation (PRINT some message) Process Process to be carried out (e.g calculation) Decision Shows a decision (or choice) to be made. The program should continue along one of two routes (e.g if…else)
  15. 19. Control structures Definition: is a structure of statement in programming that allows the programmer to control the flow of a program. <ul><li>Linear </li></ul><ul><li>execution </li></ul><ul><li>Selection </li></ul><ul><li>control </li></ul><ul><li>To make decision </li></ul><ul><li>Based on the situation </li></ul><ul><li>Given. </li></ul><ul><li>Repetition </li></ul><ul><li>Control </li></ul><ul><li>looping </li></ul>Sequence Control Draw flow chart For sequence control True and false Repeat while some Condition remains true
  16. 20. Differentiate between selection control and sequence control Types of control structure Execution flow Usage Flow chart Sequence control Selection control m/s 33 chapter programming Linear execution Execute line by line Execute different Statement for Different conditions To implement decision Making.
  17. 21. DEVELOP A PROGRAM <ul><li>Examples of how user apply program development phases to solve problem: </li></ul>
  18. 22. PROGRAM DEVELOPMENT 5 MAIN PHASES Of PROGRAM DEVELOPMENT PROBLEM ANALYSIS PHASE <ul><li>interview the client, find out what the client’s need are. </li></ul>PROGRAM DESIGN PHASE <ul><li>design a flow chart. </li></ul>Coding phase <ul><li>perform coding </li></ul><ul><li>Checking error, and do debbuging </li></ul>Testing and debugging phase Documentation phase <ul><li>user manual, a clear layout, program listing </li></ul>
  19. 23. <ul><li>Syntax Error </li></ul><ul><li>Wrong </li></ul><ul><li>spelling </li></ul><ul><li>Logic Error </li></ul><ul><li>the output </li></ul><ul><li>do not match </li></ul><ul><li>for any set </li></ul><ul><li>of data </li></ul><ul><li>Run-Time Error </li></ul><ul><li>Error occurs while </li></ul><ul><li>The program is </li></ul><ul><li>running </li></ul><ul><li>Or executing. </li></ul>Errors
  20. 24. The latest type of programming languages <ul><li>Fifth generation </li></ul><ul><li>languages </li></ul><ul><li>Advance programming </li></ul><ul><li>language </li></ul><ul><li>Natural language </li></ul><ul><li>English to write </li></ul><ul><li>a program </li></ul><ul><li>Open GL </li></ul><ul><li>(Graphic Library) </li></ul><ul><li>3D/2D computer </li></ul><ul><li>Graphic application </li></ul>