In a particular Unix OS, each data block is of size 1024 bytes, each node has 10 direct data block addresses and three additional addresses: one for single indirect block,one for double indirect block and one for triple indirect block. Also, each block can contain addresses for 128 blocks. Which one of the following is approximately the maximum size of a file in the file system in GB?
-
Solution
2GB
The semaphore variables full, empty and mute x are initialized to 0, n and 1, respectively. Process P1 repeatedly adds one item at a time to a buffer of size n, and process P2 repeatedly removes one itemat a time from the same buffer using the programs given below.In the programs,K, L, M and N are unspecified statements.
P1:while (1){
K; P(mutex);
Add an item to the buffer;
V(mutex); L;
}
P2 while (1) {
M; P(mutex);
Remove an item from the buffer;
V(mutex); N;
}
The statements K, L, M and N are respectively
-
Solution
This is the algorithm of solution of consumer-producer process with the help of semaphore So,
K = P (empty) P for wait
L = V (full) V for signa
M = P (full)
N = V(empty).
A process executes the following segment of code:
for (i= 1; i <=n; i++)
fork ();
The number of new processes created is
-
Solution
At each for k, the number of processes doubles like from 1 ...2 ... 4 ... 8 – 2n – 1 of these except 1, all are child processes,
Hence(=2n– 1)is correct
Consider the following C program:
#include
typedef struct {
char *a; A
char *b;} t;
void f1 (t s);
void f2 (t *p);
main()
{
static t s = {“A”, “B”};
printf (“%s %s\n”, s.a, s.b);
f1 (s);
printf (“%s %s\n”, s.a, s.b);
f2 (&s);
}
void fl (t s)
{
s.a = “U”;
s.b = “V”,
printf (%s %s\n”, s.a, s.b);
return;
}
void f2 (t*p)
{
p → a = “V”;
p → b = “W”;
printf (“%s %s\n”, p → a, p → b);
return;
}
What is the output generated by the program?
-
Solution
first print A B
f1 is call by value the changes applicable only for local
from f1 UV is printed
back in main A B is printed
then in f2 V W is printed
hence answer is B
Choose the correct option to fill the ?1 and ?2 so that the program prints an input string in reverse order. Assume that the input string is terminated by anew line character.
#include
void wrt_it (void);
int main (void)
{
printf(“Enter Text”);
printf (“/n”);
wrt_it();
printf (“/n”);
return0;
}
void wrt_it (void)
{
int c;
if(?1)
wrt_it();
?2
}
A CPU has only three instructions I1, I2 and I3, which use the following signals in time steps T1– T5 :
I1 :T1 : A in, Bout,Cin
T2: PCout, Bin
T3: Zout,Ain
T4: PC in,Bout T5:End
I2:T1 : Cin, Bout, Din
T2: Aout,Bin
T3: Zout,Ain
T4: Bin, Cout
T5: End
I3 :T1: Din, Aout
T2: Din, Bout
T3: Zout,Ain
T4: Dout,Ain
T5: End
Which of the following logic functions will generate the hardwired control for the signal Ain?
-
Solution
T1 . I1 + T2 . I3 + T4. I3 + T3
Consider a fully associative cache with 8 cache blocks(numbered 0-7) and the following sequence of memory block requests:4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7 If LRU replacement policy is used, which cache block will have memory block 7?
A serial transmission T1 uses 8 information bits, 2 start bits, 1 stop bit and 1 parity bit for each character. Asynchronous transmission T2 uses 3 eight-bit sync characters followed by 30 eight-bit information characters.If the bit rate is 1200 bits/ second in both cases, what are the transfer rates of T1 and T2?
-
Solution
Consider a pipeline processor with 4 stages S1 to S4. We want to execute the following loop: for (i = 1; i < = 1000;i++) {I1, I2, I3, I4}where the time taken (in ns) by instructions I1 to I4 for stages S1 to S4 are given below:
S1 S2 S3 S4
I1: 1 2 1 2
I2 : 2 1 2 1
I3 : 1 1 2 1
I4 : 2 1 2 1
The output of I1 for i =2 will be available after
Let M = (K, ∑, δ, s,F) be a finite state automaton, where K= {A, B}, ∑= {a, b},s = A, F= {B},δ (A, a) = A,δ (A, b) =B, δ(B, a) =B and δ(B,b) =AA grammar to generate the language accepted by M can be specified as G = (V,∑, R, S), where V = K ∪ S, and S = A
Which one of the following set of rules will make L(G) =L(M)?