Here is my try.

The time for 3000 rotations = 1 minute

then, The time for one rotation = 20 ms 

In the worst case, there can be disk requests in such a way that the disk head has to move all the way to the other end of the disk (i.e., move consecutively 99 tracks at one go), after reaching the other end, the disk might need to do one full rotation to reach particular block for data transfer.

Total seek time per request = (99 tracks * 0.2 ms) + (20 ms for full rotation) = 39.8 ms

Rotational delay per request = half of the disk rotation time = 10 ms

Data transfer time is not given, so we may assume it to be negligible.

Total time taken to service 100 requests = 100 * \((T_{seek})\)  + 99 * \((T_{rotat\_delay})\)= 100 * (39.8 ms) + 99 * (10 ms) = 3980 + 990 = 4970 ms

more less

A very good example from wikipedia: https://en.wikipedia.org/wiki/Operator_associativity#A_detailed_example

 

Roughly, When there are no paranthesis, the precedence and associativity boils down to this:

  • when all the operators are different, the operator with highest precedence will be executed first
  • when two or more operators are same, the tie-break will be done according to associativity. i.e., if the operator has right associativity, right-most operation will be executed first

 

In this example,

  • according to precedence, we can assign paranthesis as follows:

((a+(bxc))-(d^e^f))

  • Now, tie-break between '^' operators is carried-out based on associativity. i.e., right operation is superior.

((a+(bxc))-(d^(e^f)))

  • write the expression into post-fix notation

abcx+def^^-

 

more less

D) None of the above

 

The ACK number tells the sender that the sequence number of the "next" packet should be 1000.

It does not mean that 999/1000/1001 bytes have been already received. Since, the initialialization of sequence number is done randomly, we cannot predict the number of bytes received already.

 

more less

here is my try.

We have to find the probability that he had "actually won" given that he "says he has won". i.e., Pr(Actual winning | saying that he won).

According to bayes rule,

Pr(Actual winning | saying that he won) =  {Pr(saying that he won | Actual winning) * Pr(Actual winning)} / {Pr(saying that the won)}

The terms involved in bayes rule are calculated as below:

Pr(saying that he won | Actual winning) = probabilty of saying that he has won given he actually won = 1/6 (only if says truth)

Pr(Actual winning) = 1/36 (only if he gets two '6's from 2 blue dice)

Pr(saying that the won) = Pr(Autually won and saying truth) + Pr(Autually lost and saying lie) = (1/36 * 1/6) + (35/36 * 5/6) = 176 / (36*6)

putting all of them together, we get,  Pr(Actual winning | saying that he won) = (1/6 * 1/36) / (176/(36*6)) = 1/176

more less

"wait/signal (mutex)" has been introduced, only to make sure that a single process accesses the Queue.

The solution would be wrong (leads to deadlock), as per the below scenario.

  • initially, let the Queue be empty i.e, full = 0, empty = BUFFER SIZE.
  • Now, the consumer has to wait and producer has to produce.
  • according to the definition of the locks 'full' (=0), 'empty' (=BUFFER SIZE)
    1. wait(full) will not the let the consumer to pass through
    2. wait(empty) will let the producer to pass through and add the item to Queue
  • when we change the order in Consumer process, "assume" the consumer will acquire the 'mutex' straight away. Now consumer has the call 'wait(full)' which will stop the consumer process.
  • In producer side, Since the 'mutex' is already locked by consumer, the producer cannot add any item to Queue. hence, a deadlock.

producer-consumer-deadlock

more less
A redundant question as well as leads to compiler error.
http://www.techtud.com/doubt/linked-list-question-0
more less
We can take an example.
say there are 3 sets A, B, C such that A={1,2,3} , B={2,3,4}, C={3,4,5}

Associative property:

A-(B-C) = (A-B)-C?

L.H.S: A-(B-C) = {1,2,3} - ({2,3,4} - {3,4,5}) = {1,2,3} - {2} = {1,3}
R.H.S: (A-B)-C = ({1,2,3} - {2,3,4}) - {3,4,5} = {1} - {2,3,4} = {1}

L.H.S not equal to R.H.S. Hence, Set difference operator is not associative.

more less
12 Mar 2016 - 12:43am

Total elements from all the sorted lists = \(log(n) * {n \over {log(n)}}= n\)

If we use a heap and arrange all the log(n) sorted list as a min-heap by considering only the first elements of each list, we will get a heap of height log(log(n)). note that, in the heap, each element is a sorted list. i.e., the extract-min-key() will have the time complexity of log(log(n)).

We need to extract n such elements from the heap. Time complexity = n * log(log(n))

more less

Pages