ch 9.txt

Card Set Information

ch 9.txt
2015-02-22 21:12:33
diane cs111
diane cs111 ch9
Show Answers:

  1. Why were third-generation languages developed?
    They are structured to avoid considering machine operations at all, instead concentrating on relatively straightforward instructions on how the data is being manipulated.
  2. Name three third-generation languages.
  3. What does a compiler do?
    A compiler translages the third generation language (TGL) code into the computer's machine language.
  4. Why are compilers such a step forward?
    Because a TGL program written on one machine can be run on any other computer, as long as that computer has a compiler for the TGL.
  5. *What are the three steps in compilation?
    • 1) Lexical analysis - examines the TGL program (source program) and determines which strings of characters form separate items. (e.g., "if", "count", etc)
    • 2) Parsing - analyzes the grammatical syntax of the program (missing parentheses, etc)
    • 3) Code generation - the compiler generates a program in machine language that is equivalent to the source program.
  6. What is linking? Or, what does a linker program do?
    Linking connects pre-compiled libraries of code (math functions, graphics routines, I/O operations, etc) to the programmer's code prior to execution.
  7. What is loading? Or, what does a loader program do?
    A loader program places the resulting machine code in main memory, tying up all loose ends (e.g., setting instruction addresses for JUMP instructions) so the code is ready for execution.
  8. There are two general types of statements in third-generation languages. Name and describe them.
    • 1) Declarative statements - constant and variable values representing terms that will be manipulated as the program is executed.
    • 2) Imperative statements - the procedural specification of the algorithm itself.
  9. ________________ are used to specify how the bit patterns used to represent data should be interpreted by the program.
    Data types
  10. There are two general types of data types. Name and describe them.
    • 1) scalar - a single-valued data type (integer, floating-point, boolean, character)
    • 2) structured - multi-valued data types. There are two types of these
    • a) built-in - arrays, character strings
    • b) user-defined - specially constructed (an object in an OO programming language)
  11. List and describe the 5 types of imperative statements:
    • 1) Assignment statements - assign a value to a variable
    • 2) Input/output - retrieve external values (input) and to file away or print information (output)
    • 3) Conditional statements - enable alternative steps based on a condition
    • 4) Iterative statements - loop through a sequence of instructions
    • 5) Procedures and functions - used to conveniently write programs in modular fashion.
  12. Describe the evolution of High-Level Programming Languages.
    • Early programming languages like FORTRAN and COBOL were data-driven
    • Later programming languages like C and Pascal were procedure-driven to enhance organizational flexibility and power.
    • Object-oriented programming focuses on structuring programs by defining objects that have attributes and that can perform actions.
  13. What are the 4 principles of Object-oriented programming?
    • 1) Encapsulation
    • 2) Abstraction
    • 3) Inheritance
    • 4) Polymorphism
  14. Describe the 1st principle of OOP, encapsulation.
    Encapsulation means that objects must be created so that they protect their attributes and prevent them from being set to bad values. (e.g., radius of circle set to negative value)
  15. Describe the 2nd principle of OOP, abstraction.
    Abstraction means that you can only use an object by asking it to perform one of its actions. (You don't need to know all the actions an object can perform, or how it performs its actions).
  16. Describe the 3rd principle of OOP, inheritance.
    Inheritance means that you can design general-use objects and then design specialized versions that get the general object's functionality for free.
  17. Describe the 4th principle of OOP, polymorphism.
    Polymorphism means that when a subclass uses a general-use action, it will do that action in its own way, depending on its specialized code. (e.g., characters from the same general type will say hello in the way appropriate to their specific character type).