🧪 PHP MCQ Quiz Hub

PHP Mcq Set 2

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

How many functions does PHP offer for searching and modifying strings using Perl-compatible regular expressions.





✅ Correct Answer: 2

Which one of the following functions will convert a string to all uppercase?





✅ Correct Answer: 1

Which one of the following functions can be used to concatenate array elements to form a single delimited string?





✅ Correct Answer: 2

Which one of the following functions finds the last occurrence of a string, returning its numerical position?





✅ Correct Answer: 4

The filesize() function returns the file size in ___________





✅ Correct Answer: 2

Which one of the following PHP function is used to determine a file’s last access time?





✅ Correct Answer: 3

Which one of the following function is capable of reading a file into an array?





✅ Correct Answer: 1

Which one of the following function is capable of reading a file into a string variable?





✅ Correct Answer: 2

Which one of the following function is capable of reading a specific number of characters from a file?





✅ Correct Answer: 1

Which one of the following function operates similarly to fgets(), except that it also strips any HTML and PHP tags form the input?





✅ Correct Answer: 4

Which one of the following function outputs the contents of a string variable to the specified resource?





✅ Correct Answer: 2

Which function sets the file filename last-modified and last-accessed times?





✅ Correct Answer: 3

Which function is useful when you want to output the executed command result?





✅ Correct Answer: 4

Which one of the following function reads a directory into an Array?





✅ Correct Answer: 1

The date() function returns ___ representation of the current date and/or time.





✅ Correct Answer: 2

Which one of the following format parameter can be used to identify timezone?





✅ Correct Answer: 3

If the format is F then which one of the following will be returned?





✅ Correct Answer: 1

Which one of the following function is useful for producing a timestamp based on a given date and time?





✅ Correct Answer: 2

Which function displays the web page’s most recent modification date?





✅ Correct Answer: 2

Suppose you want to calculate the date 45 days from the present date which one of the following statement will you use?





✅ Correct Answer: 3

To create an object and set the date to JUNE 22, 2013, which one of the following statement should be executed?





✅ Correct Answer: 4

How many methods does the DateTime class have?





✅ Correct Answer: 2

How many constants does the DateTime class have?





✅ Correct Answer: 4

Which method is simply an object-oriented version of date()?





✅ Correct Answer: 1

Which of the following is the right way to use the DateTime class?





✅ Correct Answer: 3

Which of the following statements can be used to set the time zone in individual scripts?





✅ Correct Answer: 2

Which of the following statements can be used to add two months to the existing date?





✅ Correct Answer: 1

Which method enables you to calculate whether daylight saving time is in force at a specific date and time?





✅ Correct Answer: 2

Which two predefined variables are used to retrieve information from forms?





✅ Correct Answer: 2

The attack which involves the insertion of malicious code into a page frequented by other users is known as _____________





✅ Correct Answer: 3

When you use the $_GET variable to collect data, the data is visible to ______





✅ Correct Answer: 3

When you use the $_POST variable to collect data, the data is visible to _____





✅ Correct Answer: 2

Which variable is used to collect form data sent with both the GET and POST methods?





✅ Correct Answer: 4

Which one of the following should not be used while sending passwords or other sensitive information?





✅ Correct Answer: 1

Which function is used to remove all HTML tags from a string passed to a form?





✅ Correct Answer: 2

To validate an email address, which flag is to be passed to the function filter_var()?





✅ Correct Answer: 1

How many validation filters like FILTER_VALIDATE_EMAIL are currently available?





✅ Correct Answer: 3

How many predefined variables does PHP use to authenticate a user?





✅ Correct Answer: 2

Which function is used to verify whether a variable contains a value?





✅ Correct Answer: 4

In which authentication method does changing the username or password can be done only by entering the code and making the manual adjustment.





✅ Correct Answer: 1

The authenticationFile.txt, the file which stores username and password should be stored ___ the server document root.





✅ Correct Answer: 2

Which function is used to split a string into a series of substrings, with each string boundary is determined by a specific separator?





✅ Correct Answer: 3

Which is the most powerful authentication method among the four?





✅ Correct Answer: 3

Which directive determines whether PHP scripts on the server can accept file uploads?





✅ Correct Answer: 1

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?





✅ Correct Answer: 3

What is the default value of max_input_time directive?





✅ Correct Answer: 2

Since which version of PHP was the directive max_file_limit available.





✅ Correct Answer: 3

What is the default value of the directive max_file_limit?





✅ Correct Answer: 3

Which directive sets a maximum allowable amount of memory in megabytes that a script can allow





✅ Correct Answer: 4

If you want to temporarily store uploaded files in the /tmp/phpuploads/ directory, which one of the following statement will you use?





✅ Correct Answer: 1