Question

In: Computer Science

The relationship between Laptop and Screen can best be categorized as Inheritance Association Ownership Private What...

  1. The relationship between Laptop and Screen can best be categorized as
    1. Inheritance
    2. Association
    3. Ownership
    4. Private

  1. What is the purpose of information hiding in object-oriented programming?
    1. To protect the values of variables from being changed inappropriately
    2. To free other programmers from having to know too many details of the inner workings of the class.
    3. To protect people’s personal information from hackers?
    4. All of the above
    5. Just choices a and b

  1. The relationship between Bayonet and Weapon could best be described as
    1. Inheritance
    2. Association
    3. Ownership
    4. Private

  1. Which of the following is not true of the relationship composition?
    1. The owner is responsible for creating and destroying the object it owns
    2. Other objects of the owner type can own the very same object.
    3. It involves exclusive ownership, meaning that no other object could own the owned object.
    4. It, like aggregation, is a form of ownership.

  1. In the relationship between Hammer and Tool, which is the superclass and which is the subclass?
  1. Which of the following is a false statement?
    1. A class is like a blueprint, and an object is something built according to that blueprint.
    2. A class can contain data members and methods.
    3. A class can contain objects as data members within it.
    4. Usually, only one object can be built for any given class.

  1. Which of the following is false about an abstract class?
    1. It contains one or more abstract functions.
    2. You cannot create an object of an abstract class.
    3. It cannot have any non-abstract functions.
    4. It is the most generic version of a family of related types of things.

  1. Why is polymorphism powerful?
    1. It enables us to refer to related objects generally but still access specific functionality for each object.
    2. It enables us to build more complicated objects starting from simpler ones.
    3. It helps us protect data from being inadvertently changed.
    4. It helps us build objects that contain other objects.

  1. Why do we write public get and set functions?
    1. Object-oriented languages require us to do so.
    2. If we didn’t, there would be no way to read or write the values of the data members of a class.
    3. 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.
    4. They make a program run more efficiently.

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

Solutions

Expert Solution

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.


Related Solutions

What is the difference between public ownership and private ownership?
What is the difference between public ownership and private ownership?
What is the nature of business networks in India? Analyse the relationship between ownership patterns and...
What is the nature of business networks in India? Analyse the relationship between ownership patterns and networks.
What is the BEST statistical method to use when you want to assess the association between...
What is the BEST statistical method to use when you want to assess the association between a variable that is in ordinal scale and multiple variables that are in ratio/interval/ordinal scale.
What is the balance of public and private ownership in the transportation sector? What infrastructure is...
What is the balance of public and private ownership in the transportation sector? What infrastructure is usually public and what is usually private? How do you evaluate the appropriate balance of benefit and cost for security programs between public and private entities?
What does Locke think justifies private ownership or property?
What does Locke think justifies private ownership or property? What counts as property, according to Locke? What are Rousseau’s views on private ownership or property?
What is the difference between a Univariate outlier screen and a Multivariate outlier screen?
What is the difference between a Univariate outlier screen and a Multivariate outlier screen?
What is the difference between “vertical inheritance” and “horizontal inheritance”? Does horizontal inheritance of genes provide...
What is the difference between “vertical inheritance” and “horizontal inheritance”? Does horizontal inheritance of genes provide evidence against Darwin’s theory of Evolution by Natural Selection? Why or why not?
13.34 you are studying the relationship between history of early childhood trauma (categorized as trauma/no trauma)...
13.34 you are studying the relationship between history of early childhood trauma (categorized as trauma/no trauma) and weight in adulthood (categorized as low to normal, overweight, and obese). Past research has suggested that those children who experienced trauma (such as child abuse) are more likely to develop weight problems in adulthood. You calculated a Chi-square of 18.26. You can decide to ____________ the Null Hypothesis at p<.05. 13.35 Professor Miller samples 500 high school students for a study on alcohol...
what are operations of a firm? how can operations be categorized?
what are operations of a firm? how can operations be categorized?
what is the association between smoking and coffee and also an association between smoking and myocardial...
what is the association between smoking and coffee and also an association between smoking and myocardial infarction.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT