1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AVprozaik [17]
2 years ago
12

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 s

torage. 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
Computers and Technology
1 answer:
mars1129 [50]2 years ago
8 0

Answer:

def calculate_storage(filesize):

   block_size = 4096

   full_blocks = filesize // block_size

   partial_block = filesize % block_size

   if partial_block > 0:

       return (full_blocks + 1) * block_size

   return filesize

print(calculate_storage(1))

print(calculate_storage(4096))

print(calculate_storage(4097))

Explanation:

The python program defines the function 'calculate_storage' that calculates the block storage used. It gets the number of blocks used to store the data by making a floor division to get the integer value, then it checks for remaining spaces in the block. If there are spaces left, it adds one to the full_blocks variable and returns the result of the multiplication of the full_blocks and block_size variables.

You might be interested in
In several languages, the visual development environment is known by the acronym ____.
Ad libitum [116K]
Htjhgjfhjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
6 0
3 years ago
Write the header file Stadium.h for a Stadium class. The Stadium class has the following data members: 1) an array of 1000 Seat
irakobra [83]

Answer:

Check the explanation

Explanation:

File: Seat.h:

typedef struct Seat

{

  int seatNumber;

  string customerFullName;

  double seatCost;

};

File: Stadium.h

class Stadium

{

  //Data Members

  private:

      Seat seats[1000];

      string stadiumName;

      int numOccupiedSeats;

 

  public:

      Stadium(string); //Constructor

      void assignSeat(double, string);

      void unAssignedSeat(int seatNumber);

      int getNumberOfAssignedSeats();

      double getCostOfSeat(double seatNumber);

}

4 0
2 years ago
To delete a database object, right-click the object in the Navigation Pane and then click ____ on the shortcut menu.
Reil [10]
Click DELETE on the Shortcut Menu. Be sure that the object you are deleting is closed before because it will not let you delete.
3 0
3 years ago
Please help!!!
skad [1K]

Answer:

B

Explanation:

Problem and Solution

7 0
2 years ago
Read 2 more answers
To give your app users the ability to open your app directly from other apps by clicking a link, you should use:.
pickupchik [31]
<span>To give your app users the ability to open your app directly from other apps by clicking a link, you should use:  deep link. With the deep link and its URL functionality, existing app users are driven directly inside the mobile app itself. 
</span>Deep links are usually made up of two parts: a scheme (part of the link that identifies which app to open).<span>and a </span>host and path (<span>the unique location in the app where your content exists).</span>

7 0
2 years ago
Other questions:
  • Which fingers should you use to type the reach keys?
    12·1 answer
  • DeShawn uses Google Ads. He wants to enable website call conversion tracking so he can see how his current ad campaign is drivin
    12·1 answer
  • Why should you not perform any personal grooming task while driving?
    5·2 answers
  • What are the features of a strong résumé? Check all that apply. The résumé is printed on regular printer paper. The résumé is we
    5·2 answers
  • Even if you cannot afford it you should donate at least 5 of your earnings to charity true or false
    8·1 answer
  • What is the language of computers?
    9·1 answer
  • In java please
    13·1 answer
  • The post-closing trial balance shows the balances of only the ____ accounts at the end of the period.
    12·1 answer
  • Jerry purchased 25 dozens of eggs. He used 6 eggs to bake 1 cake. How
    14·1 answer
  • The quickest way to change a word is to double
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!