Chaitanya Lakshmi
  • About Me
  • Job Duties
  • Knowledge Blog
  • Applications
  • Contact Us
    • Linked In
    • Facebook
  • About Me
  • Job Duties
  • Knowledge Blog
  • Applications
  • Contact Us
    • Linked In
    • Facebook

What OOP construct unavailable in PHP 4 does the following script approximate?

2/27/2012

0 Comments

 
class my_class
{
function my_funct ($my_param)
{
user_error ("Please define me", E_ERROR);
}
function b()
{
return 10;
}
}

A. Multiple inheritance
B. Interfaces
C. Abstract methods
D. Private methods
E. Function overloading

Answer:
Abstract methods
0 Comments

Which object-oriented pattern would you use to implement a class that must be instantiated only once for the entire lifespan of a script?

2/27/2012

2 Comments

 
A. Model-view-controller
B. Abstract factory
C. Singleton
D. Proxy
E. State

Answer:
Singleton
2 Comments

At the end of the execution of the following script, which values will be stored in the $a->my_value array? (Choose 3)

2/27/2012

0 Comments

 
class my_class
{
var $my_value = array();
function my_class ($value)
{
$this->my_value[] = $value;
}
function set_value ($value)
{
$this->$my_value = $value;
}
}
$a = new my_class ('a');
$a->my_value[] = 'b';
$a->set_value ('c');
$a->my_class('d');

  • c
  • b
  • a
  • d
  • e
Answers:
b,a and d

The set_value method of my_class will not work correctly because it uses the expression $this->$my_value, which is a “variable variable” that, under the circumstances will never correspond to any real property of the class.
0 Comments

    Author

    Write something about yourself. No need to be fancy, just an overview.

    Archives

    February 2012

    Categories

    All
    General
    Krds
    Phponweb

    RSS Feed

Powered by Create your own unique website with customizable templates.