COSC 1436 - Ch 10

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

7. A(n) _______ method stores a value in a data attribute or changes its value in some other way. a. modifier b. constructor c. mutator d. accessor

mutator Mutator methods can control the way that a class's data attributes are modified. When code outside the class needs to change the value of an object's data attribute, it typically calls a mutator and passes the new value as an argument

11. In one approach to identifying a class's data attributes and methods, the programmer identifies the class's ______. a. responsibilities b. name c. synonyms d. nouns

responsibilities

3. A(n) _______ is a component of a class that references data. a. method b. instance c. data attribute d. module

data attribute The data contained in an object is known as the object's data attributes. An object's data attributes are simply variables that reference data

2. this is a feature of OOP that wraps data attributes and its relevant methods in a bundle a. polymorphism b. inheritance c. encapsulation d. abstraction

encapsulation Encapsulation refers to the combining of data and code into a single object.

1. The practice of procedural programming is centered on the creation of objects. T or F

false procedural programming is centered on creating procedures (functions), objectoriented programming (OOP) is centered on creating objects

6. The hidden data attributes of an object can be accessed by any public method using the reference of the object

false? Earlier in this chapter we mentioned that an object's data attributes should be private, so that only the object's methods can directly access them.

4. the key word used to implement a predefined module in a class is called: a. def b. random c. extend d. import

import

3. An object is an entity that can be used effectively in many programs

? The object is, conceptually, a self-contained unit that consists of data attributes and methods that operate on the data attribute

7. One way to find the classes needed for an object-oriented program is to identify all of the verbs in a description of the problem domain. T or F

False

4. A class method does not have to have a 'self' parameter. T or F

False The self parameter1 is required in every method of a class

2. Object reusability has been a factor in the increased use of object-oriented programming. T or F

True

6. A(n) method gets the value of a data attribute but does not change it. a. retriever b. constructor c. mutator d. accessor

accessor A method that returns a value from a class's attribute but does not change it is known as an accessor method. Accessor methods provide a safe way for code outside the class to retrieve the values of attributes, without exposing the attributes in a way that they could be changed by the code outside the method

8. The _______ method is automatically called when an object is created. a. init b. _ _init_ _ c. _ _str_ _ d. _ _object_ _

b. __init__ = initialization

9. This method stores a value in a data attribute or changes the value of a data attribute. a. accesor b. mutator c. exchanger d. constructor

b. mutator

1. The programming practice is centered on creating functions that are separate from the data that they work on. a. modular b. procedural c. functional d. object-oriented

b. procedural Procedural programming is a programming practice centered on the procedures (functions) or actions that take place in a program

5. By doing this you can hide a class's attribute from code outside the class. a. avoid using the self parameter to create the attribute b. begin the attribute's name with two underscores c. begin the name of the attribute with private _ _ d. begin the name of the attribute with the @ symbol

begin the attribute's name with two underscores data attribute becomes hidden when its name begins with two underscores self._ _model = model self._ _mileage = mileage self._ _price = price

10. A set of standard diagrams for graphically depicting object-oriented systems is provided by _____. a. the Unified Modeling Language b. flowcharts c. pseudocode d. the Object Hierarchy System

the Unified Modeling Language

5. The 'randint' function of a random module is used to generate a random number T/F

true


संबंधित स्टडी सेट्स

Newtons first and Second law of motion

View Set

2.01-2.03 Entrepreneurial Discovery Review

View Set

Management application questions

View Set