Sail E0 Webinar

MCQs

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

Latest Videos

Latest Test Papers