Home / CSE / PHP - CS :: File System in PHP

CSE :: PHP - CS

  1. fgets() is used to read a file one line at a time.

  2. A.

     True

    B.

     False

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What is the difference between stat() and fstat()?

  4. 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()

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. flock() is used to unlock a file so that two or more people do not get access to it at the same time.

  6. A.

     True

    B.

     False

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. Which of the following functions reads the entire contents of a file?
    1. fgets()
    2. file_get_contents()
    3. fread()
    4. readfile()
    5. file()

  8. A.

     Option 3 and 5

    B.

     Option 1, 3 and 4

    C.

     Option 2, 4 and 5

    D.

     Option 2 and 4

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. What is the purpose of basename() function?

  10. 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

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. 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?

  12. 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

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. The ............ function checks if the "end-of-file" (EOF) has been reached.

  14. A.

     f_eof()

    B.

     f_of()

    C.

     feofs()

    D.

     feof()

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. The ........... function is used to read a single character from a file.

  16. A.

     fgetc()

    B.

     fgets()

    C.

     fget()

    D.

     fgetf()

    View Answer

    Workspace

    Discuss Discuss in Forum