PHP 5

COEP
Lets Crack Online Exam

IT Interview Exam Paper: PHP 5

Subject: PHP 5

Part 5: List for questions and answers of PHP

 

Q1. Which of the following advanced OOP features is/are not supported by PHP?

i)Method overloading

ii)Multiple Inheritance

iii)Namespaces

iv)Object Cloning

a) All of the mentioned

b) None of the mentioned

c) i) and ii)

d) iii) and iv)

 

Q2. Which version of PHP introduced the advanced concepts of OOP?

a) PHP 4

b) PHP 5</option

c) PHP 5.3

d) PHP 6

 

Q3. Which one of the following is the right way to clone an object?

a) _clone(targetObject);

b) destinationObject = clone targetObject;

c) destinationObject = _clone(targetObject);

d) destinationObject = clone(targetObject);

 

Q4. The class from which the child class inherits is called..

i)Child class

ii)Parent class

iii)Super class

iv)Base class

a) Only i)

b) ii), iii) and iv)

c) Only iii)

d) ii) and iv) 

 

Q5. Which of the following is/are true for an abstract class?

i)A class is declared abstract by prefacing the definition with the word abstract.

ii)A class is declare abstract by using the keyword implements.

iii)It is a class that really isn’t supposed to ever be instantiated but instead serves as a base class.

iv)Attempting to instantiate an abstract class results in an error.

a) Only ii)

b) All of the mentioned

c) ii) and iv)

d) ii), iii) and iv)

 

Q6. If one intends to create a model that will be assumed by a number of closely related objects, which class must be used?

a) Normal class

b) Static class

c) Abstract class

d) Interface

 

Q7. If your object must inherit behavior from a number of sources you must use a/an

a) Interface

b) Object

c) abstract class

d) static class

 

Q8. Which method is used to tweak an object’s cloning behavior?

a) clone()

b) __clone()

c) clone

d) object_clone()

 

Q9. Which feature allows us to call more than one method or function of the class in single instruction?

a) Typecasting

b) Method Including

c) Method adding

d) Method chaining 

 

Q10. Which magic method is used to implement overloading in PHP?

a) __call

b) __invoke

c) __wakeup

d) __unset

 

Q11. Which one of the following regular expression matches any string containing zero or one p?

a) p+

b) p*

c) P?

d) p#

 

Q12. How many functions does PHP offer for searching strings using POSIX style regular expression?

a) 7

b) 8

c) 9

d) 10

 

Q13. What will be the output of the following PHP code?

1.<?php

2.$username = “jasoN”;

3.if (ereg(“([^a-z])”,$username))

4.echo “Username must be all lowercase!”;

5.else

6.echo “Username is all lowercase!”;

7.?>

a) Error

b) Username must be all lowercase!

c) Username is all lowercase!

d) No Output is returned

 

Q14. POSIX implementation was deprecated in which version of PHP?

a) PHP 4

b) PHP 5

c) PHP 5.2

d) PHP 5.3 

 

Q15. POSIX stands for

a) Portable Operating System Interface for Unix

b) Portable Operating System Interface for Linux

c) Portative Operating System Interface for Unix

d) Portative Operating System Interface for Linux

 

Q16. What will be the output of the following PHP code?

1.<?php

2.$text = “this is\tsome text that\nwe might like to parse.”;

3.print_r(split(“[\n\t]”,$text));

4.?>

a) this is some text that we might like to parse.

b) Array ( [0] => some text that [1] => we might like to parse. )

c) Array ( [0] => this is [1] => some text that [2] => we might like to parse. )

d) [0] => this is [1] => some text that [2] => we might like to parse.

 

Q17. Which of the following would be a potential match for the Perl-based regular expression /fo{2,4}/ ?

i) fol

ii) fool

iii) fooool

iv) fooooool

a) Only i)

b) ii) and iii)

c) i), iii) and iv)

d) and iv)

 

Q18. You need to check whether ___ is set, to determine whether you’re editing an entry or creating a new one.

a) $_GET[‘url’]

b) $_SET[‘url’]

c) $_GET[‘admin’]

d) $_SET[‘admin’] 

 

Q19. To identify entries marked for deletion, you check whether $_GET[‘page’] == ‘delete’ inside ___.

a) index.php

b) index.ini

c) admin.php

d) .htaccess 

 

Q20. Which among the following is/are not a metacharacter?

i)/a

ii)/A

iii)/b

iv)/B

a) Only i)

b) and iii)

c) ii), iii) and iv)

d) and iv) 

 

Part 5: List for questions and answers of PHP

 

Q1. Answer: c

 

Q2. Answer: b

 

Q3. Answer: b

 

Q4. Answer: d

 

Q5. Answer: a

 

Q6. Answer: c

 

Q7. Answer: a

 

Q8. Answer: b

 

Q9. Answer: d

 

Q10. Answer: a

 

Q11. Answer: c

 

Q12. Answer: a

 

Q13. Answer: b

 

Q14. Answer: d

 

Q15. Answer: a

 

Q16. Answer: c

 

Q17. Answer: b

 

Q18. Answer:

 

Q19. Answer: c

 

Q20. Answer: a