ExamVeda
Login
Home
91
What will be the output if a protected method is given as argument to the function method_exist()?
Discuss
Answer & Solution
Answer: Option D
Solution:
method_exists() returns true for private and protected methods as well as for public ones. Remember that the fact that a method exists does not mean that it will be callable.
92
Which one of the following function should I use to find the parent class of a class?
Discuss
Answer & Solution
Answer: Option A
Solution:
The class functions also allow us to chart inheritance relationships.This function requires either an object or a class name, and it returns the name of the superclass, if any. If no such class exists, that is, if the class we are testing does not have a parent, then the function returns false.
93
Which class accepts a class name or an object reference and returns an array of interface name?
Discuss
Answer & Solution
Answer: Option A
Solution:
is_subclass_of() will tell you only about class inheritance relationships. It will not tell you that a class implements an interface.
94
Object-oriented code tries to minimize dependencies by moving responsibility for handling tasks away from _______ and toward the objects in the system.
Discuss
Answer & Solution
Answer: Option B
Solution:
Procedural code takes the form of a sequential series of commands and method calls. The controlling code tends to take responsibility for handling differing conditions. This top-down control can result in the development of duplications and dependencies across a project. Object-oriented code tries to minimize these dependencies by moving responsibility for handling tasks away from client code and toward the objects in the system.
95
Placing a static method for generating _______ objects in the ________ class is convenient.
Discuss
Answer & Solution
Answer: Option A
Solution:
Such a design decision does have its own consequences, however.
96
The extent to which proximate procedures are related to one another is known as.
Discuss
Answer & Solution
Answer: Option C
Solution:
Ideally, you should create components that share a clear responsibility. If your code spreads related routines widely, you will find them harder to maintain as you have to hunt around to make changes. Our ParamHandler classes collect related procedures into a common context.
97
______ occurs when discrete parts of a system’s code are tightly bound up with one another so that a change in one part necessitates changes in the others.
Discuss
Answer & Solution
Answer: Option B
Solution:
Tight coupling is by no means unique to procedural code, though the sequential nature of such code makes it prone to the problem.
98
________ code makes change easier because the impact of altering an implementation will be localized to the component being altered.
Discuss
Answer & Solution
Answer: Option A
Solution:
Orthogonality, it is argued, promotes reuse in that components can be plugged into new systems without needing any special configuration. Such components will have clear inputs and outputs independent of any wider context.
99
Polymorphism is also known as______
Discuss
Answer & Solution
Answer: Option D
Solution:
Polymorphism is the maintenance of multiple implementations behind a common interface.
100
Which one of the following is know as the key to object-oriented programming?
Discuss
Answer & Solution
Answer: Option B
Solution:
Encapsulation simply means the hiding of data and functionality from a client.