Name of the table that contains the value- data table
Specified if an exact match must be found- mode
Value to be searched- lookup value
Name of the row that contains the value- row index
<u>This is an example with solution:</u>
Five jobs arrive nearly simultaneously for processing and their estimated CPU cycles are, respectively: Job A = 12, Job B = 2, Job C = 15, Job D = 7, and Job E = 3 ms.
a. Using FCFS, and assuming the difference in arrival time is negligible, in what order would they be processed? What is the total time required to process all five jobs? What is the average turnaround time for all five jobs?
Answer: The order of processing for the given jobs = A->B->C->D->E.
Total time needed to process all the jobs = 12+2+15+7+3 = 39 ms.
Turn around time for job A = 12 ms.
Turn around time for job B = 15 ms.
Turn around time for job C = 30 ms.
Turn around time for job D = 37 ms.
Turn around time for job E = 40 ms.
Answer : Therefore, the average turnaround time = (12+15+30+37+40)/5 = 26.8 ms.
Answer:
Sticky notes
Explanation:
I got the question correct
Answer:
False
Explanation:
You can use curly braces to scope everything that's inside of the case body, but they are not necessary.
There are cases where you will need explicit bodies for cases:
If you have two different cases that both contain a variable called 'x', you will need to scope one or both of the cases.
What is scoping?
Scoping in a language defines where variables can be accessed, or referenced.
int i = 0;
// First scope
{
int x = i + 10;
}
// Second scope
{
int j = x + 2;
}
Console.WriteLine(j);
There are a few errors in this code.
In the second scope, we try to use the variable 'x' which was defined in the first scope, but we can't find that variable because it is defined in a scope that cannot be reached by the second scope. The same goes with the Console.WriteLine(j); line, we try to access a variable that is not defined in the current scope, and is instead defined in a nested scope.
In most languages, scoping is essentially a stack, where the lower nested scopes can access variables defined in the previous scope, but not the other way around.
So now you know a little bit about scopes; when to use them in case bodies, and that you do not have to use a body for a case if it's not necessary.