Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A comprehensive review of the key concepts in object-oriented programming (oop), including classes, objects, methods, attributes, inheritance, encapsulation, and polymorphism. It covers true/false and multiple-choice questions that assess the understanding of these fundamental oop principles. Likely intended as a study guide or exam preparation material for a university-level course on management information systems or computer science, focusing on the object-oriented programming paradigm. The review covers topics such as the characteristics of objects, the structure and purpose of classes, the relationships between classes, the access modifiers for class members, and the differences between static and instance methods. By studying this document, students can deepen their understanding of the core oop concepts and be better prepared to apply them in programming assignments, projects, and exams.
Typology: Exams
1 / 8
Chapter 10: Object-Oriented Programming
ANS: T PTS: 1 REF: 408
ANS: F PTS: 1 REF: 411
ANS: T PTS: 1 REF: 411
ANS: T PTS: 1 REF: 417
ANS: F PTS: 1 REF: 421
ANS: T PTS: 1 REF: 424
ANS: F PTS: 1 REF: 432
ANS: T PTS: 1 REF: 435
ANS: F PTS: 1 REF: 435
ANS: D PTS: 1 REF: 408
ANS: B PTS: 1 REF: 408
ANS: B PTS: 1 REF: 409
ANS: B PTS: 1 REF: 409
ANS: A PTS: 1 REF: 410
ANS: C PTS: 1 REF: 410
ANS: A PTS: 1 REF: 410
ANS: D PTS: 1 REF: 411
ANS: C PTS: 1 REF: 411
ANS: C PTS: 1 REF: 411
ANS: A PTS: 1 REF: 413
ANS: B PTS: 1 REF: 415
ANS: D PTS: 1 REF: 416
ANS: D PTS: 1 REF: 416
ANS: A PTS: 1 REF: 417
ANS: C PTS: 1 REF: 417
ANS: D PTS: 1 REF: 420
ANS: B PTS: 1 REF: 420
a. get method c. pull method b. set method d. access method
ANS: A PTS: 1 REF: 421
ANS: A PTS: 1 REF: 422
ANS: C PTS: 1 REF: 424
ANS: B PTS: 1 REF: 433
ANS: C PTS: 1 REF: 435
ANS: A PTS: 1 REF: 435
ANS: D PTS: 1 REF: 435
ANS: object
PTS: 1 REF: 408
ANS: object
ANS: classes
PTS: 1 REF: 411
ANS: objects object
PTS: 1 REF: 408
ANS: hidden
PTS: 1 REF: 434
Match each term with a statement below. a. instance variables f. state b. class client g. polymorphism c. inheritance h. attributes d. class i. encapsulation e. information hiding j. object
ANS: Five important features of object-oriented languages are:
PTS: 1 REF: 408 TOP: Critical Thinking
ANS: Thinking of items as instances of a class allows you to apply your general knowledge of the class to its individual members. A particular instance of an object takes its attributes from the general category.
PTS: 1 REF: 409 TOP: Critical Thinking
ANS: The concept of a class is useful because of its reusability. For example, if you invite me to a graduation party, I automatically know many things about the object (the party). I assume there will be attributes such as a starting time, a number of guests, some quantity of food, and some nature of gifts. I understand parties because of my previous knowledge of the Party class, of which all parties are members. I don’t know the number of guests or the date or time of this particular party, but I understand that because all parties have a date and time, then this one must as well. Similarly, even though every stock purchase is unique, each must have a dollar amount and a number of shares. All objects have predictable attributes because they are members of certain classes.
PTS: 1 REF: 410 TOP: Critical Thinking
ANS: Real-world objects often employ encapsulation and information hiding. Encapsulation is the process of combining all of an object’s attributes and methods into a single package. Information hiding is the concept that other classes should not alter an object’s attributes—only the methods of an object’s own class should have that privilege.
Outside classes should only be allowed to make a request that an attribute be altered; then it is up to the class’s methods to determine whether the request is appropriate. When using a door, you usually are unconcerned with the latch or hinge construction features, and you don’t have access to the interior workings of the knob or know what color of paint might have been used on the inside of the door panel. You care only about the functionality and the interface, the user-friendly boundary between the user and internal mechanisms of the device. Similarly, the detailed workings of objects you create within object-oriented programs can be hidden from outside programs and modules if you want them to be. When the details are hidden, programmers can focus on the functionality and the interface, as people do with real-life objects.
PTS: 1 REF: 414 TOP: Critical Thinking
ANS: A class definition can contain three parts:
PTS: 1 REF: 415 TOP: Critical Thinking
ANS: By convention, a class diagram lists the names of the data items first. Each name is followed by a colon and the data type. Similarly, method names are followed by their data types. Listing the names first emphasizes the purposes of the fields and methods more than their types.
PTS: 1 REF: 417 TOP: Critical Thinking
ANS: Object-oriented programmers usually specify that their data fields will have private access—that is, the data cannot be accessed by any method that is not part of the class.
PTS: 1 REF: 424 TOP: Critical Thinking
ANS: When you write an instance method in a class, the following two identifiers within the method always mean exactly the same thing:
PTS: 1 REF: 432 TOP: Critical Thinking
ANS:
Any time a local variable in a method has the same identifier as a class field, the class field is hidden. This applies whether the local variable is a passed parameter or simply one that is declared within the method. In these cases, you must use a this reference to refer to the class field.
PTS: 1 REF: 434 TOP: Critical Thinking
ANS: Nonstatic methods are methods that exist to be used with an object. These instance methods receive a this reference to a specific object. In most programming languages, you use the word static when you want to declare a static class member, but you do not use a special word when you want a class member to be nonstatic. In other words, methods in a class are nonstatic instance methods by default.
PTS: 1 REF: 435 TOP: Critical Thinking