Module 7 Flashcards
Which of the following are true about Java objects?
A. The attributes in an object contain specific values
B. Once attributes in an object are initialized all methods within that object have access to that data
C. Objects only contain methods
D. Objects are instantiated from classes
E. Only one object can be instantiated from a given class
A. The attributes in an object contain specific values
B. Once attributes in an object are initialized all methods within that object have access to that data
D. Objects are instantiated from classes
Which of the following are true about Java objects?
A. Objects define methods and attributes
B. A program can only have one object created from a specific class
C. The actual variables associated with an object are called instance variables
D. Objects are created from classes in Java by using the new keyword
E. Objects are the blueprints for classes
C. The actual variables associated with an object are called instance variables
D. Objects are created from classes in Java by using the new keyword
What does a Java class definition contain?
A. Constructors
B. Computation methods
C. get and set methods
D. instance variables
All of the above
Which of the following are true about the default constructor?
A. It sets integer fields to 0
B. It is the only way to create an object from a class
C. It must be defined in the class body
D. It sets the class’s reference variables to a default value defined by the programmer
E. It doesn’t have any parameters
A. It sets integer fields to 0
E. It doesn’t have any parameters
Why is data hiding important to object oriented programming?
A. Without data hiding, outside objects could accidentally corrupt the instance variables of an object
B. A programmer must know the details of how the method works before using it, thus there is greater understanding about how the code works among all programmers
C. Objects can work in insolation from each other making code maintenance easier
D. The programmer who maintains an object can make changes to how an object works without worries of how it impacts another object
E. Since data in an object can’t be changed by an outside object, the data is protected from accidental corruption
A. Without data hiding, outside objects could accidentally corrupt the instance variables of an object
C. Objects can work in insolation from each other making code maintenance easier
D. The programmer who maintains an object can make changes to how an object works without worries of how it impacts another object