GoConqr has a new look! Let us know what you think.

Flashcards

Organization of Programming Languages Chapter 11

James Herd Social Issues and Ethics in CS English 40 cards

Cards in this deck (40)

  1. 1This is a view or representation of an entity that includes only the most significant attributesabstraction
  2. 2(true/false) Nearly all programming languages support process abstraction with subprogramsTrue
  3. 3Which 2 conditions need to be satisfied to have a user defined abstract data type?-the representation of objects of the type is hidden from the program units that use these objects, so the only operations possible are those provided in the type's definition-The declaration of the type and the protocols of the operations on objects of the type are contained in a single syntactic unit. Other program units are allowed to create variables of the defined type.
  4. 4What are the advantages of the first condition of abstraction? (The representation of objects of the type is hidden from the program units that use these objects, so the only operations possible are those provided in the type's definition)Reliability--by hiding the data representations, user code cannot directly access objects of the type or depend on the representation, allowing the representation to be changed without affecting user code
    Reduces the range of code and variables of which the programmer must be aware
    Name conflicts are less likely
  5. 5what are some advantages of the Second condition of abstraction? (The declarations of the type and the protocols of the operations on objects of the type are contained in a single syntactic unit. Other program units are allowed to create variables of the defined type.)-Provides a method of program organization
    -Aids modifiability (everything associated with a data structure is together)
  6. 6What are Language requirements for an ADT-Syntactic unit in which to encapsulate the type definition
    -A method of making type names and subprogram headers visible to clients, while hiding actual definitions
    -Some primitive operations must be built into the language processor
  7. 7What are some design issues of abstract data typesCan abstract types be parameterized?
    What access controls are provided?
    Is the specification of the type physically separate from its implementation?
  8. 8What are some characteristics of a constructor (C++)?-Functions to initialize the data members of instances (they do not create the objects)
    -May also allocate storage if part of the object is heap-dynamic
    -Can include parameters to provide parameterization of the objects
    -Implicitly called when an instance is created
    -Can be explicitly called
    -Name is the same as the class name
  9. 9What are the characteristics of destructors? (C++)-Functions to cleanup after an instance is destroyed; usually just to reclaim heap storage
    -Implicitly called when the object’s lifetime ends
    -Can be explicitly called
    -Name is the class name, preceded by a tilde (~)
  10. 10What is it that provides access to private members to to some unrelated units or functionsFriend functions or classes
    Necessary in C++
  11. 11What are constructors called?Initializers - all they do is initialize variables
    (objective-C)
  12. 12what are some characteristics of Initializers?-Initializers can have any name - they are always called explicitly
    -Initializers always return self
  13. 13In Objective-C how are objects created?Created by calling "alloc" and the constructor
    Adder *myAdder = [[Adder alloc] init];
  14. 14All class instances are what?heap dynamic
  15. 15With regards to information hiding, which directives are used to specify the access of instance variables? (Objective-C)@private
    @public
  16. 16With regards to information hiding, what is the default access in objective-C and C++Objective-C: protected
    C++: private
  17. 17Parameterized ADTs allow designing an ADT that can store what?any type elements
    (only an issue for static typed languages)
  18. 18A parameterized ADT that can store any type elements are also known as what?Generic Classes
  19. 19which programming languages provide support for parameterized ADTs?C++, Java 5.0, and C# 2005
  20. 20how can class be made somewhat generic?by writing parameterized constructor functions
  21. 21what are the 2 special needs that programs have?-Some means of organization, other than simply division into subprograms
    -Some means of partial compilation (compilation units that are smaller than the whole program)
  22. 22A grouping of subprograms that are logically related into a unit that can be separately compiled (compilation units)Such collections are called encapsulation
  23. 23Organizing programs by nesting subprogram definitions inside the logically larger subprograms that use themNested Subprograms
  24. 24In C, files containing one or more subprograms can what?be independently compiled
  25. 25In C, where is the interface placed?a header file
  26. 26What are 2 encapsulation problems in C?Problem 1: the linker does not check types between a header and associated implementation
    Problem 2: the inherent problems with pointers
  27. 27In C, what is the preprocessor specification - used to include header files in applications?#include
  28. 28In what ways can classes in C++ be used for encapsulation?-The class is used as the interface (prototypes)
    -The member definitions are defined in a separate file
  29. 29In C++ what keyword is used to grant access to private members of a class?Friends
  30. 30A collection of files that appears to application programs to be a single dynamic link library or executableC# Assemblies
  31. 31This is a collection of classes and methods that are individually linked to an executing programDLL (Dynamically linked libraries)
  32. 32A C# access modifier that gives a member visibility to all classes in the assembly in which it appearsinternal
  33. 33What is used to create a new scope for names?Naming Encapsulation
    Large programs define many global names; need a way to divide into logical groupings
  34. 34Describe C++ Namespaces-can place each library in its own namespace and qualify names used outside with the namespace
    =C# also includes namespaces
  35. 35Describe Java packages-Packages can contain more than one class definition; classes in a package are partial friends
    -Client of a package can use fully qualified name or use the import declaration
  36. 36Along with classes and name encapsulations, Ruby also has...modules
  37. 37In Ruby what is typically encapsulated?constants and methods
  38. 38what are things that Modules cannot do in Ruby?cannot be instantiated or subclassed, and they cannot define variables
  39. 39what must methods defined in a ruby module have included?the modules name
  40. 40how is access to the contents of a Ruby module requested?with the require method

Information

Description
Social Issues and Ethics in CS Flashcards on Organization of Programming Languages Chapter 11, created by James Herd on 25/04/2019.
Created by
James Herd
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?