1/26
Flashcards reviewing abstract data types, encapsulation concepts, and their implementation in various programming languages.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
What is an abstraction?
A view or representation of an entity that includes only the most significant attributes.
What is an abstract data type?
User-defined data type where object representation is hidden, and type/operation declarations are in a single syntactic unit.
What are the advantages of hiding data representations in ADTs?
Reliability, reduces code range, less name conflicts.
What are the advantages of having type and operation declarations in a single unit in ADTs?
Program organization, aids modifiability, separate compilation.
What are the language requirements for ADTs?
A syntactic unit for type definition, method to make names visible while hiding definitions, and some built-in primitive operations.
What are the key design issues for ADTs?
Can abstract types be parameterized, what access controls are provided, is the specification separate from the implementation?
In C++, what are the purpose of private, public, and protected clauses?
Private: hidden entities. Public: interface entities. Protected: inheritance.
What are constructors in C++?
Functions to initialize data members of instances.
What are destructors in C++?
Functions to clean up after an instance is destroyed, usually to reclaim heap storage.
Why are friend functions or classes necessary in C++?
To provide access to private members to unrelated units or functions.
How does Java differ from C++ in its data abstraction implementation?
All user-defined types are classes, objects are heap allocated with reference variables, implicit garbage collection, package scope.
What access modifiers does C# add beyond those in C++ and Java?
Internal and protected internal.
What are structs in C#?
Lightweight classes that do not support inheritance.
What is a common solution for needing access to data members in C#?
Accessor methods (getter and setter).
What are properties in C#?
Way of implementing getters and setters without explicit method calls.
What is a Parameterized Abstract Data Type?
ADT that can store any type elements.
How are Parameterized ADTs implemented in C++?
Classes can be somewhat generic by writing parameterized constructor functions.
How are Parameterized Classes implemented in Java 5.0?
Generic parameters must be classes; common types are collection types.
What is encapsulation?
A grouping of subprograms that are logically related into a unit that can be separately compiled.
What are Nested Subprograms?
Organizing programs by nesting subprogram definitions inside larger subprograms.
How is encapsulation implemented in C?
Files with subprograms independently compiled, interface in a header file.
How is encapsulation implemented in C++?
Classes and Friend functions
What are C# Assemblies?
A collection of files appearing as a single dynamic link library or executable.
What is a naming encapsulation?
Used to create a new scope for names.
How are Naming Encapsulations implemented in C++?
Place each library in its own namespace; qualify names used outside with the namespace.
How are Naming Encapsulations implemented in Java Packages?
Clients can use fully qualified name or use the import declaration
How are Naming Encapsulations implemented in Ruby Modules?
Ruby classes are name encapsulations; modules encapsulate constants and methods.