250+ TOP MCQs on PHP Object and Design-2 and Answers

PHP Technical Questions & Answers 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
Answer: b
Clarification: 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
Answer: c
Clarification: 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
Answer: a
Clarification: The visibility symbol is followed by the name of the attribute.

4. Which relationship is illustrated by a line that begins with an unfilled diamond?
a) Composition
b) Abstraction
c) Aggregation
d) Inheritance
Answer: c
Clarification: 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
Answer: b
Clarification: In composition, the contained object can be referenced by its container only. It should be deleted when the container is deleted.

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

Answer: d
Clarification: 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
Answer: a
Clarification: A unidirectional association has single-headed arrow.

8. # is the visibility code for?
a) Private
b) Friendly
c) Protected
d) Static
Answer: c
Clarification: 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
Answer: a
Clarification: Operations describe methods, or more properly, they describe the calls that can be made on an instance of a class.

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
Answer: a
Clarification: 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.

To practice all technical questions on PHP,

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top