In a virtual memory system, size of virtual address is 32-bit,size of physical address is 30-bit, page size is 4 Kbyte and size of each page table entry is 32-bit. The main memory is byte addressable. Which one of the following is the maximum number of bits that can be used for storing protection and other information in each page table entry………..?
-
Solution
In a certain operating system, deadlock prevention is attempted using the following scheme. Each process is assigned a unique time stamp, and is restarted with the same time stamp if killed. Let Ph be the process holding a resource R, Pr be a process requesting for the same resource R, and T(Ph) and TP be their times tamps respectively. The decision to wait or preempt one of the processes is based on the following algorithm.
if T(Pr) < T(Ph) then
kill Pr
else wait Which one of the following is TRUE?
-
Solution
This is dead lock free but may cause starvation.Hence correct answer is (a).
A disk has 200 tracks (numbered 0 through 199). At a given time, it was servicing the request of reading data from track 120, and at the previous request, service was for track 90.The pending requests (in order of their arrival) are for track numbers.30 70 115 130 110 80 20 25 How many times will the head change its direction for the disk scheduling policies SSTF (Shortest Seek Time First)and FCFS (First Come First Serve)?
What is the output of the following program?
#include
int funcf (int x);
int funcg (inty);
main ()
{
int x = 5, y = 10, count;
for (count = 1; count < = 2; ++ count) {
y += funcf(x) +funcg(x);
printf (“%d”, y)
}
}
funcf (int x) {
int y;
y =funcg (g);
return (y);
}
funcg (int x) {
static int y = 10;
y + = 1
return (y + x);
}
Consider the following C program which is supposed to compute the transpose of a given 4 × 4 matrix M. Note that,there is an X in the program which indicates some missing statements. Choose the correct option to replace X in the program.
#include
#define ROW 4
#define COL 4
int M [ROW] [COL] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,15, 16};
main ()
{
inti, j, t
for (i = 0; i < 4; ++i)
{
X
}
for (i = 0; i < 4; ++i)
for (j = 0; j <4; ++j)
printf(“%d”, M[i][j]);
}
-
Solution
For finding the swap the element in row with column, i.e.,M[i][j] with M[j][i] using third variable t (as defined as int type)So, block at place of X will be
for (j =i;j <4; ++j] { t = M[i][j] M[j][i] = t } Hence correct answer is (c).
Let f(n), g(n)and h(n) be functions defined for positive integers such that
f(n) = O(g(n), g(n)≠O(f(n)) , g(n)= O(h(n)), and h(n) =O(g(n)). Which one of the following statements is FALSE?
-
Solution
(d) is false statement
because O(f(n)) O (h(n)) = O(g(n) h(n))
f(n) = O(g(n))
h(n) = (g(n))
f(n) h(n) = (O(g(n))) O(g(n)))
= O(g(n)). O(h(n))
from given assumption.
Which one of the following binary trees has its in order and preorder traversals as BCAD and ABCD, respectively?
-
Solution
Checking for each choice
(a)Inorder–BADC
Preorder–ABCD(b)Inorder–BCAD
Postorder–ABCD(c)Inorder–ACBD
Preorder–ABCD(d)Inorder–BCAD
Preorder–ABCD
If we use internal data forwarding to speed up the performance of a CPU (R1, R2 and R3 are registers and M[100]is a memory reference), then the sequence of operations
R1 → M[100]
M[100] → R2
M[100] → R3
can be replaced by
-
Solution
R1, R2 and R3 are register Given sequence of instruction are
R1 → M[100]
M[100] → R2
M[100]→ R3
Contents of R1 is loaded to M[100] as well as R2 and R3, so equivalent instruction can be written as.
R1 → R2, R1 → R3, R1 → M[100] in any sequence. Hence correct answer is (d).
The function AB’C + A’BC + ABC’ + A’B’C’ + AB’C’ is equivalent to
-
Solution
AB’C + A’BC + ABC’ + A’B’C + AB’C’
= AB’(C + C’) + A’C (B + B’) + ABC’
= AB’ + A’C+ ABC’
= A(B’ + BC’) + A’C
= A(B’ +B) (B’ + C’) + A’C
= A(B’ + C’) + A’C
= AB’ + AC’ + A’C
The number (123456)8 is equivalent to
-
Solution
Binary equivalent of(123456)8
= (00001 010 011 100 101 110)2
So for converting it into hexadecimal group, each four bit together
= (A72E)16
Similarly for converting it into base 4 group to bit
= (22130232)
Hence correct answer is (a).