answer.
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
vagabundo [1.1K]
2 years ago
8

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*2=8192 bytes of storage. Knowing this, can you fill in the gaps in the calculate_storage function below, which calculates the storage size needed for a given filesize?
def calculate_storage(filesize):
block_size = 4096
# Use floor division to calculate how many blocks are fully occupied
full_blocks = _
# Use the modulo operator to check whether there's any remainder
partial_block =
# Depending on whether there's a remainder or not, return the right number.
if partial_block > 0:
return
return ___ Run

print(calculate_storage(1)) # Should be 4096
print(calculate_storage(4096)) # Should be 4096
print(calculate_storage(4097)) # Should be 8192 Reset
Computers and Technology
2 answers:
jenyasd209 [6]2 years ago
8 0

Answer:

Python code given below

Explanation:

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))

Lubov Fominskaja [6]2 years ago
6 0

Answer:

The response resonates with a python code that is shown in the explanation below

Explanation:

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))

You might be interested in
Which bus slot provides highest video performance​
Tresset [83]

Answer:

The best slot to use for video cards is the PCI-Express x16 slot. The next best is the AGP slot. The next best is a PCI-Express x1 slot but video cards which fit that slot are very hard to find as of late 2006. The worst choice for a video card is a PCI slot.

4 0
2 years ago
Which of the following is an object such as a field which can be inserted into a document
ivanzaharov [21]

Answer:

SORRY but U have to make a new question.

Explanation:

bc u put which is the following is ..... u did not put the following

cant help on this one.

8 0
2 years ago
Which statements describe the Sort List feature of Word? Check all that apply.
natulia [17]

Answer: It arranges text in a list alphabetically from A to Z.

Explanation: It's always easier and more systematic to arrange alphabetically. With numbers there is the possibility of infinity but not with alphabet which have a defined range.

7 0
2 years ago
Read 2 more answers
In a fantasy world, your character must face hordes of demons. Each demon is vulnerable to a type of magical spell. This weaknes
Y_Kistochka [10]

I think it's imperfect information.

7 0
2 years ago
Read 2 more answers
Problem 1a. Write a function named hasFinalLetter that takes two parameters 1. strList, a list of non-empty strings 2. letters,
mash [69]

Answer:

The answer is the programming in Python language has strings and characters that has to be declared in the method.

Explanation:

#method

def hasFinalLetter(strList,letters):

output = #output list

#for every string in the strList

for string in strList:

#findout the length of each string in strList

length = len(string)

#endLetter is last letter in each string

endLetter = string[length-1]

#for each letter in the letters list

for letter in letters:

#compare with endLetter

#if we found any such string

#add it to output list

if(letter == endLetter):

output.append(string)

#return the output list

return output

#TestCase 1 that will lead to return empty list

strList1 = ["user","expert","login","compile","Execute","stock"]

letters1 = ["a","b","y"]

print hasFinalLetter(strList1,letters1)

#TestCse2

strList2 = ["user","expert","login","compile","Execute","stock"]

letters2 = ["g","t","y"]

print hasFinalLetter(strList2,letters2)

#TestCase3

strList3 = ["user","expert","login","compile","Execute","stock"]

letters3 = ["k","e","n","t"]

print hasFinalLetter(strList3,letters3)

8 0
2 years ago
Other questions:
  • What is the 5 basic steps of computer programing?
    6·1 answer
  • A storyboard is essentially an outline of a web page's content and design<br> -True or False
    8·2 answers
  • When your computer runs out of ram, the operating system borrows space from the cpu.
    14·1 answer
  • An mp3 takes up about 16 kilobytes of memory per second of music. if you owned a one terabyte hard drive and filled it with only
    15·1 answer
  • An organization has a datacenter manned 24 hours a day that processes highly sensitive information. The datacenter includes emai
    5·1 answer
  • Imagine that you have configured the enable secret command, followed by the enable password command, from the console. You log o
    12·1 answer
  • True or False: A class that implements an interface may only implement a few of that interface's method declarations
    13·1 answer
  • Consider the following two code segments, which are both intended to determine the longest of the three strings "pea", "pear", a
    7·1 answer
  • Draw a flowchart and write the algorithm to find even number between 1 to 50​
    7·1 answer
  • Rideshare companies like Uber or Lyft track the x,y coordinates of drivers and customers on a map. If a customer requests a ride
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!