MCQOPTIONS
Saved Bookmarks
This section includes 30 Mcqs, each offering curated multiple-choice questions to sharpen your Php knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of the following are types of PHP authentication implementation methodologies?i) Hard-coding a login pair directly into the scriptii) File-based authenticationiii) Data-based authenticationiv) PEAR’S HTTP authentication |
| A. | ii) and iii) |
| B. | i) and iv) |
| C. | ii), iii) and iv) |
| D. | All of the mentioned |
| Answer» E. | |
| 2. |
In which of the following situations does file-based authentication become inconvenient.i) small listii) large number of useriii) users are being regularly addediv) static authentication |
| A. | i) and iv) |
| B. | i) and iii) |
| C. | ii) and iii) |
| D. | ii) and iv) |
| Answer» D. ii) and iv) | |
| 3. |
Which of the following variables does PHP use to authenticate a user?i) $_SERVER[‘PHP_AUTH_USER’].ii) $_SERVER[‘PHP_AUTH_USERS’].iii) $_SERVER[‘PHP_AUTH_PU’].iv) $_SERVER[‘PHP_AUTH_PW’]. |
| A. | i) and ii) |
| B. | ii) and iv) |
| C. | i) and iv) |
| D. | ii) and iii) |
| Answer» D. ii) and iii) | |
| 4. |
Which of the following PHP function is commonly used when handling authentication via PHP?i) header()ii) footer()iii) inset()iv) isset() |
| A. | i) and iv) |
| B. | ii) and iv) |
| C. | ii) and iii) |
| D. | i) and iii) |
| Answer» B. ii) and iv) | |
| 5. |
What will be the value of the variable $input in the following PHP code? |
| A. | Swapna Lawrence you are really pretty! |
| B. | Swapna <td>Lawrence</td> you are really<i>pretty</i>! |
| C. | Swapna <td>Lawrence</td> you are really pretty! |
| D. | Swapna Lawrence you are really<i>pretty</i>! |
| Answer» E. | |
| 6. |
In PHP4.1 and later versions, cookies name/value pair are added to the |
| A. | Superglobal array |
| B. | $_COOKIE |
| C. | Global function |
| D. | Both a and b |
| Answer» E. | |
| 7. |
Php.ini file can be viewable by calling |
| A. | info ( ) function |
| B. | ini_file ( ) function |
| C. | phpinfo ( ) function |
| D. | php_ini ( ) function |
| Answer» D. php_ini ( ) function | |
| 8. |
Session_unset ( ) takes |
| A. | 1 argument |
| B. | 2 arguments |
| C. | 3 arguments |
| D. | No argument |
| Answer» E. | |
| 9. |
When value of sessionauto_start ( ) function is zero it means that |
| A. | Session is started |
| B. | No session data will be available |
| C. | Session is terminated |
| D. | None of them |
| Answer» C. Session is terminated | |
| 10. |
$_SESSION array is one of superglobal variables introduced in |
| A. | PHP2.1 |
| B. | PHP3 |
| C. | PHP4.1 |
| D. | PHP6 |
| Answer» D. PHP6 | |
| 11. |
Meaning of superglobal arrays is it can be |
| A. | Referenced inside a function |
| B. | Referenced outside of function |
| C. | Used without declaring global first |
| D. | All of them |
| Answer» E. | |
| 12. |
HTTP protocols by which browsers talk to a web server is |
| A. | Valueless |
| B. | Stateless |
| C. | Useless |
| D. | None of them |
| Answer» C. Useless | |
| 13. |
PHP is not configured to transparently pass session IDs in the |
| A. | GET argument |
| B. | POST argument |
| C. | HEADER arguments |
| D. | Both a and b |
| Answer» E. | |
| 14. |
Which PHP function offers to send raw arbitrary HTTP headers? |
| A. | setcookie ( ) |
| B. | set_header ( ) |
| C. | header ( ) |
| D. | All of them |
| Answer» C. header ( ) | |
| 15. |
Secure ( ) argument in setcookie function returns result |
| A. | In integer form |
| B. | In string form |
| C. | In boolean form |
| D. | None of them |
| Answer» D. None of them | |
| 16. |
If you want to free all variables in a session, which function you can use |
| A. | session_destroy ( ) |
| B. | session_unset ( ) |
| C. | set ( ) |
| D. | All of them |
| Answer» C. set ( ) | |
| 17. |
To initiate a session which function is used? |
| A. | start ( ) |
| B. | s_start ( ) |
| C. | session_start ( ) |
| D. | session_str ( ) |
| Answer» D. session_str ( ) | |
| 18. |
What will be the output of the following PHP code? Say your previous session username was nachi. |
| A. | Username now set to: nachi |
| B. | Username now set to: System |
| C. | Username now set to: |
| D. | Error |
| Answer» D. Error | |
| 19. |
A special kind of a file that is located in filesystem of your browser and can be read and write from web server, is calls as |
| A. | Session |
| B. | Cookies |
| C. | Script |
| D. | All of them |
| Answer» D. All of them | |
| 20. |
If you want PHP to transparently handle passing session variables for you when cookies are not available, you have to configure |
| A. | enable-trans-sid option |
| B. | enable-track-vars option |
| C. | disable-tans-vars option |
| D. | Both a and b |
| Answer» E. | |
| 21. |
A function that takes no argument s and return a string, which is unique key corresponding to a particular session |
| A. | session_name ( ) |
| B. | session_params ( ) |
| C. | session_id ( ) |
| D. | id ( ) |
| Answer» D. id ( ) | |
| 22. |
Name, value, expire, patrh, httponly, domain, secure all of these are arguments of |
| A. | session ( ) function |
| B. | setcookie ( ) function |
| C. | reset_cookie ( ) function |
| D. | None of them |
| Answer» C. reset_cookie ( ) function | |
| 23. |
When a session ia active, PHP provides a special constant called |
| A. | SID |
| B. | CID |
| C. | DID |
| D. | None of them |
| Answer» B. CID | |
| 24. |
www-authenticate mechanism works only under the |
| A. | Apache web server |
| B. | CGI servers |
| C. | ISS servers |
| D. | PWS servers |
| Answer» B. CGI servers | |
| 25. |
In PHP, cookies are set by using the |
| A. | setcookie ( ) function |
| B. | set ( ) function |
| C. | cookie_set ( ) function |
| D. | None of them |
| Answer» B. set ( ) function | |
| 26. |
A period of time during which a particular person, views a number of web pages at a particular machine is called as |
| A. | Session |
| B. | Cookies |
| C. | Parsing |
| D. | None of them |
| Answer» B. Cookies | |
| 27. |
Using $_SESSION, $HTTP_SESSION_VARS functions can be dangerous, so that you can use |
| A. | session_destroy ( ) |
| B. | session_unset ( ) |
| C. | set ( ) |
| D. | None of them |
| Answer» C. set ( ) | |
| 28. |
What kind of session will maintain its identity as long as user stays within a site? |
| A. | Cookie based session |
| B. | Variable based session |
| C. | Session |
| D. | None of them |
| Answer» C. Session | |
| 29. |
WHICH_ONE_OF_THE_FOLLOWING_FUNCTION_IS_USED_TO_START_A_SESSION??$ |
| A. | start_session() |
| B. | session_start() |
| C. | session_begin() |
| D. | begin_session() |
| Answer» C. session_begin() | |
| 30. |
Neglecting to set which of the following cookie will result in the cookie’s domain being set to the host name of the server which generated it.$ |
| A. | session.domain |
| B. | session.path |
| C. | session.cookie_path |
| D. | session.cookie_domain |
| Answer» E. | |