← Back to 11. File System Interface

πŸ“ Other file access methods

πŸ“– From Operating System β€’ 11. File System Interface β€’ 10 questions available

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

πŸ”„ Last updated: 2026-07-26

3
Easy Questions
4
Medium Questions
3
Hard Questions

πŸ“ Sample Questions

Q1. What is the main difference between mandatory and advisory file locking?

πŸ”Ή A. Mandatory locks rely on processes to check for locks, while advisory locks are enforced by the operating system.
πŸ”Ή B. Mandatory locks are enforced by the operating system, while advisory locks depend on processes to check for locks.
πŸ”Ή C. Mandatory locks allow multiple writers, advisory locks allow only one writer.
πŸ”Ή D. Mandatory locks are faster than advisory locks.

πŸ’‘ Difficulty: easy | βœ… Correct: A

Q2. If a process acquires an exclusive lock on the first 200 bytes of a file, what will happen when another process attempts to acquire a shared lock on bytes 150‑250?

πŸ”Ή A. The shared lock will be granted for the non‑overlapping part.
πŸ”Ή B. The shared lock will be granted after the exclusive lock is released.
πŸ”Ή C. Both locks will be merged into a single lock.
πŸ”Ή D. The shared lock will be denied because the overlapping region is already exclusively locked.

πŸ’‘ Difficulty: medium | βœ… Correct: A

Q3. A Java program needs to ensure that two different threads can write to the first half of a file while multiple threads read the second half concurrently. Which lock strategy using FileChannel.lock best satisfies this requirement?

πŸ”Ή A. Use an exclusive lock on the first half and a shared lock on the second half.
πŸ”Ή B. Use a shared lock on the first half and an exclusive lock on the second half.
πŸ”Ή C. Lock the entire file exclusively.
πŸ”Ή D. Do not use any lock.

πŸ’‘ 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