Wednesday 16 July 2014

Hello Friends ..


Today is Thursday, and as you know every Thursday we have  weekly test for PHP developers.... conducted by M2 Software Solutions

 

PHP test, PHP web development questions


 Here We go..

Que. 1. 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)



Que. 2. 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



Que. 3. 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



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


a) clone()
b) __clone()
c) _clone

d) object_clone()



Que. 5. 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


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


a) __call
b) __invoke
c) __wakeup
d) __unset


Que. 7. Which one of the following statements is true ?

  1. class CopyMe {}
  2. $first = new CopyMe();
  3. $second = $first;
a) In PHP 4: $second and $first are 2 distinct objects
b) In PHP 5: $second and $first are 2 distinct objects
c) In PHP 4: $second and $first refer to one object
d) None of the above





Que. 8. 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. }
a) PHP Fatal error: Class Illegal Checkout may not inherit from final class
b) Value of the bill calculated
c) PHP Fatal error: Cannot find object
d) PHP Fatal error: Cannot override final method





Que. 9. __clone() is run on the ___ object.


a) original
b) pseudo
c) external
d) copied




Que. 10. Which keyword is used to put a stop on inheritance?


a) stop
b) end
c) break
d) final


Answer-sheet of this test will be available tomorrow...

Share your experience with us.. and give your suggestions in comments


Regards : M2 Software solutions












0 comments:

Post a Comment

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube