A unix-style I-node has 10 direct pointers and one single,one double and one triple indirect pointers. Disk block size is 1 kbyte, disk block address is 32 bit, and 48-bit in tegers are used. What is the maximum possible file size?
-
Solution
Consider the following set of processes with the arrival times and the CPU burst times given in millisecond:
What is the average turn-around time for these processes with the pre-emptive Shortest Remaining Processing Time First (SRPTF) algorithm?
Following declaration of a two-dimensional array in C:
char a[100] [100];
Assuming that the main memory is byte addressable and that the array is stored starting from memory address 0,the address of a [40] [50] is
-
Solution
Given is a [40] [50].
In a [40] [50]
Row = 40
Column = 50
The address is 4050.
Suppose the time to service a page fault is on the average 10 ms, while a memory access takes 1 ms. Then, a 99.99%hit ratio result in average memory access time of
-
Solution
Since, hit ratio = 99.99%
It will make 0.9999 ms.
Therefore,
Average memory access time for 99.99% hit ratio
= Memory access time + 0.9999 = 1 μs +0.9999 μs
= 1.9999 μs
Consider the grammar rule E → E1 – E2 for arithmetic expressions. The code generated is targeted to a CPU having a single user register. The subtraction operation requires the first operand to be in the register. If E1 and E2 do not have any common sub-expression,in order to get shortest possible code.
-
Solution
E1 is to be kept in accumulator & accumulator is required for operations to evaluate E2 also. So E2 should be evaluated first & then E1, so finally E1 will be in accumulator, otherwise need to use move & load instructions.Hence (b) is correct option
Which of the following statements is false?
-
Solution
(a)True for statically typed languages where each variable has fixed type. Similarly (d) is also correct.
(b)True, in un-typed languages types of values are not defined.But option (c) is false, since in dynamically typed language variables have dynamically changing types but not that they have no type.
Hence (c) is correct option.
Which of the following suffices to convert an arbitrary CFG to an LL (1) grammar?
-
Solution
If a grammar has left recursion & left factoring then it is ambiguous. So to convert a CFG to LL(1) grammar both removal of left recursion & left factoring need to be done.Hence (c) is correct option.
Consider the languages
L1 = {anbncm}|n,m>0 and L2={anbmcm}|n,m>0
Which one of the following statements is false?
-
Solution
L1 and L2 are context-free languages and therefore L1 ∩ L2 may or may not be context-free, since CFLs are not closed under intersection. Now, let us look at L1 ∩ L2.L1 ∩ L2= {anbncn| n > 0}
which is clearly not context-free but is context sensitive.
Consider the languages:
L1= {WWR| W ∈ {0, 1)*}
L2= {W # WR| W ∈ {0, 1)*} where # is a special symbol
L3= {WW | W ∈ {0, 1)*}
Which one of the following is true?
-
Solution
In all the options there is linear relationship among strings soall CFL’s , but L1 & L3 can be accepted by PDA, L2 can be accepted by deterministic CFL due to presence of special symbol # which tells the middle of the string, so deterministic.
Which of the following is true?
-
Solution
Option (a) True : The complement of recursive language is always recursive.
Option (b) False : There cursively enumerable language is the language, when taken its complement, lose its recursively enumerable nature.
Option (c) False : The complement of recursive language is always recursive and never recursively enumerable.
Option (d) False : The complement of context free language is never context-free.