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

CSE :: PHP - CS

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

  2. A.

     Option 2 and 4

    B.

     Option 1 and 5

    C.

     Option 1 and 4

    D.

     Option 3 and 4

    View Answer

    Workspace

    Discuss Discuss in Forum


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

  4. A.

     True

    B.

     False

    View Answer

    Workspace

    Discuss Discuss in Forum


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

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


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

  8. A.

     True

    B.

     False

    View Answer

    Workspace

    Discuss Discuss in Forum


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

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


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

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


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

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


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

  16. A.

     f_eof()

    B.

     f_of()

    C.

     feofs()

    D.

     feof()

    View Answer

    Workspace

    Discuss Discuss in Forum


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

  18. A.

     fgetc()

    B.

     fgets()

    C.

     fget()

    D.

     fgetf()

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. The filesize() function returns the file size in ___________

  20. A.

     bits

    B.

     bytes

    C.

     kilobytes

    D.

     gigabytes

    View Answer

    Workspace

    Discuss Discuss in Forum