Directory Structure MCQs: 12 Solved OS Questions with Explanations

Solve 12 directory structure questions covering file attributes, directory models, Unix commands, links, inode addressing and block bookkeeping. Each answer includes a direct explanation or complete calculation.

KnowledgeGate Team

Exam prep & CS education

20 Aug 20268 min read

Directory questions look like vocabulary checks until the paper mixes file metadata, hierarchy, Unix commands, links and block arithmetic in the same set. Then one small confusion, such as treating a directory entry and a file control block as the same thing, costs an otherwise easy mark. Attempt each question before reading its explanation, and write the numericals out on paper rather than in your head. The KnowledgeGate file management module carries more than thirty directory questions for continued drill during your GATE CS preparation.

Directory Structure MCQs: File Attributes and Metadata

Files have name, type, location and size attributes. Directories organise names; FCBs store per-file control metadata.

Question 1

Which of the following is not an attribute of a file?

  • (a) Name

  • (b) Type

  • (c) Location

  • (d) Colour

Answer: (d). Name, type and location are file metadata. Colour can be an interface label, not a core file-system attribute.

Question 2

In a file system, what is the purpose of a directory?

  • (a) To speed up the CPU

  • (b) To store system configuration files only

  • (c) To organize files into a hierarchy

  • (d) To act as a temporary storage area

Answer: (c). A directory maps names into a hierarchy. It does not accelerate the CPU, contain only configuration files or provide temporary storage.

Question 3

The information about a file, such as its location, size, status, and other attributes, is kept in a:

  • (a) Master File Table

  • (b) File Control Block

  • (c) Directory Structure

  • (d) Space Management Block

Answer: (b). The FCB holds file size, access information and storage pointers. A directory provides names and lookup entries.

Directory Organisation MCQs: Models, Protection and Names

Directory management controls a namespace and access; naming rules identify files.

Question 4

The simplest model of file system structure, using a single directory for all files, is known as:

  • (a) Single-Level Directory

  • (b) Two-Level Directory

  • (c) Tree-Structured Directory

  • (d) Acyclic-Graph Directory

Answer: (a). Every file shares one directory and namespace. Two-level and tree-structured models add user or nested grouping.

Question 5

Which of the following is/are true about multilevel directory? (More than one option is correct.)

  • (a) Inconsistency problem may occur

  • (b) Easy to implement

  • (c) Searching time for the file is less

  • (d) Two files cannot have the same name in different categories

Answer: (a) and (c). Several directory entries can name one file, so an edit made through one path leaves the others stale unless every entry points at the same inode. Grouping files into subdirectories also shrinks the search space, so a lookup scans far fewer entries than a flat directory would. A tree is harder to implement than a single-level directory, not easier, and two files in different directories may share a name.

Question 6

RSSB 2023

Operating system allows the file system to –

  • (a) Rearrange the characters of the files.

  • (b) Create, Access, Maintain a directory and protection of file from unauthorised access.

  • (c) Change the extension of the file.

  • (d) Transferring files from one computer to another.

Answer: (b). Creation, lookup, maintenance and protection are file-system responsibilities. The other choices concern editing, renaming or transfer.

Question 7

DSSSB 2022

Which of the following statements is correct about file naming in the MS-DOS operating system?

  • (a) The file name may contain a maximum of 10 characters.

  • (b) The file extension may contain a maximum of 5 characters.

  • (c) File name and file extension are separated by the @ symbol.

  • (d) The file extension indicates the type of file.

Answer: (d). An extension identifies file type. A dot, not @, separates it from the name.

Read each command as a literal sequence of operands. mkdir creates its path operands in the order written, so a parent has to exist by the time its child is named. A hard link adds a directory entry for an inode that already exists and raises that inode’s link count.

Question 8

UGC NET 2016, Computer Science

In UNIX, _________ creates three subdirectories : ‘PIS’ and two subdirectories ‘progs’ and ‘data’ from just created subdirectory ‘PIS’.

  • (a) mkdir PIS/progs PIS/data PIS

  • (b) mkdir PIS progs data

  • (c) mkdir PIS PIS/progs PIS/data

  • (d) mkdir PIS/progs data

Answer: (c). The operands create PIS, then progs and data under it. Option (b) creates siblings; the other choices use a parent path before establishing the required hierarchy.

Question 9

Which of the following is true about Hard Links in Unix file systems?

  • (a) They can link files across different file systems

  • (b) They can link directories

  • (c) They increase the link count of a file

  • (d) They are shortcuts to files

Answer: (c). A hard link is another name for the same inode, so it increments the link count. It normally cannot cross file-system boundaries and is not a symbolic-link shortcut.

Directory Storage Numericals: Entry Counts, Inodes and Bookkeeping

Keep bytes, addresses and blocks separate, and apply every ceiling before adding totals.

Question 10

Consider a system that uses directory structure to implement a file system. The block size in this system is 4KB and only one block is sufficient for storing the entire directory structure, with a directory entry size of 32 bits. What is the maximum number of file pointers possible in this machine?

  • (a) 128

  • (b) 256

  • (c) 512

  • (d) 1024

Answer: (d). Put both sizes into bytes first:

  • Block size = 4 KB = 4 x 1024 = 4096 bytes.

  • Directory entry size = 32 bits = 4 bytes.

One block therefore holds 4096 / 4 = 1024 entries, and every entry is one file pointer. The trap is reading the 32 as bytes rather than bits, which gives 4096 / 32 = 128 and lands on option (a); options (b) and (c) follow from 16-byte and 8-byte entries.

Question 11

Assume within an inode there are 12 direct pointers, a single indirect pointer, and a double indirect pointer. Assume a 4KB block size, and disk addresses that are 32 bits. What is the maximum file size (measured in number of blocks) on this system

  • (a) 1049612 blocks.

  • (b) 10496 blocks.

  • (c) 2049612 blocks.

  • (d) 2048 blocks.

Answer: (a). Convert the units first:

  • Block size = 4 KB = 4 x 1024 = 4096 bytes.

  • Address size = 32 bits = 4 bytes.

  • Addresses in one indirect block = 4096 / 4 = 1024.

  • Direct blocks = 12.

  • Single indirect blocks = 1024.

  • Double indirect blocks = 1024 x 1024 = 1,048,576.

Therefore, 12 + 1024 + 1,048,576 = 1,049,612 blocks. The requested unit is blocks, not bytes.

Question 12

GATE 2005, Information Technology

In a computer system, four files of size 11050 bytes, 4990 bytes, 5170 bytes and 12640 bytes need to be stored. For storing these files on disk, we can use either 100 byte disk blocks or 200 byte disk blocks (but can't mix block sizes). For each block used to store a file, 4 bytes of bookkeeping information also needs to be stored on the disk. Thus, the total space used to store a file is the sum of the space taken to store the file and the space taken to store the book keeping information for the blocks allocated for storing the file. A disk block can store either bookkeeping information for a file or data from a file, but not both. What is the total space required for storing the files using 100 byte disk blocks and 200 byte disk blocks respectively?

  • (a) 35400 and 35800 bytes

  • (b) 35800 and 35400 bytes

  • (c) 35600 and 35400 bytes

  • (d) 35400 and 35600 bytes

Answer: (c). Calculate both block counts per file.

For 100-byte blocks:

File size

Data blocks, rounded up

Bookkeeping bytes

Bookkeeping blocks, rounded up

11050

111

111 x 4 = 444

5

4990

50

50 x 4 = 200

2

5170

52

52 x 4 = 208

3

12640

127

127 x 4 = 508

6

Data blocks = 111 + 50 + 52 + 127 = 340; bookkeeping blocks = 5 + 2 + 3 + 6 = 16. Total = (340 + 16) x 100 = 35,600 bytes.

For 200-byte blocks:

File size

Data blocks, rounded up

Bookkeeping bytes

Bookkeeping blocks, rounded up

11050

56

56 x 4 = 224

2

4990

25

25 x 4 = 100

1

5170

26

26 x 4 = 104

1

12640

64

64 x 4 = 256

2

Data blocks = 56 + 25 + 26 + 64 = 171; bookkeeping blocks = 2 + 1 + 1 + 2 = 6. Total = (171 + 6) x 200 = 35,400 bytes.

Do not pool bookkeeping bytes before rounding; each file uses separate whole blocks. For wider context, revise File Systems and Disk Scheduling in OS.

Directory Structure MCQs: How Exams Mix the Concepts

The two kinds of item here fail in different places. The numericals, including the GATE 2005 question at the end, hand you a block size and an entry or address width and ask for a count, so the risk is unit conversion rather than recall: bits read as bytes, or a ceiling applied once at the end instead of once per file. The RSSB, DSSSB and UGC NET items each test one definition or one command, so the risk there is a near-miss distractor: Master File Table against File Control Block, an @ symbol against a dot, three sibling directories against one parent and two children.

Three traps recur. First, a directory entry stores a name and a pointer while the attributes sit in the FCB or the inode: Question 3 is that distinction and nothing else, and Question 2 catches anyone who expects the directory to hold the data. Second, block counts round up per file and never on a pooled total, which is the entire distance between 35,600 and 35,400 in Question 12. Third, mkdir resolves its operands left to right, which is the only thing separating the four options in Question 8.

For definitions, write: directory = names and hierarchy, FCB = per-file metadata, inode = Unix metadata plus block pointers. Redo numericals with units, then without options.

Next, use the File Systems and Allocation MCQ collection for allocation, free-space management and inode practice.

Directory Structure MCQs: The Short Version and Next Step

  • Directory entries hold names and pointers.

  • FCBs and inodes hold per-file metadata.

  • Extensions signal file type in MS-DOS.

  • mkdir creates operands in the order written.

  • Hard links share an inode and raise its link count.

  • Block counts round up per file, never on a pooled total.

  • Indirect blocks multiply address capacity.

After a gap, reattempt Questions 10 to 12 without the worked steps. For the full OS sequence, use GATE Guidance by Sanchit Sir. For timed mixed practice, use the GATE Test Series.