Object Oriented Concept - Study Mode

[#81] What will be the output of the following PHP code? class Checkout
{ final function totalize () { // calculate bill }
} class IllegalCheckout extends Checkout
{ final function totalize () { // change bill calculation }
}
Correct Answer

(D) PHP Fatal error: Cannot override final method

Explanation

Solution: A final class cannot be subclassed. Less drastically, a final method cannot be overridden.

[#82] The practice of separating the user from the true inner workings of an application through well-known interfaces is known as _________
Correct Answer

(C) Encapsulation

[#83] Which of the following term originates from the Greek language that means “having multiple forms,” defines OOP’s ability to redefine, a class’s characteristics?
Correct Answer

(B) Polymorphism

[#84] The practice of creating objects based on predefined classes is often referred to as.
Correct Answer

(D) class instantiation

[#85] Which one of the following property scopes is not supported by PHP?
Correct Answer

(A) friendly

Explanation

Solution: PHP supports five class property scopes: public, private, protected, final and static.