1/20
Conceptual Questions
Which access modifier means the parameter/method is visible by only the class it is in?
Private
Which access modifier means the parameter/method is visible by any class in the project?
Public
Which access modifier means the parameter/method is visible by any class in the package?
Default
Which part of an Object allows us to identify the type of object it is?
Class
Which part of an Object is used to store data about itself?
Fields or Attributes
Which part of an Object is used to access or manipulate the data that describes itself?
Methods
In your own words, what is Encapsulation?
The practice of bundling an object's data and the methods that operate on that data into a single unit (the class), while strictly controlling access to the internal state using private variables and public getters/setters.
In your own words, what is the difference between static vs. non-static methods and properties?
Static methods and properties belong to the class itself, meaning there is only one shared copy across the entire program. Non-static (instance) methods and properties belong to individual objects, meaning every time an object is instantiated, it receives its own unique copy of those properties.
In your own words, what is an Object’s public interface? What is its purpose?
The collection of public methods a class exposes to the outside world. Its purpose is to define exactly how external code can interact with the object without exposing complex or sensitive internal implementation details.
In your own words, what is an Object’s constructor? What is its purpose?
A special block of code that runs automatically when an object is instantiated. Its primary purpose is to initialize the newly created object's state by setting its starting field values.
In your own words, what is method overloading?
Occurs when a class has multiple methods with the exact same name, but different parameter lists (different data types, a different number of parameters, or a different order).
Which of the data structures we have inspected facilitates storing data in key/value pairs?
HashMap (or Map / HashTable).
Which of the data structures we have inspected facilitates storing data that is dispersed in memory, but acts like an array?
LinkedList
Which of the data structures we have inspected facilitates storing data using the “First In, Last Out” paradigm?
Stack
Which of the data structures we have inspected facilitates storing data using the “First In, First Out” paradigm?
Queue
Which relationship between objects indicates how the objects are related, yet independent?
Association
Which relationship between objects indicates how one object uses the other, but if the first one is destroyed, the second one remains?
Aggregation
Which relationship between objects indicates how one object uses the other, but if the first one is destroyed, the second one is also destroyed?
Composition
Which type of error is described as one that prevents the program from compiling?
Compile-time error (commonly a syntax error)
Which type of error is described as one that causes the program to crash?
Runtime error (often results in an exception)
Which type of error is described as one that does not cause the program to crash, but results in incorrect output?
Logic error