What best describes Object-Oriented Programming?
1. Writing only functions
2. Organizing code around objects
3. Avoiding data types
4. Using only classes
2. Organizing code around objects
What is a class best described as?
1. A stored object
2. A blueprint
3. A variable
4. A method
2. A blueprint
When your program uses a class written by someone else, it is a:
1. Server
2. Compiler
3. Client
4. Library
3. Client
Instance variables are also known as:
1. Parameters
2. Fields
3. Arguments
4. Methods
2. Fields
What does an instance method operate on?
1. A class
2. A compiler
3. A specific object
4. A file
3. A specific object
Which pair correctly represents the two core components of an object?
1. Class and instance
2. State and behavior
3. Methods and loops
4. Fields and files
2. State and behavior
What is an instance?
1. A method inside a class
2. A template
3. A specific object
4. A data type
3. A specific object
What is data encapsulation?
1. Sharing all variables
2. Hiding implementation details
3. Using global variables
4. Writing fewer methods
2. Hiding implementation details
Why does each object have its own copy of instance variables?
1. To save memory
2. To share data
3. To store independent state
4. To run faster
3. To store independent state
Which keyword prevents direct access to instance variables?
1. public
2. static
3. private
4. void
3. private
Which of the following is an example of state?
1. calculateArea()
2. printInfo()
3. width
4. toString()
3. width
What does it mean to instantiate a class?
1. To delete an object
2. To copy a method
3. To create an object
4. To rename a class
3. To create an object
Why is encapsulation beneficial to clients?
1. It removes constructors
2. It hides class data
3. It simplifies client code
4. It avoids objects
3. It simplifies client code
What is the main purpose of a constructor?
1. Print data
2. Create objects
3. Call methods
4. Import libraries
2. Create objects
What part of a method defines its name and parameters?
1. Visibility
2. Return type
3. Signature
4. Body
3. Signature
Which of the following is an example of behavior?
1. height
2. name
3. area()
4. gradeLevel
3. area()
Which naming convention follows Java standards?
1. student → Class
2. Rectangle → Object
3. Student → Class
4. rectangle1 → Class
3. Student → Class
What information does the Method Summary provide?
1. How methods are written
2. What methods do
3. Memory usage
4. Variable values
2. What methods do
What happens if no constructor is written?
1. Program crashes
2. Object cannot be created
3. Java adds a no-argument constructor
4. Values are random
3. Java adds a no-argument constructor
How is an instance method called?
1. method(object)
2. class.method()
3. object.method()
4. method.class()
3. object.method()
Why is OOP useful when programs become larger?
1. It removes the need for methods
2. It reduces the need for variables
3. It improves organization and reuse
4. It eliminates bugs
3. It improves organization and reuse
Why doesn’t a class hold actual data values?
1. It runs too slowly
2. It is only a template
3. It lacks methods
4. Java prevents it
2. It is only a template
The bank analogy mainly demonstrates:
1. Inheritance
2. Abstraction
3. Polymorphism
4. Compilation
2. Abstraction
Why is the toString() method useful?
1. It edits variables
2. It converts objects to integers
3. It provides readable object output
4. It creates objects
3. It provides readable object output
Which is NOT a reason to use getters and setters?
1. Validation
2. Safety
3. Abstraction
4. Faster execution
4. Faster execution