Sail E0 Webinar

MCQs

Total Questions : 19 | Page 2 of 2 pages
Question 11. 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()
  1.    Option 2 and 4
  2.    Option 1 and 5
  3.    Option 1 and 4
  4.    Option 3 and 4
 Discuss Question
Answer: Option C. -> Option 1 and 4
Question 12. Fgets() is used to read a file one line at a time.
  1.    True
  2.    False
 Discuss Question
Answer: Option A. -> True
Question 13. Flock() is used to unlock a file so that two or more people do not get access to it at the same time.
  1.    True
  2.    False
 Discuss Question
Answer: Option B. -> False
Question 14. What is the difference between stat() and fstat()?
  1.    While stat() works on open file pointers, fstat() works on files specified by pathname
  2.    While fstat() works on open file pointers, stat() works on files specified by pathname
  3.    fstat() has nothing to do with files
  4.    stat() has nothing to do with files
  5.    fstat() is an alias of stat()
 Discuss Question
Answer: Option B. -> While fstat() works on open file pointers, stat() works on files specified by pathname
Question 15. Which of the following functions reads the entire contents of a file?
1. fgets()
2. file_get_contents()
3. fread()
4. readfile()
5. file()
  1.    Option 3 and 5
  2.    Option 1, 3 and 4
  3.    Option 2, 4 and 5
  4.    Option 2 and 4
 Discuss Question
Answer: Option C. -> Option 2, 4 and 5
Question 16. What is the purpose of basename() function?
  1.    Returns the last accessed time of the file
  2.    Returns the first accessed time of the file
  3.    Strips of the path and returns the file name
  4.    Strips of the path and returns the folder name
 Discuss Question
Answer: Option C. -> Strips of the path and returns the file name
Question 17. 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?
  1.    Change the auto_detect_line_endings INI setting
  2.    Use a regular expression to detect the last letter of a line
  3.    Use fpos()
  4.    Use ftok()
  5.    Read the file one character at a time
 Discuss Question
Answer: Option A. -> Change the auto_detect_line_endings INI setting
Question 18. The ........... function is used to read a single character from a file.
  1.    fgetc()
  2.    fgets()
  3.    fget()
  4.    fgetf()
 Discuss Question
Answer: Option A. -> fgetc()
Question 19. The ............ function checks if the "end-of-file" (EOF) has been reached.
  1.    f_eof()
  2.    f_of()
  3.    feofs()
  4.    feof()
 Discuss Question
Answer: Option D. -> feof()

Latest Videos

Latest Test Papers