1/38
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
What is abstraction in programming/computer science?
A view or representation of an entity that includes only the most significant attributes
What two conditions must a user-defined ADT satisfy?
The type and its operations are declared in a single syntactic unit; only declared operations can be performed on the type
How do abstraction and information hiding differ?
Abstraction is a high-level view independent of implementation; information hiding conceals irrelevant implementation details
Give two advantages of declaring an ADT and its operations in one syntactic unit.
Improved organization and maintainability; supports separate compilation and reuse
What is a key advantage of restricting ADT operations to those declared for the ADT?
The implementation can change without affecting client code
List two primitive operations languages typically supply for ADTs.
Assignment/cloning; equality comparison; serialization
What are the two possible ADT orientations?
Procedure-oriented and object-oriented
Name a procedure-oriented programming language.
Ada
How do you push onto a procedure-oriented ADT stack syntactically?
Push(Stack, 42)
How do you push onto an object-oriented ADT stack syntactically?
stack.push(42)
What key feature do object-oriented ADTs provide that procedure-oriented ADTs do not?
Inheritance
Which ADT orientation is superior for readability?
Object-oriented ADTs
Which ADT orientation is superior for writability?
Object-oriented ADTs
Which ADT orientation is superior for reliability?
Procedure-oriented ADTs
Why do C++ classes support destructors as well as constructors?
Because C++ lacks garbage collection and must explicitly free heap storage
What is a key difference between Ruby classes and classes in C++, Java, and C#?
Ruby classes are dynamic and can be modified at runtime
What is encapsulation in computer science?
The bundling of related data and operations, often with information hiding
What is the relationship between encapsulation and ADTs?
ADTs are one form of encapsulation that bundle data with operations
List two forms of encapsulation other than ADTs.
Nested subprograms; file encapsulation; component encapsulation
What primary Java feature supports the creation of components?
Packages
What two things are required to include a Java class in a package?
Add a package declaration and place the file in the corresponding directory
Where is a public Java instance variable visible?
Everywhere
Where is a private Java instance variable visible?
Only within the defining class
Where is a package-level Java instance variable visible?
To all classes in the same package
What is the purpose of a namespace?
To create a new scope for names and avoid name conflicts
What keyword defines namespaces in Java?
package
What keyword defines namespaces in Ruby?
module
What keyword defines namespaces in C++?
namespace
How can C++ private variables potentially be accessed outside the class?
Through friend classes
What Ruby feature other than inheritance can violate ADT conditions?
Dynamic modification of classes at runtime
What Java keyword allows a method to be called on the class itself?
static
How does declaring an ArrayList variable as static affect its usage?
The variable is shared by all instances of the class
How can procedure-oriented ADTs be simulated in Java?
Using class methods that operate on objects passed as parameters
Why can object-oriented ADTs not be simulated in purely procedural languages?
Because procedural languages lack methods bound to objects and inheritance
Give two purposes of a Java package.
Create components and provide a namespace
What is the access level of a Java member with no access modifier?
Package-private
What is a friend class in C++?
A class granted access to another class’s private members
How can friend-class behavior be approximated in Java?
Using package-private members visible to all classes in the same package