PHP Questions & Answers – Object and Design-2

This set of PHP Technical Questions & Answers focuses on “Object and Design-2 ”.

1. ________ are used in class diagrams to describe the way in which specific elements should be used.
a) Attributes
b) Constraints
c) Constants
d) Class Names
View Answer

Answer: b
Explanation: The {abstract} syntax is an example of a constraint. There is no special structure for the text between the braces; it should simply provide a short clarification of any conditions that may apply to the element.

2. Which one of the following is displayed below the class name in the class diagrams?
a) Functions
b) Methods
c) Attributes
d) Constraints
view Answer

Answer: c
Explanation: Attributes describe a class’s properties. Attributes are listed in the section directly beneath the class name.

3. + is the visibility code for?
a) Public
b) Private
c) Protected
d) Friendly
View Answer

Answer: a
Explanation: The visibility symbol is followed by the name of the attribute.
advertisement
advertisement

4. Which relationship is illustrated by a line that begins with an unfilled diamond?
a) Composition
b) Abstraction
c) Aggregation
d) Inheritance
View Answer

Answer: c
Explanation: In the case of aggregation, the contained objects are a core part of the container, but they can also be contained by other objects at the same time.

5. If the diamond is filled it depicts which relationship?
a) Strong Aggregation
b) Composition
c) Abstraction
d) Inheritance
View Answer

Answer: b
Explanation: In composition, the contained object can be referenced by its container only. It should be deleted when the container is deleted.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. Which one of the following statements is true about sequence diagrams?
a) A sequence diagram is class based
b) A sequence diagram presents the participants of a system from right to left
c) The vertical broken lines represent the lifetime of the class in the system
d) A sequence diagram is object based
View Answer

Answer: d
Explanation: A sequence diagram is object based rather than class based. It is used to model a process in a system step by step.

7. A bidirectional relationship in class diagrams is described by________
a) double-headed arrow
b) visibility symbols
c) single-headed arrow
d) double diamond
View Answer

Answer: a
Explanation: A unidirectional association has single-headed arrow.
advertisement

8. # is the visibility code for?
a) Private
b) Friendly
c) Protected
d) Static
View Answer

Answer: c
Explanation: Available to the current class and its subclasses only.

9. Which one of the following is displayed in the third section of the class diagram?
a) Operations
b) Inheritance
c) Abstraction
d) Coupling
View Answer

Answer: a
Explanation: Operations describe methods, or more properly, they describe the calls that can be made on an instance of a class.
advertisement

10. Inheritance in class diagrams is depicted by________
a) single-headed empty arrow
b) single-headed filled arrow
c) double-headed empty arrow
d) double-headed filled arrow
view Answer

Answer: a
Explanation: The UML describes the inheritance relationship as a generalization. This relationship is signified by a line leading from the subclass to its parent. The line is tipped with an empty closed arrow.

Sanfoundry Global Education & Learning Series – PHP Programming.

To practice all technical questions on PHP, here is complete set of 1000+ Multiple Choice Questions and Answers on PHP.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.