File System MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on File System with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
19
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
23 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
19
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress | 0/19 answered
✓ 0 correct
✗ 0 wrong
0% score
🎉 Set complete! All 19 questions answered.
Question 1 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Question 2 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which one of the following function is capable of reading a specific number of characters form a file?
Question 3 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function sets the file filename’s last-modified and last-accessed times?
Question 4 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which one of the following function reads a directory into an Array?
Question 5 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The ........... function is used to read a single character from a file.
Question 6 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The filesize() function returns the file size in ___________
Question 7 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which one of the following function is capable of reading a file into an array?
Question 8 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which one of the following function is capable of reading a file into a string variable?
Question 9 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which one of the following function operates similarly to fgets(), except that it also strips any HTML and PHP tags form the input?
Question 10 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which one of the following function outputs the contents of a string variable to the specified resource?
Question 11 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function is useful when you want to output the executed command’s result?
Question 12 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
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()
Question 13 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
fgets() is used to read a file one line at a time.
Question 14 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the difference between stat() and fstat()?
Question 15 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
flock() is used to unlock a file so that two or more people do not get access to it at the same time.
Question 16 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following functions reads the entire contents of a file? 1. fgets() 2. file_get_contents() 3. fread() 4. readfile() 5. file()
Question 17 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of basename() function?
Question 18 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
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?
Question 19 of 19
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The ............ function checks if the "end-of-file" (EOF) has been reached.
✓ Link copied to clipboard
Continue Your Practice
Next Practice Set → Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡 Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.