PHP

PHP

Object Tools has 19 Questions

A package is a set of related ___.

Objects
Classes
Programs
Functions
Till which version of PHP, developers were forced to name their files in a global context?

PHP 4
PHP 5
PHP 5.2
PHP 5.3
Which of the following can you place inside a namespace? i) classes ii) functions iii) variables

i)
ii)
iii)
All of the above
Which one of the following is the correct way of declaring a namespace?

namespace my;
namespace my();
my namespace;
namespace(my);
Which symbol is used to declare nested namespaces?

/
\
.
|
Which keyword can be used to fix the above error?

fix
join
use
namespace
If I already had a Debug class in the main namespace. What will be the output of the following code?
  1. namespace main;
  2. use com\getinstance\util\Debug;
  3. <pre lang="php" cssfile="hk1_style" >
  4. class Debug {
  5.     static function helloWorld() {
  6.         print "hello from main\Debug";
  7.     } 
  8. }
  9. ?
  10. Debug::helloWorld();

Error
hello from main
hello from main\Debug
Debug
Which one of the following statements is true for include_once() and require_once()?

Both are exactly the same.
include_once is used for files where as require_once() is not.
Both Handle the errors in the same way.
Both do not handle the errors in the same way.
Which one of the following statements is true for require() and require_once()?

They are functions.
They are statements.
They'll not work if the () is not present.
They can not be used to require files.
Which function was introduced to help automate the inclusion of class files?

__load()
__preload()
__autoload()
__inload()
How many times can you define __autoload in a process?

once
twice
thrice
as many times as needed
Which one of the following functions will you use to check that the class exists before you work with it?

class_exist()
class_exists()
exist()
exists_class()
Which one of the following will you use to check the class of an object?

class()
_class()
class_check()
get_class()
PHP 4 did not support instanceof. Instead, which function did it provide?

is()
get_class()
is_a()
is_the()
You use the get_class_methods() function to return the names of all the methods in the class. Which function will you use to print it on the screen?

printf()
print_ar
print_r
echo
If you call a method and it doesn't exist it'll cause a problem. To check the method which function will you use?

_method()
methodexists()
is_callable()
is_method()
What will be the output if a protected method is given as argument to the function method_exist()?

Method does not exist
False
Error
True
Which one of the following function should I use to find the parent class of a class?

get_parent_class()
parent_class()
class_parent()
get_class_parent()
Which class accepts a class name or an object reference and returns an array of interface name?

class_implements()
is_subclass()
is_subclass_of()
class_interface()