Can any body answer me the Questions about PHP

Discussion in 'PHP' started by me4you, May 30, 2007.

  1. #1
    1. What is the return value of <?=date(strtotime("18/0/2006"),"d");?>
    2. What does "PHP" mean?
    3. what is the return value of @mysql_query("no valid sql")
    4. show an example of ternary operator
    5. any idea why subversion is used ?
    6. which API helps you to find out methods and properties of any class?
    7. can you tell what pattern is used in the following code?

    class a
    {
    private static $b;

    static function c()
    {
    self::$b=!self::$b? new a(): self::$b;

    return self::$b;
    }
    }


    8. Please name some libraries used as data access layers for PHP

    9. if mail() function is not working, can you identify possible reasons what is wrong?


    10. Any idea how a web application can share data with another web application?

    11. Can you extract dates from MySQL timestamp field without using PHP?

    12. if $str = "abcd" and $str[2]= c then what is the output of <?=count($str)?>

    13. What is the pattern (regular expression, PCRE) used to extract bold text from the following string?

    [&#1234;&#2213;&#776;&#6625; Hello &#1234;&#2213;&#776;&#6625; World]

    14. can you name some popular template engines for PHP
    15. Any idea about output buffering?
    16. Name your favorite PHP sites. Where from you take helps?

    17. Are you familiar with PEAR, CURL and PECL? Why they are used?
    18. Any idea about caching? Can you name any popular output caching solution for PHP?
    19. What library in PHP is used for image processing?

    20. If CURL is not enabled, can you use any alternate solution?


    I would be more than happy i get answer form DP members..
     
    me4you, May 30, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Sorry, I'm not doing your homework for you. Pay attention in class.
     
    nico_swd, May 30, 2007 IP
  3. dp-user-1

    dp-user-1 Well-Known Member

    Messages:
    794
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Agreed. Most of those could be found with almost no effort.
     
    dp-user-1, May 30, 2007 IP
  4. coderbari

    coderbari Well-Known Member

    Messages:
    3,168
    Likes Received:
    193
    Best Answers:
    0
    Trophy Points:
    135
    #4
    yeah.this seems to be simple homeworks and it can be found easily.
     
    coderbari, May 30, 2007 IP
  5. gibex

    gibex Active Member

    Messages:
    1,060
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    95
    #5
    right nico :) they need to READ
     
    gibex, May 30, 2007 IP
  6. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #6
    These question seem like the sort you would get in an interview, not for homework (though the first few easy questions seem to hint otherwise, then again, they could be to identify no-go candidates). Anyway, Google will help you find most of the answers, how about you just let us know which ones you could not find the answer to and we'll give you pointers.
     
    krt, May 30, 2007 IP
  7. me4you

    me4you Well-Known Member

    Messages:
    1,989
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    155
    #7

    Actually I am test+ing the Skills of DP php programmer's so on one can answers for a single question.. really funny !
    Print "tahnks" lol......
     
    me4you, May 31, 2007 IP
  8. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #8
    Sneaky, lol. But I don't know whether to believe that or not. =p
     
    nico_swd, May 31, 2007 IP
  9. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #9
    1. What is the return value of <?=date(strtotime("18/0/2006"),"d");?>
    It produces an error because it's incorrect usage of the function
    2. What does "PHP" mean?
    hypertext preprocessor
    3. what is the return value of @mysql_query("no valid sql")
    nothing, errors are supressed by @
    4. show an example of ternary operator
    condition ? if condition true : elseif condition false ;

    5. any idea why subversion is used ?
    not really, what does that have to do with php
    6. which API helps you to find out methods and properties of any class?
    reflection
    7. can you tell what pattern is used in the following code?
    question 5, or recursion, you should use the correct words in your questions then they would be easier to understand

    class a
    {
    private static $b;

    static function c()
    {
    self::$b=!self::$b? new a(): self::$b;

    return self::$b;
    }
    }


    8. Please name some libraries used as data access layers for PHP
    not really sure what you mean by that, could have several meanings
    9. if mail() function is not working, can you identify possible reasons what is wrong?
    not from php you can't, php doesn't return an actual result when mail is called, it just returns true if the message is added to the queue
    10. Any idea how a web application can share data with another web application?
    database, luck, ajax, pixies
    11. Can you extract dates from MySQL timestamp field without using PHP?
    if you're not using php, then how are you interacting with mysql, and moreover where are you extracting the date too ? thats another stupid question
    12. if $str = "abcd" and $str[2]= c then what is the output of <?=count($str)?>
    4 and you made another mistake, it's $str{2}
    13. What is the pattern (regular expression, PCRE) used to extract bold text from the following string?
    these characters aren't acsii characters, wtf
    [Ӓࢥ̈᧡ Hello Ӓࢥ̈᧡ World]

    14. can you name some popular template engines for PHP
    smarty, no others are worth using
    15. Any idea about output buffering?
    yes thanks
    16. Name your favorite PHP sites. Where from you take helps?
    no where, I don't need it
    17. Are you familiar with PEAR, CURL and PECL? Why they are used?
    they are three entirely different things, pear and pecl are software extensions of the php code, pecl is c/c++ and pear is interpreted php, curl is a seperate extension - it gives access to the libcurl library from php
    18. Any idea about caching? Can you name any popular output caching solution for PHP?
    mmcache, eAccelerator
    19. What library in PHP is used for image processing?
    gd, imagemagik
    20. If CURL is not enabled, can you use any alternate solution?
    fsock's | socks | fopen

    Some of those questions are too dumb to have been set by a teacher of any sort.
     
    krakjoe, May 31, 2007 IP
  10. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #10
    Both methods would work.
     
    nico_swd, May 31, 2007 IP
  11. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #11
    oh yeah, so they do, it's still a stupid question it doesn't matter what the value of any of the characters are, I find it sooo hard to believe that anyone who is supposed to be a teacher set these questions.
     
    krakjoe, May 31, 2007 IP
  12. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #12
    Yeah, I found a lot of these questions stupid.
     
    nico_swd, May 31, 2007 IP
  13. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #13
    Hmm, and about this:
    The return value is false, it just doesn't output any errors.
     
    nico_swd, May 31, 2007 IP
  14. me4you

    me4you Well-Known Member

    Messages:
    1,989
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    155
    #14
    I am happy now that some answer for the Question. I need more replay !!!!


    Thanks for you answer !!
     
    me4you, May 31, 2007 IP
  15. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #15
    I meant it doesn't return anything, which is the same as false, and there is no output because errors are supressed.
     
    krakjoe, May 31, 2007 IP
  16. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #16
    - $str[int] is not ideal but works
    - $str is a string, not an array or characters, so count($str) is always 1

    This is one question that makes these questions seem like interview ones. This is not so much to do with PHP but experienced developers should know this, especially if they work in a group and/or work on a large distributed script.

    Data access provides interaction between application and data source without using data source specific functions such as mysql_query, instead it uses abstraction. For example, PDO in PHP5, or ADODB, a common 3rd party library.

    I think you are still answering these as HW questions, pretend it is an interview. In this case, I would point out common pitfalls, mail() disabled by server admin, no internet connectivity, malformed email address...

    I'd be looking for things such as web services before pixies :D

    Not really. Think about using MySQL directly, e.g. via a console, does mysql> MY_QUERY... look familiar?
     
    krt, May 31, 2007 IP