If a filesystem has a block size of 4096 bytes, this means that a file comprised of only one byte will still use 4096 bytes of storage. A file made up of 4097 bytes will use 4096*2=8192 bytes of storage. Knowing this, can you fill in the gaps in the calculate_storage function below, which calculates the total number of bytes needed to store a file of a given size?
Answers
Answered by
0
Answer:
hgggjnbbhjjj
Explanation:
fffgghhhhjj
Answered by
4
Python code is given below for total number of bytes needed to store a file of a given size.
Explanation:
Def calculate_storage(file size):
Block_size = 4096
Full_blocks = file size // block_size
Partial_block = file size % block_size
If partial_block > 0:
Return (full_blocks + 1) * block_size
Return file size
Print(calculate_storage(1))
Print(calculate_storage(4096))
Print(calculate_storage(4097))
Similar questions
Computer Science,
5 months ago
English,
5 months ago
Math,
10 months ago
Accountancy,
10 months ago
Math,
1 year ago
English,
1 year ago