subject

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 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? 1 def calculate_storage(filesize):
2 block_size = 4096
3 # Use floor division to calculate how many blocks are fully occupied
4 full_blocks = ___
5 # Use the modulo operator to check whether there's any remainder
6 partial_block_remainder = ___
7 # Depending on whether there's a remainder or not, return
8 if partial_block_remainder > 0:
9 return ___
10 return ___
11
12 print(calculate_storage(1)) # Should be 4096
13 print(calculate_storage(4096)) # Should be 4096
14 print(calculate_storage(4097)) # Should be 8192
15 print(calculate_storage(6000)) # Should be 8192

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:50, prettybaby406
Explain why it is reasonable to assume that receiving 3 duplicate acks in tcp is an indication that the network is not currently congested.
Answers: 1
image
Computers and Technology, 22.06.2019 19:00, SoccerHalo
How is the number 110 written when expanded out to place values in the base 2 (binary) number system? options: 2 x 4 + 3 x 2 + 4 x 1 1 x 2 + 1 x 2 + 0 x 2 1 x 100 + 1 x 10 + 0 x 1 1 x 4 + 1 x 2 + 0 x 1
Answers: 1
image
Computers and Technology, 22.06.2019 20:00, jc624826
What side length would you specify if you were required to create a regular hexagonal plate that was composed of 33 cm(squared) of sheet metal? dimension the side length to 0.1 cm
Answers: 2
image
Computers and Technology, 23.06.2019 13:30, valeriegarcia12
Select the correct answer from each drop-down menu. which types of computer networks are bigger as well as smaller than a man? a man is a network of computers that covers an area bigger than a , but smaller than a .
Answers: 1
You know the right answer?
If a filesystem has a block size of 4096 bytes, this means that a file comprised of only one byte wi...

Questions in other subjects:

Konu
Biology, 13.12.2021 17:30
Konu
Physics, 13.12.2021 17:30