Wednesday, September 24, 2014

OOAD QUIZ 2


1.In a UML class diagram, how are objects distinguished from classes? Choose only one option.
Select one:
A. Object labels are shown in italics.
B. Class labels have a box drawn around them.
C. Object labels are underlined.{correct}
D. None of the Above

2.

In the given figure, what does the arrow hitting the p:PMember box indicate? Choose only one option.
Select one:
A. p is a temporary object.
B. p is created at that moment in time. {correct}
C. p is a local object, accessible only to the calling method.
D. The message is sent to a class.
E. None of the above

3.In UML diagrams, how are abstract classes distinguished from concrete classes? Choose only one option.
Select one:
a. Concrete classes are shown as boxes with dashed outlines.
b. Labels on abstract classes are shown in italics. {correct}
c. Labels on concrete classes are shown in italics.
d. Abstract classes are shown as boxes with dashed outlines.

4.In UML diagrams, how are class messages distinguished from instance messages? Choose only one option.
Select one:
a. Class messages are shown in brackets.
b. Class messages are shown in italics.
c. Class messages are underlined.{correct}
d. Class messages are shown with the keyword <<static>>


5.In UML, which diagrams are used to show messages sent between objects? Choose all options that apply.
Select one or more:
A. Activity diagrams.
B. Object diagrams.
C. Communication diagrams.{correct}
D. State machine diagrams.
E. Sequence diagrams. {correct}


6.What does the term "polymorphism" refer to? Choose only one option.
Select one:
A. The ability of a variable to point at different classes of object at different times.{is also correct}
B. The fact that a message with the same signature can invoke different methods at different times.{correct}
C. All object-oriented programming languages are different.
D. All object-oriented methodologies use a different notation.


7.What is "design by contract"? Choose only one option.
Select one:
A. Designing code as if there were a contract between an object that sends a message and the object that receives it.{correct}
B. Reinforcing the contract between every pair of objects by increasing the amount of error-checking.
C. Protecting your software using a contract with a firewall.
D. Designing a software system under contract.

8.What is "encapsulation"? Choose only one option.
Select one:
A. Depicting objects using state machine diagrams.
B. Ensuring that the data inside an object can only be accessed via operations.{correct}
C. Sealing the state of an object so that it cannot be changed.
D. Putting objects into a collection.

9.What is a "class invariant"? Choose only one option.
Select one:
A. A class whose source code is versioned and therefore cannot be changed.
B. A condition that will always be true for an instance of the class.{correct}
C. A class whose objects have constant fields.
D. None of the Above

10.What is an "abstract" class? Choose only one option.
Select one:
A. An object.
B. A class with no methods.
C. A class with no concrete subclasses.
D. A class with at least one undefined message.{correct}
E. An interface.

11.What is an association class? Choose only one option.
Select one:
A. It describes the various kinds of relationship that can exist between classes.
B. It adds attributes and/or behaviour to an association between two other classes.{correct}
C. It associates an object with the class of which it is an instance.
D. None of the above


12.What is meant by "object identity"? Choose only one option.
Select one:
A. Two objects are identical if their attributes have the same value.
B. Every object's class has a unique serial number.
C. All objects are the same as each other.
D. Every object has a unique identity that distinguishes it from all other objects.{correct}


13.What kind of diagram is shown in figure below? Choose only one option.

Select one:
A. State machine diagram.
B. Activity diagram.
C. Class diagram.
D. Use case diagram.
E. Sequence diagram.{correct}
F. Communication diagram.


14.Which of the following are the heuristics for class diagram? Choose only one option.

Select one:
A. Never place a name, role names, or multiplicities on a generalization connector
B. Use the interface ball and socket symbols to abstract interface details and a stereotyped class symbol to show details.
C. Don't italicize interface or operation names
D. All of the mentioned {correct}

15.Which of the following statement is true? Choose only one option.
Select one:
A. All superclasses are abstract. {not all most of superclass are abstract}
B. Inheritance is preferable to composition.
C. All superclasses are concrete.
D. Composition is preferable to inheritance.{correct}

16.Which of the following terms best describes an object that is made up of other objects? Choose only one option.
Select one:
A. Generalization.
B. Inheritance.
C. Association.
D. Specialization.
E. Aggregation.{correct}

17.Which of the following UML artifacts is used to show the steps involved in getting value from a system? Choose only one option.
Select one:
A. User interfaces.
B. Glossaries.
C. State machine diagrams.
D. Use cases. {correct}
E. Class diagrams.

18.Why is the ability to redefine a method important in object-oriented programming? Choose all options that apply.
Select one or more:
A. Because it allows us to provide a more accurate or faster definition in a subclass.{correct}
B. Because it allows us to disable a method in a subclass.
C. Because it allows us to change the meaning of a method.
D. Because it allows us to add extra work to a method.{correct}
E. Because it allows us to introduce abstract methods that are redefined as concrete methods.{correct}

19.With reference to figure below, which methods correspond to the following message sends (in the order given)? Choose only one option.
tr.height();
sh.perimeter();
sq.height();
sq.perimeter();
sh.height();
tr.perimeter();



Select one:
A. 3, 1, none (error), 4, none (error), 5.
B. 3, 5, none (error), 4, 3, 5.
C. 3, 1, none (error), 4, 3, 5.
D. 3, 5, none (error), 4, none (error), 5.{correct}

20.With reference to figure below, what do Diagrams 1 and 2 illustrate? Choose only one option.

Select one:
A. 1: An aggregation, 2: A composition.
B. 1: An attribute, 2: An aggregation.
C. 1: An aggregation, 2: An attribute.
D. 1: An attribute, 2: A composition.{correct}
E. 1: A composition, 2: An attribute.

21.With reference to figure below, what do you think is the most likely implementation of the relationship between Car and Engine? Choose only one option.


Select one:
A. A field, of type Car, in Engine.
B. class called CarEngine with one field of type Car and another field of type Engine.
C. A field, of type Engine, in Car.{correct}
D. A field, of type Engine, in Car and a field, of type Car, in Engine.

22.With reference to figure below, what is the difference between the two diagrams? Choose only one option.

Select one:
A. In Diagram 1, Color is public but in Diagram 2 Color is private.
B. Diagram 2 indicates that the car's Color can be removed and replaced.
C. Diagram 1 shows an abstract class and Diagram 2 shows a concrete class.
D. None, they mean the same thing.{correct}

23.With reference to figure below, which of the following assignments are legal? Choose all options that apply.

Select one or more:
A. sq = sh;
B. sh = tr;{correct}
C. tr = sq;
D. tr = sh;
E. sh = sq;{correct}
F. sq = tr;

24.With reference to figure below, which of the following messages are valid? Choose all options that apply.

Select one or more:
A. sh.perimeter();{correct}
B. tr.perimeter();{correct}
C. sh.height();
D. sq.height();
E. sq.perimeter();{correct}
F. tr.height();{correct}

25.With reference to figure below, which of the following statements are true? Choose all options that apply.

Select one or more:
A. A car always has the same body.{correct}
B. Some cars have spare wheels.
C. A car has one engine, and engines are not shared between cars.{correct}
D. All cars have either four or five wheels.{correct}
E. car must have at least one driver.

No comments:

Post a Comment