MCQOPTIONS
Saved Bookmarks
This section includes 15 Mcqs, each offering curated multiple-choice questions to sharpen your Php knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
The ............ function checks if the "end-of-file" (EOF) has been reached.%! |
| A. | f_eof() |
| B. | f_of() |
| C. | feofs() |
| D. | feof() |
| Answer» B. f_of() | |
| 2. |
What should you do if your script is having problem recognizing file endings from a text file saved on a platform different from the one you’re reading it on?%! |
| A. | Change the auto_detect_line_endings INI setting |
| B. | Use a regular expression to detect the last letter of a line |
| C. | Use fpos() |
| D. | Use ftok() |
| E. | Read the file one character at a time |
| Answer» E. Read the file one character at a time | |
| 3. |
What is the purpose of basename() function?%! |
| A. | Returns the last accessed time of the file |
| B. | Returns the first accessed time of the file |
| C. | Strips of the path and returns the file name |
| D. | Strips of the path and returns the folder name |
| Answer» B. Returns the first accessed time of the file | |
| 4. |
Which of the following functions reads the entire contents of a file?1. fgets()2. file_get_contents()3. fread()4. readfile()5. file()%! |
| A. | Option 3 and 5 |
| B. | Option 1, 3 and 4 |
| C. | Option 2, 4 and 5 |
| D. | Option 2 and 4 |
| Answer» D. Option 2 and 4 | |
| 5. |
flock() is used to unlock a file so that two or more people do not get access to it at the same time.%! |
| A. | True |
| B. | False |
| Answer» C. | |
| 6. |
What is the difference between stat() and fstat()?%! |
| A. | While stat() works on open file pointers, fstat() works on files specified by pathname |
| B. | While fstat() works on open file pointers, stat() works on files specified by pathname |
| C. | fstat() has nothing to do with files |
| D. | stat() has nothing to do with files |
| E. | fstat() is an alias of stat() |
| Answer» C. fstat() has nothing to do with files | |
| 7. |
fgets() is used to read a file one line at a time.%! |
| A. | True |
| B. | False |
| Answer» B. False | |
| 8. |
Which of the following functions retrieve the entire contents of a file in such a way that it can be used as part of an expression?1. file_get_contents()2. fgets()3. fopen()4. file()5. readfile()%! |
| A. | Option 2 and 4 |
| B. | Option 1 and 5 |
| C. | Option 1 and 4 |
| D. | Option 3 and 4 |
| Answer» D. Option 3 and 4 | |
| 9. |
*$_Which one of the following function is capable of reading a specific number of characters form a file?? |
| A. | fgets() |
| B. | fget() |
| C. | fileget() |
| D. | filegets() |
| Answer» B. fget() | |
| 10. |
*/*_Which one of the following function reads a directory into an Array?? |
| A. | scandir() |
| B. | readdir() |
| C. | scandirectory() |
| D. | readdirectory() |
| Answer» B. readdir() | |
| 11. |
%_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() | |
| 12. |
_ Which function is useful when you want to output the executed command’s result?$? |
| A. | out_cmm() |
| B. | out_system() |
| C. | cmm() |
| D. | system() |
| Answer» E. | |
| 13. |
__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() | |
| 14. |
_Which function sets the file filename’s last-modified and last-accessed times?$? |
| A. | sets() |
| B. | set() |
| C. | touch() |
| D. | touched() |
| Answer» D. touched() | |
| 15. |
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() | |