PHP 15

Lets Crack Online Exam

IT Interview Exam Paper: PHP 15

Subject: PHP 15

Part 15: List for questions and answers of PHP


Q1. A package is a set of related ___.

a) Objects

b) Classes

c) Programs

d) Functions


Q2. Till which version of PHP, developers were forced to name their files in a global context?

a) PHP 4

b) PHP 5

c) PHP 5.2

d) PHP 5.3


Q3. Which of the following can you place inside a namespace?




a) i)

b) ii)

c) iii)

d) All of the above


Q4. Which one of the following is the correct way of declaring a namespace?

a) namespace my;

b) namespace my();

c) my namespace;

d) namespace(my);


Q5. Which symbol is used to declare nested namespaces?

a) /

b) \

c) .

d) | 


Q6. Output of

namespace main;

com\getinstance\util\Debug::helloWorld() is PHP Fatal error: Class

‘main\com\getinstance\util\Debug’ not found in …

Using which one of the following lines will the error be removed?

a) \\com\getinstance\util\Debug::helloWorld();

b) getinstance\util\Debug::helloWorld();


d) \com\getinstance\util\Debug::helloWorld();


Q7. Which keyword can be used to fix the above error?

a) fix

b) join

c) use

d) namespace


Q8. Which one of the following statements is true for include_once() and require_once()?

a) Both are exactly the same

b) include_once is used for files where as require_once() is not

c) Both Handle the errors in the same way

d) Both do not handle the errors in the same way


Q9. Which one of the following statements is true for require() and require_once()?

a) They are functions

b) They are statements

c) They’ll not work if the () is not present

d) They can not be used to require files


Q10. Which function was introduced to help automate the inclusion of class files?

a) __load()

b) __preload()

c) __autoload()

d) __inload()


Q11. How many times can you define __autoload in a process?

a) once

b) twice

c) thrice

d) as many times as needed 


Q12. Which one of the following functions will you use to check that the class exists before you work with it?

a) class_exist()

b) class_exists()

c) exist()

d) exists_class()


Q13. Which one of the following will you use to check the class of an object?

a) class()

b) _class()

c) class_check()

d) get_class()


Q14. PHP 4 did not support instanceof. Instead, which function did it provide?

a) is()

b) get_class()

c) is_a()

d) is_the()


Q15. 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?

a) printf()

b) print_ar

c) print_r

d) echo


Q16. If you call a method and it doesn’t exist it’ll cause a problem. To check the method which function will you use?

a) _method()

b) methodexists()

c) is_callable()

d) is_method()


Q17. What will be the output if a protected method is given as argument to the function method_exist()?

a) Method does not exist

b) False

c) Error

d) True 


Q18. Which one of the following function should I use to find the parent class of a class?

a) get_parent_class()

b) parent_class()

c) class_parent()

d) get_class_parent()


Q19. <b> tag makes the enclosed text bold. What is other tag to make text bold?

a) <strong>

b) <dar>

c) <black>

d) <emp>


Q20. Which class accepts a class name or an object reference and returns an array of interface name?

a) class_implements()

b) is_subclass()

c) is_subclass_of()

d) class_interface() 


Part 15: List for questions and answers of PHP


Q1. Answer: b


Q2. Answer: d


Q3. Answer: d


Q4. Answer: a


Q5. Answer: b


Q6. Answer: d


Q7. Answer: c


Q8. Answer: d


Q9. Answer: b


Q10. Answer: c


Q11. Answer: a


Q12. Answer: b


Q13. Answer: d


Q14. Answer: c


Q15. Answer: c


Q16. Answer: c


Q17. Answer: d


Q18. Answer: a


Q19. Answer: a


Q20. Answer: a