MCQs
PC content is stored in memory via MBR and PC gets new address from Y. It represents
a
function call (routine), which is matching with interrupt service initiation
After constructing a max-heap in the heap sort , the time to extract maximum element
and then heapifying the heap takes `Theta`(log n) time by which we could say that `Theta`(log n)
time is
required to correctly place an element in sorted array. If `Theta`(log n) time is taken to sort using
heap sort, then number of elements that can be sorted is constant which is `Theta`(1)
Consider a hard disk with 16 recording surfaces (0 - 15) having 16384 cylinders (0 - 16383 )
and each cylinder contains 64 sectors (0 - 63) . Data storage capacity in each sector is 512
bytes. Data are organized cylinder - wise and the addressing format is . A file of size 42797
KB is stored in the disk and the starting disk location of the file is <1200, 9, 40>.What
is the cylinder number of the last sector of the file, if it is stored in a
contiguous manner?
42797 KB `equiv` `(42797 xx 1024)/(512)` = 85594 sectors
Starting is `langle`1200,9,40`rangle` contains total 24 + (6 x 64) = 408 sectors
Next, 1201, --------, 1283 cylinders contains total 1024 x 83 = 84992 sectors
(`:.` each cylinder contains 16 x 64 = 1024 sectors)
`:.` Total = 408 + 84992 = 85400 sectors
`:.` The required cylinder number is `langle`1284`rangle` which will contain the last sector of the file
`L_1` = {`0^p``1^q``0^r` l p,q,r `ge` 0} is regular
`L_2` = {`0^p``1^q``0^r` l p,q,r `ge` 0,p `ne` r} is CFL
(A) `L_2` is CFL (True)
(B) `L_1` `cap` `L_2` = CFL (True)
(C) `L_2` complement is recursive (True)
(D) `L_1` complement is CFL but not regular (False) as `L_1` is regular `overline(L_1)` is regular
i = (`n/2`, `n/2` +1, `n/2` + 2, ----------n )
Repeats j = ( 2, `2^2`, `2^3`, `2^4`, -----------n )
`n/2` to n = (`n/2` + 1 ) times k = `Theta` ( n log n )
k = k + `n/2`
k = `n/2` + `n/2` + --------log n times = `n/2` log n
= `n/2`log n + `n/2`log n + `n/2` log n ------- ( `n/2` + 1) times
= (`n/2` + 1 ) . `n/2`log n
= `Theta` ( `n^2` log n )
Consider the DFA given below.
1
1
`rightarrow` `rightarrow`
0.1
Which of the following are FALSE?
1. Complement of L(A) is context - free
2. L (A) = L((11* 0 + 0) (0 + 1)* 0*1* )
3. For the language accepted by A, A is the minimal DFA
4. A accepts all strings over {0, 1} of length at least 2
1
1
`rightarrow` `rightarrow`
A :
0.1
(1) L(A) is regular, its complement is also regular and if it is regular it is also context free.(2) L (A) = (11*0 + 0) (0 + 1)* 0*1* = 1*0 (0 + 1)*
Language has all strings where each string contains '0'.
(3) A is not minimal, it can be constructed with 2 states
(4) Language has all strings, where each string contains '0'. (atleast length one)
Consider the following relational schema.
Students(rollno: integer, sname: string)
Courses(courseno: integer, cname: string)
Registration(rollno: integer, courseno; integer, percent: real)
Which of the following queries are equivalent to this query in English?
"Find the distinct names of all students who score more than 90% in the course numbered
107"
(I) SELECT DISTINCT S.sname
FROM Students as S, Registration as R
WHERE R.rollno=S.rollno AND R.Courseno=107 AND R.percent>90
(II) `pi_(sname)` `(sigma_(courseno)` = 107 ^ Percent > 90 ( Registration students))
(III) {Tl `exists` S `in` Students, `exists` R `in` Registration (S.roll no = R. roll no ^
r.courseno = 107 ^ R.percent > 90 ^ T.sname = S. name)}
(iv) {<`S_n` >l `exists` `S_R` `exists` `R_P` (<`S_R` , `S_N` > `in` Students ^ < `S_R` ,107 , `R_P`> `in` Registration ^ `R_P` >90)}
Four queries given in SQL, RA, TRC and DRC in four statements respectively retrieve the
required information
A shared variable x, initialized to zero, is operated on by four concurrent processes
W, X, Y, Z as
follows. Each of the processes W and X reads x from memory, increments
by one, stores it to
memory, and then terminates. Each of the processes Y and Z reads
x from memory, decrements by
two, stores it to memory, and then terminates. Each
process before reading x invokes the P operation (i.e., wait) on a counting semaphore
S and invokes the V operation (i.e., signal) on the
semaphore S after storing x to memory.
Semaphore S is initialized to two. What is the maximum
possible value of x after all processes
complete execution?
W X Y Z
1 R (x) R(x) R(x) R(x)
2 x++ x++ x=x-2; x=x-2;
3 W(x) W(x) W(x) W(x)
R(x) is to read x from memory, w(x) is to store x in memory
(I) `W_1` (x o ) [ W is Preempted]
(II) `Y_1`, `Y_2`, `Y_3` (x -2) [Y is completed]
(III) `Z_1`, `Z_2`, `Z_3` (x -4) [Z is completed]
(IV) `W_2`, `W_3` ( x 1) [It increments local copy of x and stores & W is completed]
(V) `X_1`, `X_2`, `X_3` (x 2) [X is completed]
Maximum value of x = 2
500 x `10^6` bits-------1 sec
`:.` `10^4` bits ----------`(5 xx 10^8)/(10^4)` = `(10^4)/(5 xx 10^8)` sec = `1/(5 xx 10^4)` sec
1 sec--------2 x `10^5` km
`:.` `1/(5 xx 10^4)` sec--------- `(2 xx 10^5)/(5 xx 10^4)` = 4 km
`:.` Maximum length of cable = `4/2` = 2 km
In an IPv4 datagram, the M bit is 0, the value of HLEN is 10, the value of total length is 400
and the fragment offset value is 300. The position of the datagram, the sequence numbers of
the first and the last bytes of the payload, respectively are
(A) Last fragment, 2400 and 2789
(B) First fragment, 2400 and 2759
(C) Last fragment, 2400 and 2759
(D) Middle fragment, 300 and 689
M= 0 - Means there is no fragment after this, i.e. Last fragment
HLEN=10 - So header length is 4 x10=40, as 4 is constant scale factor
Total Length = 400(40 Byte Header + 360 Byte Payload)
Fragment Offset = 300, that means 300 x 8 Byte = 2400 bytes are before this last fragment
So the position of datagram is last fragment
Sequence number of First Byte of Payload = 2400 (as 0 to 2399 Sequence no are used)
Sequence number of Last Byte of Payload = 2400+360-1=2759