Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Object-Oriented Programming Concepts, Exams of Data Acquisition

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

2024/2025

Available from 10/10/2024

Goodluck_Academia
Goodluck_Academia 🇺🇸

4.2

(6)

1.3K documents

1 / 8

Toggle sidebar

Related documents


Partial preview of the text

Download Object-Oriented Programming Concepts and more Exams Data Acquisition in PDF only on Docsity!

MIS 505 Final Exam Review

Chapter 10: Object-Oriented Programming

TRUE/FALSE

  1. Methods in object-oriented programs use sequence, selection, and looping structures and make use of arrays.

ANS: T PTS: 1 REF: 408

  1. In addition to their attributes, class objects have methods associated with them; every object that is an instance of a class possesses different methods.

ANS: F PTS: 1 REF: 411

  1. Within any object-oriented program, you continuously make requests to objects’ methods, often including arguments as part of those requests.

ANS: T PTS: 1 REF: 411

  1. Declaring a class does not create actual objects.

ANS: T PTS: 1 REF: 415

  1. Class diagrams are a type of Unified Modeling Language (UML) diagram.

ANS: T PTS: 1 REF: 417

  1. The accessor method is another name for the set method.

ANS: F PTS: 1 REF: 421

  1. Object-oriented programmers usually specify that their data fields will have private access.

ANS: T PTS: 1 REF: 424

  1. All methods require a this reference.

ANS: F PTS: 1 REF: 432

  1. No object is necessary with a static method.

ANS: T PTS: 1 REF: 435

  1. Methods in a class are static instance methods by default.

ANS: F PTS: 1 REF: 435

MULTIPLE CHOICE

  1. ____ is a style of programming that focuses on an application’s data and the methods you need to manipulate that data. a. Classical programming c. Procedural programming b. Functional programming d. Object-oriented programming

ANS: D PTS: 1 REF: 408

  1. Object-oriented programmers sometimes say an object is one ____ of a class. a. enumeration c. member b. instantiation d. reference

ANS: B PTS: 1 REF: 408

  1. Objects both in the real world and in object-oriented programming contain ____ and methods. a. behaviors c. help b. attributes d. primitive data types

ANS: B PTS: 1 REF: 409

  1. ____ are the characteristics that define an object as part of a class. a. Instances c. Behaviors b. Attributes d. Methods

ANS: B PTS: 1 REF: 409

  1. When you think in an object-oriented manner, every object is a member of a ____. a. class c. method b. struct d. collection

ANS: A PTS: 1 REF: 410

  1. Object-oriented programmers also use the term ____ when describing inheritance. a. has-a c. is-a b. from-a d. contains

ANS: C PTS: 1 REF: 410

  1. The concept of a class is useful because of its ____. a. reusability c. abstract nature b. mapping to reality d. portability

ANS: A PTS: 1 REF: 410

  1. Object attributes are often called ____ to help distinguish them from other variables you might use. a. rows c. columns b. records d. fields

ANS: D PTS: 1 REF: 411

  1. The data components of a class that belong to every instantiated object are the class’s ____. a. numeric variables c. instance variables b. string variables d. data variables

ANS: C PTS: 1 REF: 411

  1. A(n) ____ is a program or class that instantiates objects of another prewritten class. a. instantiation c. class client b. method d. class definition

ANS: C PTS: 1 REF: 411

  1. The term ____ is applied to situations in which you define multiple methods with a single name. a. overloading c. renaming b. bonding d. inferring

ANS: A PTS: 1 REF: 413

  1. A ____ is a set of program statements that tell you the characteristics of the class’s objects and the methods that can be used by its objects. a. class interface c. class reference b. class definition d. class model

ANS: B PTS: 1 REF: 415

  1. The term ____ implies that the type’s data can be accessed only through methods. a. abstract type library c. abstract definition type b. advanced data type d. abstract data type

ANS: D PTS: 1 REF: 416

  1. A(n) ____ is a programmer-defined type, such as a class. a. inheritance c. primitive data type b. numeric data type d. abstract data type

ANS: D PTS: 1 REF: 416

  1. In older object-oriented programming languages, simple numbers and characters are said to be ____ data types. a. primitive c. complex b. simple d. higher-order

ANS: A PTS: 1 REF: 417

  1. A(n) ____ consists of a rectangle divided into three sections. a. class tree c. class diagram b. dependency diagram d. entity-relationship diagram

ANS: C PTS: 1 REF: 417

  1. The purpose of ____ is to set the values of data fields within the class. a. get methods c. make methods b. put methods d. set methods

ANS: D PTS: 1 REF: 420

  1. Methods that set values are called ____ methods. a. modifier c. creator b. mutator d. access

ANS: B PTS: 1 REF: 420

  1. The purpose of a(n) ____ is to return a value to the world outside the class.

a. get method c. pull method b. set method d. access method

ANS: A PTS: 1 REF: 421

  1. A ____ method is also known as a help method. a. work c. public b. private d. set

ANS: A PTS: 1 REF: 422

  1. A(n) ____ is the adjective defining the type of access (public or private) that outside classes will have to the attribute or method. a. control specifier c. access specifier b. control modifier d. access controller

ANS: C PTS: 1 REF: 424

  1. In a class method, the ____ reference can be used only with identifiers that are field names. a. my^ c. that b. this^ d. me

ANS: B PTS: 1 REF: 433

  1. ____ methods are those for which no object needs to exist. a. Dynamic c. Static b. Public d. Private

ANS: C PTS: 1 REF: 435

  1. ____ methods are methods that exist to be used with an object created from a class. a. Nonstatic c. Hidden b. Static d. Controlled

ANS: A PTS: 1 REF: 435

  1. In most programming languages, you use the word ____ when you want to declare a static class member. a. private c. public b. friend^ d. static

ANS: D PTS: 1 REF: 435

COMPLETION

  1. A(n) ____________________ is one instance of a class.

ANS: object

PTS: 1 REF: 408

  1. When you think in an object-oriented manner, everything is a(n) ____________________.

ANS: object

PTS: 1 REF: 410

  1. When you program in object-oriented languages, you frequently create ____________________ from which objects will be instantiated.

ANS: classes

PTS: 1 REF: 411

  1. With object-oriented programming, you focus on the ____________________ that will be manipulated by the program.

ANS: objects object

PTS: 1 REF: 408

  1. Any time a local variable in a method has the same identifier as a class field, the class field is ____________________.

ANS: hidden

PTS: 1 REF: 434

MATCHING

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

  1. Describes a group or collection of objects with common attributes
  2. An instance of a class
  3. The characteristics that define an object as part of a class
  4. The data components of a class that belong to every instantiated object
  5. The set of all the values or contents of a class object’s instance variables
  6. A program or class that instantiates objects of another prewritten class
  7. Multiple methods with the same name, which will act differently and appropriately when used with different types
  8. The process of acquiring the traits of one’s predecessors
  9. The process of combining all of an object’s attributes and methods into a single package
  10. 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
  11. ANS: D PTS: 1 REF: 408
  12. ANS: J PTS: 1 REF: 408
  13. ANS: H PTS: 1 REF: 409
  14. ANS: A PTS: 1 REF: 411
  15. ANS: F PTS: 1 REF: 411

6. ANS: B PTS: 1 REF: 411

7. ANS: G PTS: 1 REF: 412

8. ANS: C PTS: 1 REF: 413

9. ANS: I PTS: 1 REF: 414

10. ANS: E PTS: 1 REF: 414

SHORT ANSWER

  1. List five important features of object-oriented languages.

ANS: Five important features of object-oriented languages are:

  • Classes
  • Objects
  • Polymorphism
  • Inheritance
  • Encapsulation

PTS: 1 REF: 408 TOP: Critical Thinking

  1. Discuss why it is helpful to think of items as instances of a class.

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

  1. Discuss why the reusability of a class makes it useful.

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

  1. Explain encapsulation and information hiding.

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

  1. List the three parts of a class definition.

ANS: A class definition can contain three parts:

  • Every class has a name.
  • Most classes contain data, although this is not required.
  • Most classes contain methods, although this is not required.

PTS: 1 REF: 415 TOP: Critical Thinking

  1. Describe what class diagrams list by convention.

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

  1. Explain what private access means in object-oriented programming.

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

  1. List the two identifiers within a method that always mean exactly the same thing when you write an instance method in a class.

ANS: When you write an instance method in a class, the following two identifiers within the method always mean exactly the same thing:

  • any field name defined in the class
  • this, followed by a dot, followed by the same field name

PTS: 1 REF: 432 TOP: Critical Thinking

  1. Describe what happens any time a local variable in a method has the same identifier as a class field.

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

  1. Discuss nonstatic methods.

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