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
sharon gives a thumbs-up to her little brother who has just scored in his schools basketball game. sharon is communicating by us
stellarik [79]
She is communicating by using a gesture...
Please mark as brainliest...
6 0
3 years ago
Read 2 more answers
What is the function of the NOS? Select all that apply.
Zigmanuir [339]

Answer:

.network management

Explanation:

pls need brainliest

3 0
3 years ago
Read 2 more answers
What are the modes of operation of WLANs?
Nimfa-mama [501]

Answer:

WLAN's or Wireless LAN Units have 2 main modes of operation

Explanation:

The Two Main modes of Operation are the following

<u>Infrastructure Mode:</u> in this mode the main WLAN unit becomes the main connection point in which all devices are connected to and the main unit provides an internet connection to all the devices connected to it.

<u>Ad Hoc Mode:</u> in this mode devices transfer data from one another back and forth without permission from a base unit.

Some WLAN units will also include 2 extra modes of operation called Bridge and Wireless Distribution System (WDS).

<u>Bridge Mode:</u> this mode allows the base unit to act as an intermediary and bridge two different connection points. Such as bridging a wired connection with a wireless one.

<u>WDS Mode:</u> this mode uses various access points to wirelessly interconnect devices to the internet using repeaters to transmit connections. It can provide internet to both wired and wireless clients.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

6 0
3 years ago
Although the first GPS satellite was put into orbit in the ___________, GPS did not provide global coverage until _______.
Ilia_Sergeevich [38]
February 22 1978 and 1992 
5 0
3 years ago
Why was Windows 1.0 considered an operating environment rather than an operating system?
wolverine [178]

Windows 1.0 was only a shell program

The operating system for Windows 1.0 was MS-DOS

4 0
3 years ago
Read 2 more answers
Other questions:
  • Sanjay is giving a slideshow presentation on his entire college class and he is feeling quite nervous in order to share his pres
    9·1 answer
  • Which of the following about if statement is true? A. The condition is a Boolean expression B. A Boolean expression is something
    15·1 answer
  • Which email client feature allows you to store the names and information of people you contact frequently?
    5·1 answer
  • A tracking signal A. is computed as the mean absolute deviation​ (MAD) divided by the running sum of the forecast errors​ (RSFE)
    10·1 answer
  • When you touch a hot stove, along which pathway will the impulses travel and what is the final destination in the cns?
    12·1 answer
  • A single-user/single-tasking operating system allows only one user to perform one task at a time. A real-time operating system g
    13·1 answer
  • ¿porque y como surge la informatica y las computadoras
    13·1 answer
  • Which user interface part shows graphical output of mined data?
    8·2 answers
  • The first time that a particular visitor loads a web site page is called a(n) _____.
    8·1 answer
  • A(n) ____ is a live internet presentation that supports interactive communications between the presenter and the audience.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!