Reputation: 317
Let I have created a New Folder and given name as 'parentFolder' then how many bytes it takes to store the name of that file.
This was the question asked in one interview
Thank You.
Upvotes: 1
Views: 109
Reputation: 1518
Would add this as a comment if I had the rep:
I don't really know a good way to determine that without being given a specific file system, and even then it seems like kind of an odd question. Maybe the interviewer was just trying to see if you know how strings are typically stored? Had I gotten that question and didn't get any more clarification as to which OS (or even if I had, since I'm not intimately familiar how each OS stores their folder names), I would have answered along the lines of, "Probably the number of characters in the string plus 1 byte for a null terminator, or perhaps 1 or 2 bytes for some other way of setting off the file name from the rest of the information stored in the file system's file/directory data structure."
Upvotes: 1