Home > Flashcards > Print Preview
The flashcards below were created by user
on FreezingBlue Flashcards. What would you like to do?
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.
Name three third-generation languages.
FORTRAN, COBOL, BASIC, C.
What does a compiler do?
A compiler translages the third generation language (TGL) code into the computer's machine language.
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.
*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.
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.
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.
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.
________________ are used to specify how the bit patterns used to represent data should be interpreted by the program.
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)
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.
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.
What are the 4 principles of Object-oriented programming?
- 1) Encapsulation
- 2) Abstraction
- 3) Inheritance
- 4) Polymorphism
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)
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).
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.
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).