← Back to 11. File System Interface

📝 Sequential file access Method

📖 From Operating System • 11. File System Interface • 9 questions available

Practice MCQs for Sequential file access Method. Test your knowledge with carefully crafted questions across easy, medium, and hard difficulty levels.

🔄 Last updated: 2026-07-26

3
Easy Questions
3
Medium Questions
3
Hard Questions

📝 Sample Questions

Q1. A program wants to lock the first half of a file exclusively using a FileChannel. If the file length is retrieved by raf.length(), which call correctly acquires that lock?

🔹 A. ch.lock(0, raf.length()/2, false)
🔹 B. ch.lock(0, raf.length(), false)
🔹 C. ch.lock(0, raf.length()/2, true)
🔹 D. ch.lock(raf.length()/2, raf.length(), false)

💡 Difficulty: easy | ✅ Correct: A

Q2. Process A obtains an exclusive lock on bytes 0–500 of a file. Process B then attempts to acquire a shared lock on bytes 400–800. What will happen?

🔹 A. Both locks succeed because they are on different parts
🔹 B. Process B's lock is granted but reads only unlocked region
🔹 C. Process B is blocked until Process A releases its lock
🔹 D. Process A's lock is automatically downgraded to shared

💡 Difficulty: medium | ✅ Correct: A

Q3. A file is 2000 bytes long. Which FileChannel.lock call will correctly lock the second half (bytes 1001‑2000) as a shared lock?

🔹 A. ch.lock(1000, 1000, true)
🔹 B. ch.lock(1001, 999, true)
🔹 C. ch.lock(1000, 2000, true)
🔹 D. ch.lock(1001, 1000, true)

💡 Difficulty: hard | ✅ Correct: B

⬆️ View all questions in the quiz below

🔗 Related Topics

📝 File attributes concepts📝 File operations concepts📝 How many File types in file system📝 File structure in file system📝 Internal file structure
🚀 Start Quiz 📝 Practice Mode