Which of the following method scopes is/are not supported by PHP? i) private ii) friendly iii) static iv) abstract a) Only ...
View Question
Which of the following is/are the right way to declare a method?
i) function functionName() { function body }
ii) scope function functionName() { function body }
iii) method methodName() { method body }
iv) scope method methodName() { method body }
Which of the following is/are the right way to declare a method? i) function functionName() { function body } ii) ...
View QuestionWhich one of the following is the right way to invoke a method?
a) $object->methodName(); b) object->methodName(); c) object::methodName(); d) $object::methodName(); Answer: a Explanation: “->” is a dynamic class method invocation ...
View QuestionWhich one of the following is the right way to call a class constant, given that the class is mathFunction?
a) echo PI; b) echo mathFunction->PI; c) echo mathFunction::PI; d) echo mathFunction=PI; Answer: c Explanation: The Scope ...
View QuestionWhich one of the following is the right way to define a constant?
a) constant PI = “3.1415”; b) const $PI = “3.1415”; c) constant PI = ‘3.1415’; d) const ...
View QuestionWhich one of the following can be used to instantiate an object in PHP assuming class name to be Foo?
a) $obj = new $foo; b) $obj = new foo; c) $obj = new foo () d) obj = new ...
View QuestionWhich one of the following property scopes is not supported by PHP?
a) friendly b) final c) public d) static Answer: a Explanation: PHP supports five class property scopes: ...
View QuestionThe practice of creating objects based on predefined classes is often referred to as ______________
a) class creation b) object creation c) object instantiation d) class instantiation Answer: d Explanation: In object-oriented programming, classes ...
View QuestionWhich of the following term originates from the Greek language that means “having multiple forms,” defines OOP’s ability to redefine, a class’s characteristics?
a) Abstraction b) Polymorphism c) Inheritance d) Differential Answer: b Explanation: The word polymorphism is ...
View QuestionThe practice of separating the user from the true inner workings of an application through well-known interfaces is known as _________
a) Polymorphism b) Inheritance c) Encapsulation d) Abstraction Answer: c Explanation: In object-oriented PHP encapsulation is ...
View Question