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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 22:00
During physical science class ben and jerry connected three identical lightbulbs in parallel to a battery where happens when ben removes one of the lightbulbs from it’s socket
Answers: 2
question
Computers and Technology, 23.06.2019 09:00
Design a class tictactoe that: holds the following information about the game: two-dimensional array (3 by 3), and winner. add additional variables as needed. includes the functions to perform the various operations on objects. for example, function to print the board, getting the move, checking if move is valid, determining if there is a winner after each move. add additional operations as needed. includes constructor(s). write the functions of the class, and write a program that uses the class. the program should declare an object of type tictactoe. the program will create the board and store it in the array. the program will allow two players to play the tic-tac-toe game. after every valid move update the array, check if there is a winner. if there is no winner and no tie, then print the board again to continue.
Answers: 2
question
Computers and Technology, 23.06.2019 18:00
Freya realizes she does not have enough in her bank account to use the debit card. she decides to use a credit card instead. which questions should freya answer before using a credit card? check all that apply. can i pay at least the minimum payment each month? can i make payments on time and avoid late fees? will i have to take out a loan? how much in finance charges can i afford to pay? should i talk to a consumer credit counseling service?
Answers: 1
question
Computers and Technology, 23.06.2019 22:20
Learning sign language is an example of a(n) learning sign language is an example of a(n)
Answers: 2
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
question
Chemistry, 10.11.2020 19:40
question
Mathematics, 10.11.2020 19:40
question
Mathematics, 10.11.2020 19:40
question
History, 10.11.2020 19:40
question
History, 10.11.2020 19:40
question
Social Studies, 10.11.2020 19:40
question
Mathematics, 10.11.2020 19:40
question
Biology, 10.11.2020 19:40
question
Mathematics, 10.11.2020 19:40
Questions on the website: 13722360