Thursday, February 23, 2012

PHP Excellent Question -1


1.      What is the default execution time set in set_time_limit()?
Correct answer: 30 secs

2. What is the difference between GET and POST method?
Correct answer: GET displays the form values entered in the URL of the address bar where as POST does not.

3. How do we submit form data without a Sumbit button?
Correct answer: Both a and b above
Using header() function, Using Javascript

4. What happens if no file path is given in include() function?
Correct answer: Include_path is made use of

5. What does explode() do?
Correct answer: Used to split a string by a string

6. How do I find out the number of parameters passed into function?
Correct answer: By using func_num_args()

7. How can we count the number of elements in an array?
Correct answer: Both a and b above
Using sizeof(),count()

8. Can we use include (”test.php”) two times in a PHP page “test1.PHP”?
Correct answer: Yes

9. In which variable is the users IP address stored?
Correct answer: $REMOTE_ADDR


10. What is the default size of a file set in upload_max_filesize ?
Correct answer: 2 MB

11. Which of the following way below is correct to comment a single line of code in php?
Correct answer: both and b above
//Commented line, #commented line

12. How do we start a php session?
Correct answer: Using session_start()

13. Can echo in php accept more than 1 parameter?
Correct answer:Yes

14. What is the purpose of $_SESSION[]?
Correct answer: Used to store variables of the current session

15. Can I have new lines in $subject tag of php's mail function?
Correct answer: No

16. In mysql_fetch_array() If two or more columns of the result have the same field names, what action is taken?
Correct answer: the last column will take precedence

17. What is the use of mysql_pconnect()?
Correct answer: Both b and c above
Used to create a persistant connection to mysql server., Used to return an identifier of an existing open connection before opening new connection.

18. What is Joomla in PHP?
Correct answer:An open source CMS

19. What is the difference between echo and print?
Correct answer: Echo can take multiple parameters where as print cannot

20. ____________ function in PHP Returns a list of response headers sent (or ready to send)
Correct answer: headers_list()

21. PHP supports both simple and multi-dimensional arrays
Correct answer: True

22. What is array_keys() used for?
Correct answer: Returns all the keys of an array

23. The windows version of PHP does not have built-in support for the calendar extension
Correct answer: False

24. Which of the following statements is FALSE for PHP Error and Logging?
Correct answer: trigger_error() and user_error() are different

25. Parent constructors are not called __________ if the child class defines a constructor
Correct answer: implicitly

26. What is PHP heredoc used for?
Correct answer: allows creating multiple lines of string without using quotations

27. A PHP function cannot be overloaded or redefined
Correct answer: True

28. PHP supports explicit type definition in variable declaration.
Correct answer: False

29. How do I create PHP arrays in a HTML <form>?
Correct answer: < input name="MyArray[]" />

30. Can I generate DLL files from PHP scripts like i can in Perl ?
Correct answer: No

31. How can I run COM object from remote server ?
Correct answer: Both a and c above
like we run local objects, pass the IP of the remote machine as second parameter to the COM constructor.

32. Can I run several versions of PHP at the same time?
Correct answer: Yes


33. Which of the following differences are valid between PHP 4 and PHP 5?
Correct answer: Both a and c
Built-in native support for SQLite, improved MySQL support


34. Which of the following rules below is/are false for exceptions?
Correct answer: Exceptions cannot be thrown (or re-thrown) in a catch block within a try block

35. What is x+ mode in fopen() used for?
Correct answer: Read/Write. Creates a new file. Returns FALSE and an error if file already exists

36. What is the strpos() function used for?
Correct answer: Search for character within a string

37. Is strstr and strchr aliases?
Correct answer: Yes

38. Which function is used to Strip whitespace (or other characters) from the beginning and end of a string?
Correct answer: trim

39. echo does not return any value
Correct answer: True

1 comment:

  1. Awesome, this was really useful .you are posting lot of practical knowledge on computer programmer,mobile app developers,hire programmers.That are completely helpful for all of us .Thanks a lot

    ReplyDelete