Home > Article > Backend Development > PHP programmer interview questions and answers
A. multiple inheritance B. interface C. abstract method D. private method E. Function overloading 7. Suppose a testclass class is defined, what is the function name of its constructor? 15 A. __construct B. initialize C. testclass D. __testclass E. Only pHp5 supports constructors 8. How can a class override the default serialization mechanism? A. Using __shutdown and __startup methods B. Call the register_shutdown_function() function C. Use the __sleep() and __wakeup() methods D. Unable to override default serialization mechanism E. Use ob_start() to put the class into the output buffer 9. Which of the following object-oriented concepts cannot be implemented in PHP4? abstract class Final class public, private, protected (ppp) methods interface A. abstract class B. ppp method C. ppp methods and interfaces D. All of the above are unavailable E. All of the above are available 10. How to call mymethod method inside a class? A. $self=>mymethod(); B. $this->mymethod(); C. $current->mymethod(); D. $this::mymethod() E. None of the above is correct 11. What does the following script output?
A. 10 B. Null C. Empty D. Nothing at all E. A mistake 12. What does the following script output?
A. 10 B. 5 C. 2 D. Null E. Nothing 13. What does the following script output?
A. 5 B. 10 C. Nothing at all D. The constructor will report an error E. 510 14. Consider the following piece of code. When executed, the string returned by the $eight_tenths->to_string method is 8/10 instead of the expected 4/5. Why?
A. The reduce_fraction function must return a value B. The reduce_fraction function must accept an integer value C. There is a problem with gcd function D. The $eight_tenths object must be passed by reference E. Instances of objects cannot be passed to structures other than methods. 15. What does the following code do?
A. Static call mymethod method B. Generate an instance of myclass and call the mymethod method C. generates a syntax error D. The default myclass class is the last instance created and calls mymethod() E. Call the function named myclass::mymethod() 16. Are there static class variables in PHP? A. have B. No 17. What does the following script output?
A. 1 B. 2 C. An error because a::$myvar is not defined D. A warning because a::$myvar is not defined E. Nothing 18. How to load a class on the fly? A. Use the __autoload magic function B. Define them as forward classes C. Implement a special error handling method D. impossible E. Include them with conditional include 19. __________ provides a high-performance solution to a recurring problem in object-oriented programming? Answer: __________ 20. What does the following script output?
A. parent called B. a mistake C. a warning D. Nothing 1 2 Next page Last page |