Which version of PHP introduced the static keyword?

PHP 4
PHP 5
PHP 5.2
PHP 5.3
Which keyword is used to access a static method or property from within the same class(rather than from child)?

static
strat
self
set
In which of the following circumstance should you use a static reference to a non static method?

Making a method call using parent.
Making a method call using child.
Making an object call using parent.
Making an object call using child.
Which one of the following variable cannot be used inside a static method?

$this
$get
$set
$date
What does PDO stand for?

PHP Data Orientation
PHP Database Object
PHP Database Orientation
PHP Data Object
Which version of PHP allows you to define constant properties within a class?

PHP 4
PHP 4.1
PHP 4.3
PHP 5
Which keyword is used to declare a constant property?

const
con
constant
_constant
Which one of the following is a constant variable?

const $name
const $NAME
constant NAME
const NAME
What will happen if you try to set a value to a constant once it has been declared?

The value of the variable will change
The value of the variable will not change
Parse Error
Nothing
How many of the following can be contained in constants? i) boolean ii) integer iii) float iv) string

1
2
3
4
Which one of the following class can not be instantiated?

inherited class
abstract class
constant class
every class
Which one of the following keywords is used to define an abstract class?

extends
implements
abstract
new
Which one of the following is the correct abstract method?

public function write()
abstract function write()
abstract public write();
abstract public function write();
Atleast how many abstract methods must an abstract class contain?

None
One
Two
Five
Which one of the following keyword is used to implement an interface?

interface
get
inherit
implements
Which version of PHP introduced the concept called late static binding?

PHP 4
PHP 5
PHP 5.1
PHP 5.3
Which one of the following methods in the exception class, is used to get a nested exception object?

getPrevious()
getCode()
getFile()
getLine()
Which one of the following keyword is used in conjunction with an Exception object?

throws
exception
throw
final
Which keyword is used to put a stop on inheritance?

stop
end
break
final
PHP provides built-in interceptor methods, which can intercept messages sent to undefined methods and properties. This is also known as ___.

overloading
overriding
overbending
overbinding
It will be useful for anyone learning PHP Basics and Fundamentals.

1. Which one of the following method is invoked when a value is assigned to an undefined property?


__get()
__set()
__isset()
__call()
Which one of the following method is invoked when an undefined method is called by client code?

__get()
__isset()
__unset()
__call()
Which method introduced in PHP 5, is invoked just before an object is garbage collected?

__collect()
__garbage()
__destruct()
__destructor()
Which one of the following statements is true ?
  1. class CopyMe {}
  2. $first = new CopyMe();
  3. $second = $first;

In PHP 4: $second and $first are 2 distinct objects
In PHP 5: $second and $first are 2 distinct objects
In PHP 4: $second and $first refer to one object
None of the above
Which keyword must be added before $first variable on the third line of the above question to make $second and $first as distinct objects in PHP 5?

copy
clone
cut
Can't add any word to make them distinct
What will be output of following code ?
  1. class StringThing {}
  2. $st = new StringThing();
  3. print $st;
Before the version PHP 5.2

Object Not Found
Object id #1
PHP Catchable fatal error
Cannot initialize object
What will be the output of the following PHP code
  1. class Person 
  2. {
  3.     function getName() { return "Bob"; }
  4.     function getAge() { return 44; }
  5.     function __toString() {
  6.         $desc = $this->getName();
  7.         $desc .= " (age ".$this->getAge().")";
  8.         return $desc;
  9.     }
  10. }
  11. $person = new Person();
  12. print $person;

Object Not Found
PHP Catchable fatal error
BOB (age 44)
BOB
__clone() is run on the ___ object.

original
pseudo
external
copied
Which method is invoked when an undefined property is accessed ?

__get()
__isset()
__unset()
__undefined()
What will be the output of the following PHP code?
  1. class Checkout {
  2.     final function totalize() {
  3.         // calculate bill
  4.     }
  5. }
  6. ?
  7. class IllegalCheckout extends Checkout {
  8.     final function totalize() {
  9.         // change bill calculation
  10.     }
  11. }

PHP Fatal error: Class IllegalCheckout may not inherit from final class
Value of the bill calculated
PHP Fatal error: Cannot find object
PHP Fatal error: Cannot override final method