📖 From Operating System • 11. File System Interface • 13 questions available
Practice MCQs for Direct file access Method. Test your knowledge with carefully crafted questions across easy, medium, and hard difficulty levels.
🔄 Last updated: 2026-07-26
Q1. A Java program must obtain an exclusive lock on the first half of a file named file.txt whose size is 2000 bytes. Which call to FileChannel.lock correctly acquires this lock?
💡 Difficulty: easy | ✅ Correct: A
Q2. Two threads need to coordinate file access: Thread 1 must obtain an exclusive lock on the first half of a file, while Thread 2 needs a shared lock on the second half. Which ordering of lock acquisition avoids a deadlock?
💡 Difficulty: medium | ✅ Correct: D
Q3. An operating system uses advisory locking. Process A acquires an exclusive lock on a log file. Process B later writes to the same file without explicitly acquiring any lock. What is the most likely outcome?
💡 Difficulty: hard | ✅ Correct: A
⬆️ View all questions in the quiz below