Request for PHP Object Oriented Programming Interview questions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vivekgs2007
    New Member
    • Mar 2010
    • 62

    Request for PHP Object Oriented Programming Interview questions

    Hi to all,
    I am requesting to all to post some php5 and php6 interview questions and answers, I found it difficult in answering php oops concept, i am facing an interview for that. please help me in that.
    I hope u ill learnt that.
    I will waiting for your reply
    Last edited by Dormilich; Jul 23 '10, 05:37 AM. Reason: spelling
  • dgreenhouse
    Recognized Expert Contributor
    • May 2008
    • 250

    #2
    What is the difference between public, private, and protected attributes and methods?

    Write a class showing the usage of each?

    What is the best way to access a class's (object's) internal attributes and what type of access designation should the attributes be set as?

    What is a singleton?

    Write a class that implements a singleton.

    Why would you use a factory pattern?

    Show some example code using cURL...

    These are just some starters...

    I have to say, if you're going to an interview and asking the above question, expecting to be "drilled" on your knowledge of OOP, and don't know it at even a simple level, you may want to think about studying for awhile....

    Comment

    • dlite922
      Recognized Expert Top Contributor
      • Dec 2007
      • 1586

      #3
      What is MVC and what are some of the popular frameworks that utilize it?

      What is the difference between static and constant members?

      In PHP, will the child class automatically call the parent constructor? (yes|no)

      What is overloading?

      Name some of the magic methods in PHP classes.


      How do you efficiently save an object to a text file and restore it to an object by reading the file? (HINT:serialize/unserialize)

      What is an abstract class?

      What does the final keyword do to a class?

      True or False, the following code shows how to copy an object and change the copy without affecting the original object?

      Code:
      $foo = new SomeClass(); 
      
      $bar = $foo; 
      
      $bar->test = 'baz'
      
      echo $foo->test;
      What is the output of the above code?

      What is type hinting?


      Good Luck!


      Dan

      Comment

      • dgreenhouse
        Recognized Expert Contributor
        • May 2008
        • 250

        #4
        I'd have to say that dlite922's questions and format are a bit better and he(she?) was a bit nicer than I was. If I was a little short, I apologize. If you have access to books online, check out "Object-Oriented PHP" by Peter Lavin. That should give you some basis for further study.

        Also, use this search to find lots of links to study:

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          What is and what are the benefits of:
          1. Encapsulation;
          2. Inheritance;
          3. Polymorphism;
          4. Interfaces;
          5. and, Abstract classes;

          Comment

          • vivekgs2007
            New Member
            • Mar 2010
            • 62

            #6
            Thanks for all I used it well..i got job also....thank q very much..

            Comment

            Working...