In: Computer Science
10. Draw a UML diagram for the following system: A cell phone is a type of computing device. It has a screen, usb jack, power button, and wake button. Include data members and methods for the classes you define, and show the appropriate relationships
Solution:
1. The relationship between Laptop and Screen can best be categorized as:
c. Ownership (Because screen is the part of laptop, so it is the example of composition (ownership)).
2. What is the purpose of information hiding in object-oriented programming?
e. Just choices a and b
3. The relationship between Bayonet and Weapon could best be described as:
a. Inheritance (Because Bayonet is a kind of weapon)
4. Which of the following is not true of the relationship composition?
b. Other objects of the owner type can own the very same object.
5. In the relationship between Hammer and Tool, which is the superclass and which is the subclass?
Tool is superclass and Hammer is subclass. (Because hammer is a type of tool).
6. Which of the following is a false statement?
d. Usually, only one object can be built for any given class
7. Which of the following is false about an abstract class?
c. It cannot have any non-abstract functions.
8. Why is polymorphism powerful?
a. It enables us to refer to related objects generally but still access specific functionality for each object.
9. Why do we write public get and set functions?
c. In combination with making data private, these public functions give us a way to read and write the values of these variables in a controlled way.
10. Draw a UML diagram for the following system: A cell phone is a type of computing device. It has a screen, usb jack, power button, and wake button. Include data members and methods for the classes you define, and show the appropriate relationships.
Please give thumbsup, if you like it. Thanks.