🧪 PHP MCQ Quiz Hub

PHP Mcq Set 3

Choose a topic to test your knowledge and improve your PHP skills

Which superglobal stores a variety of information pertinent to a file uploaded to the server via a PHP script?





✅ Correct Answer: 2

How many items are available in the $_FILES array?





✅ Correct Answer: 4

Which function is used to determine whether a file was uploaded?





✅ Correct Answer: 2

What is the full form of DNS?





✅ Correct Answer: 4

Which one of the following function checks for the existence of DNS records?





✅ Correct Answer: 3

Which one of the following function is used to return an array consisting of various DNS resource records pertinent to a specific domain?





✅ Correct Answer: 1

Which one of the following function is used to retrieve the MX records for the domain specified by hostname?





✅ Correct Answer: 3

What is the default port number of HTTPs?





✅ Correct Answer: 2

Which one of the following function returns the port number of a specified service?





✅ Correct Answer: 4

Which one of the following statements can be used to establish port 80 connection with www.nachi.com?





✅ Correct Answer: 1

Which one of the following function is used to send an email using PHP script?





✅ Correct Answer: 4

How many configuration directives pertinent to PHPs mail function are available?





✅ Correct Answer: 2

Which of the following statements is used to add an attachment to the mail?





✅ Correct Answer: 3

Which one of the following is the very first task executed by a session enabled page?





✅ Correct Answer: 3

How many ways can a session data be stored?





✅ Correct Answer: 2

Which directive determines how the session information will be stored?





✅ Correct Answer: 4

Which one of the following is the default PHP session name?





✅ Correct Answer: 1

If session.use_cookie is set to 0, this results in use of _____________





✅ Correct Answer: 3

If the directive session.cookie_lifetime is set to 3600, the cookie will live until ____________





✅ Correct Answer: 1

Neglecting to set which of the following cookie will result in the cookies domain being set to the host name of the server which generated it.





✅ Correct Answer: 4

What is the default number of seconds that cached session pages are made available before the new pages are created?





✅ Correct Answer: 2

What is the default time(in seconds) for which session data is considered valid?





✅ Correct Answer: 3

Which one of the following function is used to start a session?





✅ Correct Answer: 2

Which function is used to erase all session variables stored in the current session?





✅ Correct Answer: 4

What will the function session_id() return is no parameter is passed?





✅ Correct Answer: 1

Which one of the following statements should you use to set the session username to Nachi?





✅ Correct Answer: 2

An attacker somehow obtains an unsuspecting users SID and then using it to impersonate the user in order to gain potentially sensitive information. This attack is known as __________





✅ Correct Answer: 1

Which parameter determines whether the old session file will also be deleted when the session ID is regenerated?





✅ Correct Answer: 2

Which function effectively deletes all sessions that have expired?





✅ Correct Answer: 4

Which function is used to transform PHPs session-handler behavior into that defined by your custom handler?





✅ Correct Answer: 2

The session_start() function must appear _________





✅ Correct Answer: 4

What is the return type of session_set_save_handler() function?





✅ Correct Answer: 1

Which one of the following statements should be used to disable just the fopen(), and file() functions?





✅ Correct Answer: 2

Which one of the following statements should be used to disable the use of two classes administrator and janitor?





✅ Correct Answer: 1

What is the default value of max_execution_time directive? This directive specifies how many seconds a script can execute before being terminated.





✅ Correct Answer: 3

The memory_limit is only applicable if ________ is enabled when you configure PHP.





✅ Correct Answer: 3

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?





✅ Correct Answer: 4

Which Apache directive outputs Apaches server version, server name, port and compile-in modules?





✅ Correct Answer: 1

Which directive determines which degree of server details is provided if the ServerSignature directive is enabled?





✅ Correct Answer: 3

Which directive should we disable to obscure the fact that PHP is being used on our server?





✅ Correct Answer: 2

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?





✅ Correct Answer: 1

AddType application/x-httpd-asp .asp





✅ Correct Answer: 3

What will be the output if we replace the line $num = preg_grep(“/[0-5]/”, $number); with $num = preg_grep(“/[0-5]/”, $number, PREG_GREP_INVERT);?





✅ Correct Answer: 2

Which one of the following functions are used to search a string?





✅ Correct Answer: 1

Which one of the following preg PHP function is used to do a find and replace on a string or an array?





✅ Correct Answer: 1

Which one of the following preg PHP functions is used to take a string, and put it in an array?





✅ Correct Answer: 2

Which one of the following is not a preg PHP function?





✅ Correct Answer: 3

Parameter flags was added in which version of PHP?





✅ Correct Answer: 4

Which one of the following databases has PHP supported almost since the beginning?





✅ Correct Answer: 4

The updated MySQL extension released with PHP 5 is typically referred to as _____





✅ Correct Answer: 3