Question 1
Consider three CPU intensive processes, which require 10, 20, 30 units and arrive at times 0, 2, 6 respectively. How many context switches are needed if shortest remaining time first is implemented? Context switch at 0 is included but context switch at end is ignored
1
2
3
4
Question 2
A process executes the following code
for (i = 0; i < n; i++) fork( ); The total number of child processes created are
n2
2n+1 -1
2n
2n -1
Question 3
Which of the following is false?
User level threads are not scheduled by the kernel
Context switching between user level threads is faster than context switching between kernel level threads
When a user thread is blocked all other threads of its processes are blocked
Kernel level threads cannot utilize multiprocessor systems by splitting threads on different processors or cores
Question 4
Assume that Source S and Destination D are connected through an intermediate router R. How many times a packet has to visit the network layer and data link layer during a transmission from S to D?
Network layer – 4 times, Data link layer – 4 times
Network layer – 4 times, Data link layer – 6 times
Network layer – 2 times, Data link layer – 4 times
Network layer – 3 times, Data link layer – 4 times
Question 5
Which of the following permutation can be obtained in the same order using a stack assuming that input is the sequence 5, 6, 7, 8, 9 in that order?
7, 8, 9, 5, 6
5, 9, 6, 7, 8
7, 8, 9, 6, 5
9, 8, 7, 5, 6
Question 6
The minimum number of stacks needed to implement a queue is
3
1
2
4
Question 7
Consider the program
void function(int n) {
int i, j, count=0;
for (i=n/2; i <= n; i++)
for (j = 1; j <= n; j = j*2)
count++;}
The complexity of the program is
O(log n)
O(n2)
O(n2 log n)
O(n log n)
Question 8
Consider the recurrence equation
T(n) = 2T(n-1), if n>0
= 1, otherwise
Then T(n) is (in big O order)
O(n)
O(2n)
O(1)
O(log n)
Question 9
A sorting technique is called stable if
If it takes O(n log n) time
It uses divide and conquer technique
Relative order of occurrence of non-distinct elements is maintained
It takes O(n) space
Question 10
Quick sort is run on 2 inputs shown below to sort in ascending order
A. 1, 2, 3……n
B. n, n – 1, n – 2 …… 1
Let C1 and C2 be the number of comparisons made for A and B respectively. Then
C1 > C2
C1 = C2
C1 < C2
Cannot say anything for arbitrary n
There are 79 questions to complete.