1 / 18

Revision

Revision. Language generations Two’s and One’s Complement and Sign and Magnitude. Language G enerations: Evolution of Programming Languages . First Generation . The first generation of languages was very difficult to understand and also to code

deepak
Download Presentation

Revision

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. Revision Language generations Two’s and One’s Complement and Sign and Magnitude

  2. Language Generations:Evolution of Programming Languages

  3. First Generation • The first generation of languages was very difficult to understand and also to code • This language was based on machine code language, hence the programmer would need to use binary • For this particular generation, punched tape was used, where a hole would represent a 1 and no-hole meant a 0.

  4. Second Generation / Assembly Language • The second generation language, was also based on machine code, • This language was much easier as it used mnemonics (short words) • Programming was much easier because the programmer did not have to remember a list of binary digits • Keywords are used in this language such as ADD, SUB, JMP, MUL, etc

  5. Third Generation / High-level Language • The third generation of languages was a very big improvement from the second generation • This generation incorporated the use of English-like statements • Examples of 3GLs are C, C++, Pascal and JAVA.

  6. Examples of the 3rd Generations • FORTRAN - mathematics formulas, scientific problems, engineering problems • COBOL – business oriented • BASIC – very easy to understand, ideal to learn programming • PASCAL – mostly used for teaching purposes • C – used to write operating systems, database management system, scientific applications • LISP – artificial intelligence • LOGO – teach children problem-solving and programming skills • C ++ - An improved C, very popular and powerful • JAVA – Very popular and powerful, also cross-platform

  7. Fourth Generation • The fourth generation language is a is much closer to the human language • A typical example of the ease of use of 4th generation languages is the creation of a GUI. • To create a GUI in JAVA would be quite difficult because of the code required for each component, with any 4GL creating an interface is a simple matter of drag and drop • This generation is used a lot with databases

  8. Fifth Generation • Lastly we have the fifth generation languages, which are the closest to the human language • This generation is used in artificial intelligence

  9. Number Systems:Two’s and One’s Complement and Sign and Magnitude

  10. Complementation • Complementation is used to represent positive and negative numbers in binary • This system requires numbers to be represented by a fixed register size. • There are two forms of complementation, one’s complement and two’s complement.

  11. Ones Complement • One’s complement is used to represent negative numbers • Lets say we have 4510 • When using 8 bits 4510 = 001011012 • If we change 4510 to -4510 The binary representation changes by converting 0s to 1s and 1s to 0s; 001011012 110100102. after ones complement

  12. Examples -8910 -6410

  13. Two’s Complement • Two’s complement allows us to perform subtractions with binary numbers • With two’s complement we start converting 1s to 0s and 0s to 1s after the first 1 • Lets take the previous example of -4510,

  14. Examples -5510 -6010

  15. Sign and Magnitude • When we have a fixed register we might want to store our binary number in a certain way • The three ways are using; • sign and magnitude (first digit is 0 = positive, first digit is1 = negative) • one’s complement • two’s complement.

  16. Example • Lets say I have an 8 bit register and want to store -1410 • The number changes since it is negative, we first change it to binary = 000011102

  17. Example 2 • Lets say I have an 8 bit register and want to store 1410 • The number does not change since it is a positive number, we first change it to binary = 000011102

More Related