MCQOPTIONS
Saved Bookmarks
This section includes 411 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.
| 201. |
How many methods does the DateTime class have? |
| A. | 8 |
| B. | 9 |
| C. | 10 |
| D. | 11 |
| Answer» C. 10 | |
| 202. |
Say you want to calculate the date 45 days from the present date which one of the following statement will you use? |
| A. | totime(“+45”) |
| B. | totime(“+45 days”) |
| C. | strtotime(“+45 days”) |
| D. | strtotime(“-45 days”) |
| Answer» D. strtotime(“-45 days”) | |
| 203. |
Which function displays the web page’s most recent modification date? |
| A. | lastmod() |
| B. | getlastmod() |
| C. | last_mod() |
| D. | get_last_mod() |
| Answer» C. last_mod() | |
| 204. |
Which one of the following function is useful for producing a timestamp based on a given date and time. |
| A. | time() |
| B. | mktime() |
| C. | mrtime() |
| D. | mtime() |
| Answer» C. mrtime() | |
| 205. |
If the format is F then which one of the following will be returned? |
| A. | Complete text representation of month |
| B. | Day of month, with leading zero |
| C. | Daylight saving time |
| D. | Day of month, without zeros |
| Answer» B. Day of month, with leading zero | |
| 206. |
Which one of the following format parameter can be used to identify timezone? |
| A. | T |
| B. | N |
| C. | E |
| D. | I |
| Answer» D. I | |
| 207. |
The date() function returns ___ representation of the current date and/or time. |
| A. | Integer |
| B. | String |
| C. | Boolean |
| D. | Float |
| Answer» C. Boolean | |
| 208. |
Which one of the following function reads a directory into an Array? |
| A. | scandir() |
| B. | readdir() |
| C. | scandirectory() |
| D. | readdirectory() |
| Answer» B. readdir() | |
| 209. |
Which function is useful when you want to output the executed command result? |
| A. | out_cmm() |
| B. | out_system() |
| C. | cmm() |
| D. | system() |
| Answer» E. | |
| 210. |
Which function sets the file filename last-modified and last-accessed times? |
| A. | sets() |
| B. | set() |
| C. | touch() |
| D. | touched() |
| Answer» D. touched() | |
| 211. |
Which one of the following function outputs the contents of a string variable to the specified resource? |
| A. | filewrite() |
| B. | fwrite() |
| C. | filewrites() |
| D. | fwrites() |
| Answer» C. filewrites() | |
| 212. |
Which one of the following function operates similarly to fgets(), except that it also strips any HTML and PHP tags form the input? |
| A. | fgetsh() |
| B. | fgetsp() |
| C. | fgetsa() |
| D. | fgetss() |
| Answer» E. | |
| 213. |
Which one of the following function is capable of reading a specific number of characters from a file? |
| A. | fgets() |
| B. | fget() |
| C. | fileget() |
| D. | filegets() |
| Answer» B. fget() | |
| 214. |
Which one of the following function is capable of reading a file into a string variable? |
| A. | file_contents() |
| B. | file_get_contents() |
| C. | file_content() |
| D. | file_get_content() |
| Answer» C. file_content() | |
| 215. |
Which one of the following function is capable of reading a file into an array? |
| A. | file() |
| B. | arrfile() |
| C. | arr_file() |
| D. | file_arr() |
| Answer» B. arrfile() | |
| 216. |
Which one of the following PHP function is used to determine a file’s last access time? |
| A. | fileltime() |
| B. | filectime() |
| C. | fileatime() |
| D. | filetime() |
| Answer» D. filetime() | |
| 217. |
The filesize() function returns the file size in ___________ |
| A. | bits |
| B. | bytes |
| C. | kilobytes |
| D. | gigabytes |
| Answer» C. kilobytes | |
| 218. |
Say we have two compare two strings which of the following function/functions can you use? i) strcmp() ii) strcasecmp() iii) strspn() iv) strcspn() |
| A. | i) and ii) |
| B. | iii) and iv) |
| C. | None of the mentioned |
| D. | All of the mentioned |
| Answer» E. | |
| 219. |
How many functions does PHP offer for searching and modifying strings using Perl-compatible regular expressions. |
| A. | 7 |
| B. | 8 |
| C. | 9 |
| D. | 10 |
| Answer» C. 9 | |
| 220. |
Which among the following is/are not a metacharacter? i) \a ii) \A iii) \b iv) \B |
| A. | Only i) |
| B. | i) and iii) |
| C. | ii), iii) and iv) |
| D. | ii) and iv) |
| Answer» B. i) and iii) | |
| 221. |
Which of the following would be a potential match for the Perl-based regular expression /fo{2,4}/ ? i) fol ii) fool iii) fooool iv) fooooool |
| A. | Only i) |
| B. | ii) and iii) |
| C. | i), iii) and iv) |
| D. | i) and iv) |
| Answer» C. i), iii) and iv) | |
| 222. |
POSIX stands for |
| A. | Portable Operating System Interface for Unix |
| B. | Portable Operating System Interface for Linux |
| C. | Portative Operating System Interface for Unix |
| D. | Portative Operating System Interface for Linux |
| Answer» B. Portable Operating System Interface for Linux | |
| 223. |
POSIX implementation was deprecated in which version of PHP? |
| A. | PHP 4 |
| B. | PHP 5 |
| C. | PHP 5.2 |
| D. | PHP 5.3 |
| Answer» E. | |
| 224. |
[:alpha:] can also be specified as.. |
| A. | [A-Za-z0-9]. |
| B. | [A-za-z]. |
| C. | [A-z]. |
| D. | [a-z]. |
| Answer» C. [A-z]. | |
| 225. |
Which one of the following regular expression matches any string containing zero or one p? |
| A. | P+ |
| B. | P* |
| C. | P? |
| D. | P# |
| Answer» D. P# | |
| 226. |
PHP has long supported two regular expression implementations known as _______ and _______ i) Perl ii) PEAR iii) Pearl iv) POSIX |
| A. | i) and ii) |
| B. | ii) and iv) |
| C. | i) and iv) |
| D. | ii) and iii) |
| Answer» D. ii) and iii) | |
| 227. |
Which one of the following filter checks if variable of specified type exists? |
| A. | filter_has_var |
| B. | filter_var |
| C. | filter_id |
| D. | filter_var_array |
| Answer» B. filter_var | |
| 228. |
If the input variable is a string like this “http://www.saåånfoøøundry.com/”, the $url variable after the sanitizing will look like |
| A. | http://www.saåånfoøøundry.com/ |
| B. | http://www.saaanfoooundry.com/ |
| C. | http://www.saånfoøundry.com/ |
| D. | https://www.sanfoundry.com/ |
| Answer» E. | |
| 229. |
Which one of the following does not describe a validating filter? |
| A. | Are used to allow or disallow specific characters in a string |
| B. | Are used to validate user input |
| C. | Strict format rules |
| D. | Returns the expected type on success or FALSE on failure |
| Answer» B. Are used to validate user input | |
| 230. |
Which one of the following filter is used to filter several variables with the same or different filters? |
| A. | filter_var_array() |
| B. | filter_var() |
| C. | filter_input |
| D. | filter_input_array |
| Answer» B. filter_var() | |
| 231. |
How many types of filtering are present in PHP? |
| A. | 3 |
| B. | 2 |
| C. | 4 |
| D. | None |
| Answer» C. 4 | |
| 232. |
Which of the following is/are an external data? i) Cookies ii) Input data from a form iii) Server Variables iv) Web services data |
| A. | Only ii) |
| B. | ii) and iii) |
| C. | None of the mentioned |
| D. | All of the mentioned |
| Answer» E. | |
| 233. |
Which of the following is/are an exception? i) OutOfBoundException ii) OutOfRangeException iii) OverflowException iv) UnderflowException |
| A. | All of the mentioned |
| B. | i) and iii) |
| C. | i) and ii) |
| D. | None of the mentioned |
| Answer» B. i) and iii) | |
| 234. |
Which of the following is/are not an exception? i) BadFunctionCallException ii) BadMethodCallException iii) LogicException iv) DomainException |
| A. | All of the mentioned |
| B. | Only iv) |
| C. | iii) and iv) |
| D. | None of the mentioned |
| Answer» E. | |
| 235. |
How many predefined exceptions does SPL provide access to? |
| A. | 13 |
| B. | 14 |
| C. | 15 |
| D. | 16 |
| Answer» B. 14 | |
| 236. |
What is the full form of SPL in Web/PHP? |
| A. | Standard PHP Library |
| B. | Source PHP Library |
| C. | Standard PHP List |
| D. | Source PHP List |
| Answer» B. Source PHP Library | |
| 237. |
You can extend the exception base class, but you cannot override any of the preceding methods because the are declared as__________ |
| A. | protected |
| B. | Final |
| C. | static |
| D. | private |
| Answer» C. static | |
| 238. |
Which one of the following is the right description for the method getMessage() ? |
| A. | Returns the message if it is passed to the constructor |
| B. | Returns the message if it is passed to the class |
| C. | Returns the message if it is passed to the file |
| D. | Returns the message if it is passed to the object |
| Answer» B. Returns the message if it is passed to the class | |
| 239. |
Which of the following statements invoke the exception class? |
| A. | throws new Exception(); |
| B. | throw new Exception(); |
| C. | new Exception(); |
| D. | new throws Exception(); |
| Answer» C. new Exception(); | |
| 240. |
Which version added the method getPrevious()? |
| A. | PHP 4 |
| B. | PHP 5 |
| C. | PHP 5.1 |
| D. | PHP 5.3 |
| Answer» E. | |
| 241. |
How many methods are available for the exception class? |
| A. | 5 |
| B. | 6 |
| C. | 7 |
| D. | 8 |
| Answer» D. 8 | |
| 242. |
Which function is responsible for sending a custom message to the system log? |
| A. | systemlog() |
| B. | syslog() |
| C. | log_system() |
| D. | sys_log() |
| Answer» C. log_system() | |
| 243. |
Which logging option’s description is, if an error occurs when writing to the syslog, send output to the system console? |
| A. | LOG_CONS |
| B. | LOG_NDELAY |
| C. | LOG_ODELAY |
| D. | LOG_PERROR |
| Answer» B. LOG_NDELAY | |
| 244. |
Which function initializes the constants necessary for using the openlog(), clodelog(), and syslog() functions? |
| A. | define_variable() |
| B. | define_log_variable() |
| C. | log_variable() |
| D. | define_syslog_variable() |
| Answer» E. | |
| 245. |
Which of the following statements causes PHP to disregard repeated error messages that occur within the same file and on the same line? |
| A. | ignore_repeated_errors |
| B. | ignore_repeat_error |
| C. | repeatedly_ignore_error |
| D. | repeated_error_ignore |
| Answer» B. ignore_repeat_error | |
| 246. |
Which version introduced the function error_get_last()? |
| A. | PHP 4 |
| B. | PHP 5 |
| C. | PHP 5.2 |
| D. | PHP 5.3 |
| Answer» D. PHP 5.3 | |
| 247. |
Say you want to report error concerned about fatal run-time, fatal compile-time error and core error which statement would you use? |
| A. | error_reporting = E_ALL |
| B. | error_reporting = E_ERROR | E_PARSE | E_CORE_ERROR |
| C. | error_reporting = E_ERROR | E_COMPILE_WARNING | E_CORE_ERROR |
| D. | error_reporting = E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR |
| Answer» E. | |
| 248. |
Which character do the error_reporting directive use to represent the logical operator NOT? |
| A. | / |
| B. | ! |
| C. | ~ |
| D. | ^ |
| Answer» D. ^ | |
| 249. |
Which version of PHP introduced E_STRICT Error level? |
| A. | PHP 4 |
| B. | PHP 5 |
| C. | PHP 5.2 |
| D. | PHP 5.3 |
| Answer» C. PHP 5.2 | |
| 250. |
What is the description of Error level E_ERROR? |
| A. | Fatal run-time error |
| B. | Near-fatal error |
| C. | Compile-time error |
| D. | Fatal Compile-time error |
| Answer» B. Near-fatal error | |