Answer:
19.71 ms
Explanation:
The disk rotates at 3600 rpm, hence the time for one revolution = 60 / 3600 rpm = 16.67 ms.
Hence time to read or write on a sector = time for one revolution / number of sectors per track = 16.67 ms / 32 sectors = 0.52 ms
Head movement time from track 8 to track 9 = seek time = 2 ms
rotation time to head up sector 1 on track 8 to sector 1 on track 9 = 16.67 * 31/32 = 16.15 ms
The total time = sector read time +head movement time + rotational delay + sector write time = 0.52 ms + 2 ms + 16.15 ms + 0.52 ms = 19.19 ms
Answer:
I will write the code in C++ and JAVA
Explanation:
<h2>
JAVA CODE</h2>
public class Main
{ public static void main(String[] args) {
// displays Gershwin,George
System.out.println("Gershwin,George"); } }
<h2>
C++ Code:</h2>
#include <iostream>
using namespace std;
int main()
{ cout<<"Gershwin,George";
}
// displays last name Gershwin followed by , followed by first name George
//displays Gershwin,George as output.
Answer:
The solution is written using Python as it has a simple syntax.
- def getHighScores(gameScores, minScore):
- meetsThreshold = []
- for score in gameScores:
- if(score > minScore):
- meetsThreshold.append(score)
- return meetsThreshold
- gameScores = [2, 5, 7, 6, 1, 9, 1]
- minScore = 5
- highScores = getHighScores(gameScores, minScore)
- print(highScores)
Explanation:
Line 1-8
- Create a function and name it as <em>getHighScores</em> which accepts two values, <em>gameScores</em> and <em>minScore</em>. (Line 1)
- Create an empty list/array and assign it to variable <em>meetsThreshold</em>. (Line 2)
- Create a for loop to iterate through each of the score in the <em>gameScores</em> (Line 4)
- Set a condition if the current score is bigger than the <em>minScore</em>, add the score into the <em>meetsThreshold</em> list (Line 5-6)
- Return <em>meetsThreshold</em> list as the output
Line 11-12
- create a random list of <em>gameScores</em> (Line 11)
- Set the minimum score to 5 (Line 12)
Line 13-14
- Call the function <em>getHighScores()</em> and pass the<em> gameScores</em> and <em>minScore </em>as the arguments. The codes within the function <em>getHighScores()</em> will run and return the <em>meetsThreshold </em>list and assign it to <em>highScores.</em> (Line 13)
- Display <em>highScores</em> using built-in function print().
Answer:
b) objects are resuable
Explanation:
In OOP there's code reuse where a method or any other body of code is defined once and called or reused severally.