- Class my_class
- {
- Function my_funct ($ my_param)
- {
- User_error ("please define me", E_ERROR );
- }
- Function B ()
- {
- Return 10;
- }
- }
- ?>
A. Multiple inheritance B. Interface C. abstract method D. private method E. function overload) 7. suppose a testclass class is defined. what is the name of its constructor? 15A. _ constructB. initializeC. testclassD. _ testclassE. constructor is supported only in pHp5. 8. how does one class override the default serialization mechanism? A. use the _ shutdown and _ startup methods B. call the register_shutdown_function () function C. use the _ sleep () and _ wakeup () methods D. cannot overwrite the 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) method interface A. abstract class B. ppp method C. ppp method and interface D. None of the above E. All of the above are available 10. how to call the mymethod method inside the class? A. $ self => mymethod (); B. $ this-> mymethod (); C. $ current-> mymethod (); D. $ this: mymethod () E. none of the above 11. what is the output of the following script?
- Class my_class
- {
- Var $ my_var;
- Function _ my_class ($ value)
- {
- $ This-> my_var = $ value;
- }
- }
- $ A = new my_class (10 );
- Echo $ a-> my_var;
- ?>
-
A.10B. NullC. EmptyD. nothing E. An error 12. what is the output of the following script?
- Class my_class
- {
- Var $ value;
- }
- $ A = new my_class;
- $ A-> my_value = 5;
- $ B = $;
- $ B-> my_value = 10;
- Echo $ a-> my_value;
- ?>
-
A.10B. 5C. 2D. NullE. nothing 13. what is the output of the following script?
- $ Global_obj = null;
- Class my_class
- {
- Var $ value;
- Function my_class ()
- {
- Global $ global_obj;
- $ Global_obj = & $ this;
- }
- }
- $ A = new my_class;
- $ A-> my_value = 5;
- $ Global_obj-> my_value = 10;
- Echo $ a-> my_value;
- ?>
A.5B. 10C. nothing. D. The constructor will report the error E.510. 14. Consider the following code. during execution, $ eight_tenths-> the string returned by the to_string method is 8/10 instead of the expected 4/5. why?
Class fraction {
- Var $ numerator;
- Var $ denominator;
- Function fraction ($ n, $ d ){
- $ This-> set_numerator ($ n );
- $ This-> set_denominator ($ d );
- }
- Function set_numerator ($ num ){
- $ This-> numerator = (int) $ num;
- }
- Function set_denominator ($ num ){
- $ This-> denominator = (int) $ num;
- }
- Function to_string (){
- Return "{$ this-> numerator}/{$ this-> denominator }";
- }
- }
Function gcd ($ a, $ B ){
- Return ($ B> 0 )? Gcd ($ B, $ a % $ B): $;
- }
Function performance_fraction ($ fraction ){
- $ Gcd = gcd ($ fraction-> numerator,
- $ Fraction-> denominator );
- $ Fraction-> numerator/= $ gcd;
- $ Fraction-> denominator/= $ gcd;
- }
- $ Eight_tenths = new fraction (8, 10 );
- /* Reduce the fraction */
- Performance_fraction ($ eight_tenths );
- Var_dump ($ eight_tenths-> to_string ());
- ?>
-
A. the performance_fraction function must return a value of B. the performance_fraction function must accept an integer value C. there is a problem with the gcd function D. the $ eight_tenths object E must be passed by reference. object instances cannot be passed to structures other than methods. 15. what is the code below?
- Require_once ("myclass. php ");
- Myclass: mymethod ();
- ?>
-
A. static call of mymethod Method B. generate an instance of myclass and call the mymethod method C. generate a syntax error D. by default, the myclass class is created at the end and mymethod () E is called. call the function named myclass: mymethod () 16. does pHp have static variables? A. There are B. no 17. what is the output of the following script?
- Class
- {
- Function a ($ x = 1)
- {
- $ This-> myvar = $ x;
- }
- }
- Class B extends
- {
- Var $ myvar;
- Function B ($ x = 2)
- {
- $ This-> myvar = $ x;
- Parent: ();
- }
- }
- $ Obj = new B;
- Echo $ obj-> myvar;
- ?>
A.1B. 2C. an error occurs because a: $ myvarD. warning is not defined because a: $ myvarE. nothing is defined. 18. how to load a class instantly? A. Use the _ autoload magic function B. define them as the forward class C. implement A special error handling method D. It is impossible E. use the conditional include to include them. 19. __________ provides a high-performance solution to the repeated problems in object-oriented systems? Answer :__________ 20. what is the output of the following script?
- Class
- {
- Function ()
- {
- Echo \ parent called \;
- }
- }
- Class B
- {
- Function B ()
- {
- }
- }
- $ C = new B ();
- ?>
A. parent calledB. an error C. A warning D. nothing12. Next page |