InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which directive should we disable to obscure the fact that PHP is being used on our server?(a) show_php(b) expose_php(c) print_php(d) info_phpI had been asked this question during an internship interview.My question comes from Website Security using PHP in chapter File and Session Handling in PHP of PHP |
|
Answer» RIGHT answer is (b) expose_php The explanation: USING the expose_php directive we can PREVENT PHP version details from being appended on our web server signature. When expose_php is disabled, the server signature will look like: Apache/2.2.11 (Ubuntu) Server. |
|
| 2. |
The developers of PHP deprecated the safe mode feature as of which PHP version.(a) PHP 5.1.0(b) PHP 5.2.0(c) PHP 5.3.0(d) PHP 5.3.1The question was asked in class test.The question is from Website Security using PHP topic in chapter File and Session Handling in PHP of PHP |
|
Answer» Right answer is (C) PHP 5.3.0 |
|
| 3. |
Say I want to change the extension of a PHP file, which of the following statements should I edit to change from .php to .html in the httpd.conf file?(a) AddType application/x-httpd-php .php(b) AddType application/x-httpd-php .asp(c) AddType application/x-httpd-asp .php(d) AddType application/x-httpd-asp .aspI got this question in an interview for job.This interesting question is from Website Security using PHP topic in section File and Session Handling in PHP of PHP |
|
Answer» The correct ANSWER is (a) AddType application/x-httpd-PHP .php |
|
| 4. |
Which directive determines which degree of server details is provided if the ServerSignature directive is enabled?(a) ServerAddons(b) ServerExtra(c) ServerTokens(d) ServerDetailsThe question was posed to me during an online exam.This interesting question is from Website Security using PHP topic in chapter File and Session Handling in PHP of PHP |
|
Answer» Correct answer is (c) ServerTokens |
|
| 5. |
Which Apache directive outputs Apache’s server version, server name, port and compile-in modules?(a) ServerSignature(b) ServerName(c) ServerDetails(d) ServerInfoI have been asked this question in examination.My question comes from Website Security using PHP in chapter File and Session Handling in PHP of PHP |
|
Answer» Right option is (a) ServerSignature |
|
| 6. |
Suppose all web material is located within the directory /home/www. To prevent users from viewing and manipulating files such as /etc/password, which one of the following statements should you use?(a) open_dir = “/home/www/”(b) open_dir = /home/www/(c) open_basedir = /home/www/(d) open_basedir = “/home/www/”The question was asked in unit test.The query is from Website Security using PHP topic in chapter File and Session Handling in PHP of PHP |
|
Answer» Right ANSWER is (d) open_basedir = “/home/www/” |
|
| 7. |
The memory_limit is only applicable if ________ is enabled when you configure PHP.(a) –enable-limit(b) -enable-memory-limit(c) –enable-memory-limit(d) -memory-limitThis question was addressed to me in an online quiz.My enquiry is from Website Security using PHP topic in portion File and Session Handling in PHP of PHP |
|
Answer» Correct answer is (C) –enable-memory-limit |
|
| 8. |
What is the default value of max_execution_time directive? This directive specifies how many seconds a script can execute before being terminated.(a) 10(b) 20(c) 30(d) 40I had been asked this question in quiz.I'm obligated to ask this question of Website Security using PHP topic in section File and Session Handling in PHP of PHP |
|
Answer» The correct OPTION is (c) 30 |
|
| 9. |
Which one of the following statements should be used to disable the use of two classes administrator and janitor?(a) disable_classes = “administrator, janitor”(b) disable_classes = class administrator, class janitor(c) disable_classes = class “administrator”, class “janitor”(d) disable_class = class “administrator”, class “janitor”The question was posed to me in an online quiz.Enquiry is from Website Security using PHP topic in section File and Session Handling in PHP of PHP |
|
Answer» RIGHT choice is (a) disable_classes = “ADMINISTRATOR, janitor” Explanation: There may be CLASSES INSIDE the libraries that you’d rather not make AVAILABLE. You can prevent the use of these classes with the disable_classes directive. |
|
| 10. |
Which one of the following statements should be used to disable just the fopen(), and file() functions?(a) disable_functions = fopen(), file()(b) disable_functions = fopen, file(c) functions_disable = fopen(), file()(d) functions_disable = fopen, fileThis question was posed to me in my homework.My doubt stems from Website Security using PHP in division File and Session Handling in PHP of PHP |
|
Answer» The correct CHOICE is (b) disable_functions = fopen, file |
|
| 11. |
What is the return type of session_set_save_handler() function?(a) boolean(b) integer(c) float(d) characterI got this question in an interview for job.I want to ask this question from Session Handling-2 topic in section File and Session Handling in PHP of PHP |
|
Answer» CORRECT option is (a) boolean The best EXPLANATION: Returns TRUE on success or FALSE on FAILURE. |
|
| 12. |
The session_start() function must appear _________(a) after the html tag(b) after the body tag(c) before the body tag(d) before the html tagI got this question in unit test.I want to ask this question from Session Handling-2 topic in section File and Session Handling in PHP of PHP |
|
Answer» CORRECT OPTION is (d) before the HTML tag Explanation: LIKE this: |
|
| 13. |
Which function is used to transform PHP’s session-handler behavior into that defined by your custom handler?(a) session_set_save()(b) session_set_save_handler()(c) Session_handler()(d) session_save_handler()I had been asked this question by my college professor while I was bunking the class.This interesting question is from Session Handling-2 in section File and Session Handling in PHP of PHP |
|
Answer» The correct ANSWER is (b) session_set_save_handler() |
|
| 14. |
Which function effectively deletes all sessions that have expired?(a) session_delete()(b) session_destroy()(c) session_garbage_collect()(d) SessionHandler::gcThe question was posed to me in an international level competition.Asked question is from Session Handling-2 topic in section File and Session Handling in PHP of PHP |
|
Answer» CORRECT option is (d) SessionHandler::gc For EXPLANATION: SessionHandler::gc is used to clean up expired SESSIONS. It is CALLED randomly by PHP internally when a session_start() is invoked. |
|
| 15. |
Which parameter determines whether the old session file will also be deleted when the session ID is regenerated?(a) delete_old_file(b) delete_old_session(c) delete_old_session_file(d) delete_session_fileThis question was posed to me in a job interview.I'd like to ask this question from Session Handling-2 in division File and Session Handling in PHP of PHP |
|
Answer» The correct option is (b) delete_old_session |
|
| 16. |
An attacker somehow obtains an unsuspecting user’s SID and then using it to impersonate the user in order to gain potentially sensitive information. This attack is known as __________(a) session-fixation(b) session-fixing(c) session-hijack(d) session-copyI got this question in final exam.Asked question is from Session Handling-2 topic in chapter File and Session Handling in PHP of PHP |
|
Answer» The correct option is (a) SESSION-fixation |
|
| 17. |
Which one of the following statements should you use to set the session username to Nachi?(a) $SESSION[‘username’] = “Nachi”;(b) $_SESSION[‘username’] = “Nachi”;(c) session_start(“nachi”);(d) $SESSION_START[“username”] = “Nachi”;I got this question by my school principal while I was bunking the class.I want to ask this question from Session Handling-2 topic in chapter File and Session Handling in PHP of PHP |
|
Answer» Right answer is (b) $_SESSION[‘USERNAME’] = “Nachi”; |
|
| 18. |
What will the function session_id() return is no parameter is passed?(a) Current Session Identification Number(b) Previous Session Identification Number(c) Last Session Identification Number(d) ErrorI have been asked this question in homework.My question is based upon Session Handling-2 topic in chapter File and Session Handling in PHP of PHP |
|
Answer» RIGHT answer is (a) Current Session IDENTIFICATION Number Best explanation: The FUNCTION session_id() will RETURN the session id for the current session or the empty STRING (” “) if there is no current session. |
|
| 19. |
Which function is used to erase all session variables stored in the current session?(a) session_destroy()(b) session_change()(c) session_remove()(d) session_unset()This question was posed to me during an interview.This interesting question is from Session Handling-2 in portion File and Session Handling in PHP of PHP |
|
Answer» Correct ANSWER is (d) session_unset() |
|
| 20. |
Which one of the following function is used to start a session?(a) start_session()(b) session_start()(c) session_begin()(d) begin_session()The question was asked during an online interview.This question is from Session Handling-1 topic in portion File and Session Handling in PHP of PHP |
|
Answer» The CORRECT answer is (B) session_start() |
|
| 21. |
What is the default time(in seconds) for which session data is considered valid?(a) 1800(b) 3600(c) 1440(d) 1540I had been asked this question in an international level competition.The above asked question is from Session Handling-1 in section File and Session Handling in PHP of PHP |
|
Answer» Right answer is (c) 1440 |
|
| 22. |
What is the default number of seconds that cached session pages are made available before the new pages are created?(a) 360(b) 180(c) 3600(d) 1800This question was addressed to me in exam.The question is from Session Handling-1 topic in portion File and Session Handling in PHP of PHP |
|
Answer» RIGHT ANSWER is (B) 180 The explanation: The directive which DETERMINES this is session.cache_expire. |
|
| 23. |
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_domainThe question was asked during an interview.The question is from Session Handling-1 topic in section File and Session Handling in PHP of PHP |
|
Answer» CORRECT option is (d) session.cookie_domain To explain: The directive session.cookie_domain DETERMINES the DOMAIN for which the cookie is valid. |
|
| 24. |
If the directive session.cookie_lifetime is set to 3600, the cookie will live until ____________(a) 3600 sec(b) 3600 min(c) 3600 hrs(d) the browser is restartedI got this question at a job interview.Query is from Session Handling-1 in portion File and Session Handling in PHP of PHP |
|
Answer» Correct OPTION is (a) 3600 sec |
|
| 25. |
If session.use_cookie is set to 0, this results in use of _____________(a) Session(b) Cookie(c) URL rewriting(d) Nothing happensThis question was addressed to me in semester exam.The above asked question is from Session Handling-1 topic in section File and Session Handling in PHP of PHP |
|
Answer» Correct answer is (c) URL rewriting |
|
| 26. |
Which one of the following is the default PHP session name?(a) PHPSESSID(b) PHPSESID(c) PHPSESSIONID(d) PHPIDSESSThis question was addressed to me at a job interview.This is a very interesting question from Session Handling-1 in portion File and Session Handling in PHP of PHP |
|
Answer» The CORRECT CHOICE is (a) PHPSESSID |
|
| 27. |
How many ways can a session data be stored?(a) 3(b) 4(c) 5(d) 6I had been asked this question in homework.My query is from Session Handling-1 topic in division File and Session Handling in PHP of PHP |
|
Answer» The correct answer is (b) 4 |
|
| 28. |
Which directive determines how the session information will be stored?(a) save_data(b) session.save(c) session.save_data(d) session.save_handlerThe question was asked in unit test.This intriguing question comes from Session Handling-1 in portion File and Session Handling in PHP of PHP |
|
Answer» Right choice is (d) session.save_handler |
|
| 29. |
Which one of the following is the very first task executed by a session enabled page?(a) Delete the previous session(b) Start a new session(c) Check whether a valid session exists(d) Handle the sessionThis question was posed to me by my college director while I was bunking the class.Query is from Session Handling-1 topic in division File and Session Handling in PHP of PHP |
|
Answer» Right ANSWER is (c) Check whether a valid session exists |
|
| 30. |
Which of the following statements is used to add an attachment to the mail?(a) $mimemail->attachment(‘attachment.pdf’);(b) $mimemail=>attachment(‘attachment.pdf’);(c) $mimemail->addAttachment(‘attachment.pdf’);(d) $mimemail=>addAttachment(‘attachment.pdf’);The question was posed to me by my college professor while I was bunking the class.My question is based upon Networking with PHP topic in section File and Session Handling in PHP of PHP |
|
Answer» Right CHOICE is (c) $mimemail->addAttachment(‘attachment.pdf’); |
|
| 31. |
How many configuration directives pertinent to PHP’s mail function are available?(a) 4(b) 5(c) 6(d) 7I had been asked this question in a national level competition.My enquiry is from Networking with PHP topic in chapter File and Session Handling in PHP of PHP |
|
Answer» RIGHT ANSWER is (b) 5 To ELABORATE: They are- SMTP, sendmail_from, sendmail_path, smtp_port, mail.force_extra_parameters. |
|
| 32. |
Which one of the following statements can be used to establish port 80 connection with www.nachi.com?(a) fsockopen(“www.nachi.com”, 80);(b) sockopen(80,”www.nachi.com”);(c) fsockopen(80,”www.nachi.com”);(d) sockopen(“www.nachi.com”, 80);The question was asked by my school principal while I was bunking the class.The above asked question is from Networking with PHP topic in portion File and Session Handling in PHP of PHP |
|
Answer» Correct answer is (a) fsockopen(“www.nachi.com”, 80); |
|
| 33. |
Which one of the following function is used to send an email using PHP script?(a) mail_send()(b) send_mail()(c) mailrr()(d) mail()The question was asked in an internship interview.Query is from Networking with PHP topic in portion File and Session Handling in PHP of PHP |
|
Answer» The CORRECT answer is (d) mail() |
|
| 34. |
Which one of the following function returns the port number of a specified service?(a) getportname()(b) getservername()(c) getserverbyname()(d) getservbyname()I have been asked this question in an interview for job.This interesting question is from Networking with PHP topic in chapter File and Session Handling in PHP of PHP |
|
Answer» The correct answer is (d) getservbyname() |
|
| 35. |
Which one of the following statements can be used to establish port 80 connection with www.nachi.com?(a) fsockopen(“www.nachi.com”, 80);(b) sockopen(80,”www.nachi.com”);(c) fsockopen(80,”www.nachi.com”);(d) sockopen(“www.nachi.com”, 80);The question was asked in an interview for internship.I'm obligated to ask this question of Networking with PHP topic in division File and Session Handling in PHP of PHP |
| Answer» | |
| 36. |
What is the default port number of HTTPs?(a) 70(b) 80(c) 90(d) 100The question was posed to me during an interview.I would like to ask this question from Networking with PHP topic in division File and Session Handling in PHP of PHP |
|
Answer» Right OPTION is (B) 80 |
|
| 37. |
Which one of the following function is used to retrieve the MX records for the domain specified by hostname?(a) getmx()(b) retrieve_mx()(c) getmxrr()(d) retrieve_mxrr()I got this question in semester exam.This is a very interesting question from Networking with PHP in portion File and Session Handling in PHP of PHP |
|
Answer» Right answer is (C) getmxrr() |
|
| 38. |
What is the full form of DNS?(a) Digital Network System(b) Domain Network System(c) Digital Name Systmem(d) Domain Name SystemThe question was asked during an internship interview.I would like to ask this question from Networking with PHP in chapter File and Session Handling in PHP of PHP |
|
Answer» Right choice is (d) DOMAIN Name System |
|
| 39. |
Which one of the following function checks for the existence of DNS records?(a) checkdns()(b) checkdnsr()(c) checkdnsrr()(d) checkdnsa()I have been asked this question in semester exam.My question is from Networking with PHP in chapter File and Session Handling in PHP of PHP |
|
Answer» Correct option is (c) checkdnsrr() |
|
| 40. |
Which function is used to determine whether a file was uploaded?(a) is_file_uploaded()(b) is_uploaded_file()(c) file_uploaded(“filename”)(d) uploaded_file(“filename”)This question was addressed to me in semester exam.My question is based upon Uploading Files with PHP in division File and Session Handling in PHP of PHP |
|
Answer» The CORRECT answer is (b) is_uploaded_file() |
|
| 41. |
Which one of the following function is used to return an array consisting of various DNS resource records pertinent to a specific domain?(a) dns_get_record()(b) dns_record()(c) dnsrr_get_record()(d) dnsrr_record()I got this question in an interview for internship.This key question is from Networking with PHP in chapter File and Session Handling in PHP of PHP |
|
Answer» The correct choice is (a) dns_get_record() |
|
| 42. |
How many items are available in the $_FILES array?(a) 2(b) 3(c) 4(d) 5The question was asked in examination.Question is from Uploading Files with PHP topic in portion File and Session Handling in PHP of PHP |
|
Answer» Right CHOICE is (d) 5 |
|
| 43. |
Which directive sets a maximum allowable amount of memory in megabytes that a script can allow?(a) max_size(b) post_max_size(c) max_memory_limit(d) memory_limitI had been asked this question in a national level competition.The query is from Uploading Files with PHP in section File and Session Handling in PHP of PHP |
|
Answer» The CORRECT ANSWER is (d) memory_limit |
|
| 44. |
Which superglobal stores a variety of information pertinent to a file uploaded to the server via a PHP script?(a) $_FILE Array(b) $_FILES Array(c) $_FILES_UPLOADED Array(d) $_FILE_UPLOADED ArrayI got this question by my school teacher while I was bunking the class.Question is taken from Uploading Files with PHP topic in portion File and Session Handling in PHP of PHP |
|
Answer» The CORRECT ANSWER is (B) $_FILES Array |
|
| 45. |
If you want to temporarily store uploaded files in the /tmp/phpuploads/ directory, which one of the following statement will you use?(a) upload_tmp_dir “/tmp/phpuploads/ directory”(b) upload_dir “/tmp/phpuploads/ directory”(c) upload_temp_dir “/tmp/phpuploads/ directory”(d) upload_temp_director “/tmp/phpuploads/ directory”I have been asked this question in an internship interview.This intriguing question comes from Uploading Files with PHP topic in chapter File and Session Handling in PHP of PHP |
|
Answer» The correct ANSWER is (a) upload_tmp_dir “/tmp/phpuploads/ directory” |
|
| 46. |
What is the default value of the directive max_file_limit?(a) 10 files(b) 15 files(c) 20 files(d) 25 filesThe question was asked by my school principal while I was bunking the class.The query is from Uploading Files with PHP topic in chapter File and Session Handling in PHP of PHP |
|
Answer» Correct choice is (c) 20 files |
|
| 47. |
Which directive determines whether PHP scripts on the server can accept file uploads?(a) file_uploads(b) file_upload(c) file_input(d) file_intakeI had been asked this question in final exam.My question is taken from Uploading Files with PHP topic in chapter File and Session Handling in PHP of PHP |
|
Answer» Right choice is (a) file_uploads |
|
| 48. |
Which of the following directive determines the maximum amount of time that a PHP script will spend attempting to parse input before registering a fatal error?(a) max_take_time(b) max_intake_time(c) max_input_time(d) max_parse_timeThis question was addressed to me during an online exam.My query is from Uploading Files with PHP in portion File and Session Handling in PHP of PHP |
|
Answer» RIGHT option is (C) max_input_time For explanation: This is relevant because PARTICULARLY large files can take some time to UPLOAD, eclipsing the time SET by this directive. |
|
| 49. |
Since which version of PHP was the directive max_file_limit available.(a) PHP 5.2.1(b) PHP 5.2.2(c) PHP 5.2.12(d) PHP 5.2.21I have been asked this question in final exam.My doubt is from Uploading Files with PHP in chapter File and Session Handling in PHP of PHP |
|
Answer» Correct answer is (C) PHP 5.2.12 |
|
| 50. |
What is the default value of max_input_time directive?(a) 30 seconds(b) 60 seconds(c) 120 seconds(d) 1 secondI had been asked this question by my school teacher while I was bunking the class.My enquiry is from Uploading Files with PHP in section File and Session Handling in PHP of PHP |
|
Answer» Correct answer is (B) 60 SECONDS |
|