Q1 Consider a hypothetical machine with 3 pages of physical memory ,5 pages of virtual memory and <A,B,C,D,A,B,E,A,B,C,D,E,B,A,B> as the stream of page references by an application. If P and Q are the number of page faults that the application would incur with FIFO and LRU page replacement algorithm respectively then (P,Q) is
(1) (11,10)
(2) (12,11)
(3) (10,11)
(4) (11,12)
Solution (4)
FIFO
ABC (3 page fault)
BCD insert D remove A (1 page fault)
CDA insert A remove B(1 page fault)
DAB insert B remove C (1 page fault)
ABE insert E remove D(1 page fault)
A,B no page fault already in memory.
BEC remove A insert C ( 1 page fault)
ECD remove B insert D(1 page fault)
E no page fault already in memory.
CDB remove E insert B(1 page fault)
DBA remove C insert A (1 page fault)
B no page fault already in memory.
In FIFO total page fault=3+1+1+1+1+1+1+1+1=11
LRU
ABC (3 page fault)
BCD remove A Insert D(1 page fault)
CDA remove B Insert A(1 page fault)
DAB remove C Insert B(1 page fault)
ABE remove D insert E(1 page fault)
A B already in memory so no page fault
EAB
ABC remove E Insert C(1 page fault)
BCD remove A insert D (1 page fault)
CDE remove B insert E(1 page fault)
DEB remove C insert B(1 page fault)
EBA remove D insert A (1 page fault)
B no page fault already in memory.
Total page fault in LRU=3+1+1+1+1+1+1+1+1+1=12
Q2 Consider a code with only four valid code words 0000000000,0000011111,1111100000,1111111111. This code has distance 5. If the code word arrived is 0000000111 then the original code word must be
(1) 0000011111
(2)0000000000
(3) 1111100000
(4) 1111111111
Solution (1)
2t+1=5
2t=4
t=2
So error of 2 bit so solution is (1)
Q3 If algorithm A and another algorithm b take Log(n) and ✔n microseconds,To solve a problem the the largest size of n of a problem these algorithm can solve in one second are
Solution
logn<106
n<2 power 106
✔n<106
square both side
n<1012
Q4 The following program is stored in memory unit of the basic computer. What is the content of the accumulator after the execution of program?
Location Instruction
210 CLA
211 ADD 217
212 iNC
213 STA 217
214 LDA 218
215 CMA
216 AND 217
217 1234H
218 9CE2H
(1) 1002 H
(2) 2011 H
(3) 2022 H
(4) 0215 H
Solution (4)
first clear accumulator
accumulator hold 1234 H
0001 0010 0011 0100
+1
0001 0010 0011 0101
store 217 content
accumulator hold 9CE2H
1001 1100 1110 0010
complement
0110 0011 0001 1101
AND accumulator content and stored 217 content
0110 0011 0001 1101
AND
0001 0010 0011 0101
result
0000 0010 0001 0101
0215 H
Q5 Modifying the software by restructuring is called
(1) Adaptive maintenance
(2) Corrective maintenance
(3) Perfective maintenance
(4) Preventive maintenance
Solution (4) Preventive maintenance
Q6 Consider the following properties
A reflexive
B Anti-symmetric
C Symmetric
Let A ={a,b,c,d,e,f,g} and R={(a,a),(b,b),(c,d),(c,g),(d,g),(e,e),(f,f),(g,g) be a relation on A . Which of the property satisfied by the relation R?
(1) Only A
(2) Only C
(3) Both A and B
(4) B and not A
Solution (4)
Not reflective because no diagonal pair(c,c),(d,d)
Not Symmetric (c,d) is exit in relation but not (d,c)
Q7 Which of the following UML diagrams has a static view?
(1) Collaboration diagram.
(2) Use-Case diagram.
(3) State chart diagram.
(4) Activity diagram
Solution (2) Use-case diagram.
Q8 Suppose you are compiling on a machine with 1-byte chars ,2-byte short,4-byte int and 8-byte doubles and the alignment rules that require the address of every primitive data element to be an integer multiple of element size .Suppose further that the compiler is not permitted to reorder fields padding is used to ensure alignment .How much space will be consumed by the array?
struct
{
short s;
char c;
short t;
char d;
double r;
int i;
}A[10];
(1) 150 bytes
(2) 320 bytes
(3) 240 bytes
(4) 200 bytes
Solution (4)
100/2 100,101
102/1 102
103/2 not divide by 2 so use as padding
104/2 104,105
106/1 106
107/8 padding
108/8 padding
109/8 padding
110/8 padding
111/8 padding
112/8 112 to 120
121/4 padding
122/4 padding
123/4 padding
123-100+1
=24
=24*10=240 bytes.
Q 9 Arrange the types of machine in descending order of complexity.
(A) SISD
(B) MIMD
(C) SIMD
Solution MIMD then SIMD then SISD
Q 10 Match LIST I with LIST II
Let R1={(1,1),(2,2),(3,3)} and R2={(1,1),(1,2),(1,3),(1,4)}
List I List II
(A) R1⋃ R2 (I) {(1,1),(1,2)(1,3)(1,4)(2,2)(3,3)}
(B) R1-R2 (II) {(1,1)
(C) R1⋂ R2 (III) {(1,2),(1,3),(1,4)}
(D) R2-R1 (IV) {(2,2),(3,3)}
Solution
R1⋃ R2 contain all the element of R1 and R2 .So A match with (I).
R1-R2 contain element of R1 not R2 .So (B) match with (IV)
R1⋂ R2 contain common element of R1 and R2 . So (C) match with (II).
R2-R1 contain element of R2 not R1 .So (D) match with (III)
0 Comments