1) What is the first step in problem-solving? A) Writing code B) Debugging C) Understanding the problem D) Optimizing the solution Answer: C 2) Which of these is not a step in the problem-solving process? A) Algorithm development B) Problem analysis C) Random guessing D) Testing and debugging Answer: C 3) What is an algorithm? A) A high-level programming language B) A step-by-step procedure to solve a problem C) A flowchart D) A data structure Answer: B 4) Which of these is the simplest data structure for representing a sequence of elements? A) Dictionary B) List C) Set D) Tuple Answer: B 5) What does a flowchart represent? A) Errors in a program B) A graphical representation of an algorithm C) The final solution to a problem D) A set of Python modules Answer: B 6) What is pseudocode? A) Code written in Python B) Fake code written for fun C) An informal high-level description of an algorithm D) A tool for testing code Answer: C 7) Which of the following tools is NOT commonly used in pr...
Stable-Storage Implementation
* The concept of stable storage includes a storage medium in which data is never lost, even in the face of equipment failure in the middle of a write operation.
* To implement this requires two (or more) copies of the data, with separate failure modes.
* An attempted disk write results in one of three possible outputs:
• The data is successfully and completely written.
• The data is partially written, but not completely. The last block written may be
garbled.
• No writing takes place at all.
* Whenever an equipment failure occurs during a write, the system must detect it, and return the system back to a consistent state. To do this requires two physical blocks for every logical block, and the following procedure:
• Write the data to the first physical block.
• After step 1 had completed, then write the data to the second physical block.
• Declare the operation complete only after both physical writes have completed
successfully.
* During recovery the pair of blocks is examined.
• If both blocks are identical and there is no sign of damage, then no further action
is necessary.
• If one block contains a detectable error but the other does not, then the damaged
block is replaced with the good copy. (This will either undo the operation or
complete the operation, depending on which block is damaged and which is
undamaged.)
• If neither block shows damage but the data in the blocks differ, then replace the
data in the first block with the data in the second block. (Undo the operation.)
* Because the sequence of operations described above is slow, stable storage usually includes NVRAM as a cache, and declares a write operation complete once it has been written to the NVRAM.