14 - Class Diagrams

 1. Class diagrams are the most popular _____________________used for construction of software applications


  inheritance diagrams

  UML diagrams


 2. Class diagram is basically a graphical representation of the static view of the system and represents different aspects of the application
 A collection of class diagrams represent the whole system.



 3. Class diagrams are used for ____________
class diagram ?
The name of the class diagram should be meaningful to describe
that particular aspect of the system

Each element and their relationships should be identified in advance.

Responsibility (attributes and methods) of each class should be clearly 

For each class, minimum number of properties should be specified, 
as unnecessary properties will make the diagram complicated.

Use notes whenever required to describe some aspect of the diagram. 
At the end of the drawing it should be understandable to the developer/coder.

Finally, before making the final version, the diagram should be drawn 
on plain paper and reworked as many times as possible to make it correct.

  construction of CPU architecture

  construction of software applications using object orientated languages

  construction of code directly (class diagrams are coded)

  None of the above

 4. All classes have different access levels that can apply to attriubtes and methods. Can you fill in the blanks for the - and the /?
Member access modifiers
All classes have different access levels depending 
on the access modifier (visibility). Here are the access 
levels with their corresponding symbols:

1. Public (+)
2. ________ (-)
3. Protected (#)
4. Package (~)
5. _________(/)
6. Static (underlined)

  None of the above

  2. Plenty 5. Polymorphic

  2. Private 5. Encapsulated

  2. Private 5. Derived

 5. For the following ATM system class diagram, which statement is correct?

  There are no classes in this diagram - only objects

  There are seven classes, including Bank, Customer,ATM and Account.

  There is one class in this diagram, with seven objects part of the whole component.

  There are only five classes - as 'CurrentAccount' and 'SavingAccount' are not classes

 6. In the following Hotel Management System class diagram, what are the methods included for the 'Inventory' class?

  There are no methods

  All the methods in 'Manager' are included in the Inventory class e.g. purchaseinventory and ManageStaff.

  There is no 'Inventory' class - as the box in the diagram represents an attribute

  None of the above

 7. Object diagrams are derived from class diagrams so object diagrams are dependent upon class diagrams
Object diagrams represent an instance of a class diagram. The basic concepts are similar for class diagrams and object diagrams



 8. Activity diagrams have symbols for activities, states, including separate symbols for an initial state and a final state.
The control flow is usually shown with an arrow and the object flow is shown with a dashed arrow.



 9. Looking at the following class definition and diagram, which of the following statements is correct?
Define an address class
class Address():
    """ Hold all the fields for a mailing address. """
    def __init__(self):
        """ Set up the address fields. """ = ""
        self.line1 = ""
        self.line2 = "" = ""
        self.state = "" = ""

  None of the above

  The object 'Address' has four objects in it

  The class 'Address' has six attributes listed in it

  The class 'Address' has six methods listed in it

 10. Generally speaking (take a look at the 'Dog' class below) attributes are _________ and methods are __________.

  adjectives / verbs

  nouns / text strings

  numbers / text

  verbs /adjectives