Which one of the following can be used to instantiate an object in php assuming class name to be student?
Show Menu
Join The DiscussionRelated Questions on Object Oriented Concept This set of PHP Multiple Choice Questions & Answers (MCQs) focuses on “Basics of Object-Oriented PHP”. 1. The practice of separating the user from the true inner workings of an application through well-known interfaces is known as _________ Answer: c 2. 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? Answer: b 3. The practice of creating objects based on predefined classes is often referred to as ______________ Answer: d 4. Which one of the following property scopes is not
supported by PHP? Answer: a 5. Which one of the following can be used to instantiate an object in PHP assuming class name to be Foo? Answer: c 6. Which one of the following is the right way to define a constant? Answer: d 7. Which one of the following is the right way to call a class constant, given that the class is mathFunction? Answer: c 8. Which one of the following is the right way to invoke a method? Answer: a 9. 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 } a)
Only ii) Answer: c 10. Which of the following method scopes is/are not supported by PHP? i) private ii) friendly iii) static iv) abstract a) Only ii) Answer: a Sanfoundry Global Education & Learning Series – PHP Programming. To practice all questions on PHP Programming, here is complete set of 1000+ Multiple Choice Questions and Answers on PHP. Next Steps:
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 & technical discussions at Telegram SanfoundryClasses. What is instantiate in PHP?Instantiating an object means that we create a new object of a class in PHP. Before you can create an object, you must create a class. The class is the overall blueprint or template of the object.
Which keyword is used to create an object from a class in PHP?The new keyword is used to create an object from a class.
Which one of the following is not a way to instantiate a class?1. Which one of the following class can not be instantiated? Explanation: An abstract class cannot be instantiated.
Which of the following instantiates an object for this class?Using the new Keyword
Java provides the new keyword to instantiate a class. We can also instantiate the above class as follows if we defining a reference variable. We observe that when we use the new keyword followed by the class name, it creates an instance or object of that class.
|