Operating Systems Test - 3 - PDF Flipbook

Operating Systems Test - 3

260 Views
63 Downloads
PDF 5,162,442 Bytes

Download as PDF

REPORT DMCA


GATE
CSE

Operating
systems

Test-03Solutions


OPERATING SYSTEMS
1. Dirty bit for a page in a page table

a) helps avoid unnecessary writes on a paging device
b) helps maintain LRU information
c) allows only read on a page
d) None of the above
Answer: (b)
Solution:
PNG uses a non-patented lossless data compression method
known as DEFLATE.
2. Specialization is a _ process.
a) Top-down
b) Bottom-up
c) Both (a) and
d) (b) (d) None of these
Answer: (a)
Solution:
Specialization may be seen as the reverse process of
generalization. Specialization is the abstracting process of
introducing new characteristics to an existing class of objects in
simple terms, a group of entities in specialization can be
categorized into subgroups based on their characteristics
So, it is a top- down approach in which one higher level entity
can be broken down into two lower level entities it defines one

1


or more prototypes of the super types and formatting super
type/subtype relationship

The image part with relationship ID rId8 was not found in the file.

3. Consider the program given below, in a block-structured
pseudo-language with lexical scoping and nesting of procedures
permitted.
Program main;
var…
Procedure A1;
var..
call A2;
End A1
Procedure A2;
var..
Procedure A21;
var..
call A1;
End A21
call A21;

2


End A2
Call A1;
End main.
Consider the calling chain:
Main →A1 →A2→A21→A1
The correct set of activation records along with their access
links is given by
a)

The image part with relationship ID rId8 was not found in the file.

b)

The image part with relationship ID rId8 was not found in the file.

c)

The image part with relationship ID rId8 was not found in the file.

3


d)

The image part with relationship ID rId8 was not found in the file.

Answer: (d)
Solution:
Static logical scoping used a clean links are shown to
Statistically (Textually) enclosing blocks.

The image part with relationship ID rId8 was not found in the file.

Lexical scoping refers to static scoping. The referencing
environments of the statements are local scope plus parental
scope.
4. The optimal solution of the following assignment problem using
Hungarian method is devices given below with there is

The image part with relationship ID rId8 was not found in the file.

4


Codes:
AB C D

a) (i) (ii) (iii) (iv)
b) (i) (iii) (ii) (iv)
c) (i) (iii) (iv) (ii)
d) (i) (iv) (ii) (iii)
Answer: (b)
Solution:
(a) Cost = 8 + 28 + 18 + 10 = 64
(b) Cost = 8 + 4 + 19 + 10 = 41
(c) Cost = 8 + 4 + 15 + 26 = 53
(d) Cost = 8 + 26 + 19 + 24 = 77
5. What value would the following function return for the input x =
95?
Function fun (x: integer): integer
Begin
If x> 100 then return (x-10);
Else
Return (fun(fun(x+11)));
End;
a) 89
b) 90
c) 91
d) 92
Answer: (c)

5


6. Are we building the right product? This statement refers to
a) Verification
b) Validation
c) Testing
d) Software quality assurance
Answer: (b)
Solution:
Verification and validation are;
Validations are we building the right product?
Verification: Are we building the product right

7. Using RSA algorithm, what is the value of cipher text C, if the
plain Text M = 5 and p = 3, q = 11 & d =7?
a) 33
b) 5
c) 2s
d) 26
Answer: (d)
Solution:
Given in RSA algorithm
P = 3,
Q = 11,
N = p. q = 3 *11 = 33
Now, chose ‘e’ such that GCD (e,(n)) = 1
Let, e = 3, and given
D = 7,

6


M=5
Encryption:
C = me and n

= 53 mod 33
= 125 mod 33 =26
8. I/O redirection
a) Implies changing the name of a file
b) Can be employed to use an existing file as input file for a
program
c) Implies connecting 2 programs through a pipe
d) None of the above
Answer: (b)
9. The colour of an object is largely determined by its diffuse
reflection coefficient. If Kd = (0.8, 0.4, 0) then what shall be the
colour of the object, if the light used is blue and magenta?
a) white and Red
b) red and Blue
c) Black and white
d) Black and red
Answer: (d)
Solution:
The colour of an object is largely determined by its diffuse
reflection coefficient (Kd). Kd is assigned a value between 0.0
and 1.0
0.0 - For dull surface that absorbs almost all light.

7


1.0 - for string surface that reflects almost all light for the value
(0.8, 0.4, 0) the colour of the object will be black and red
10. The given maximization assignment problem can be converted
into a minimization problem by
a) Subtracting each entry in a column from the maximum value

in that column.
b) Subtracting each entry in the table from the maximum value

in that table.
c) Adding each entry in a column from the maximum value in

that column.
d) adding maximum value of the table to each entry in the table
Answer: (b)
Solution:
The maximization assignment problem can be converted into
minimization problem by sub starting all the elements in the
given profit matrix from the highest element in the matrix
11. Consider the following C program.
#include
#include
Void printlength (char *s, char *t)
{
Unsigned int c = 0;
Int len = ((strlen (s) – strlen (t)) > c)
? strlen (s) : strlen(t);
Printf(“%\n”, len);

8


}
Void main()
{
Char *x= “abc”;
Char *y =”defgh”;
Printlength (x, y);
}
Recall that strlen is defined in string.h as returning a value of
type size_t, which is an unsigned int. The output of the program
is _____.
Answer: 3
Solution:
Strlen(s) - Strlen(t) will return an unsigned integer which is
greater than 'c' so 'len' variable holds value '3'. So output is 3.
12. A good software design must have
a) High module coupling, High module cohesion
b) High module coupling, Low module cohesion
c) Low module coupling, High module cohesion
d) Low module coupling, Low module cohesion
Answer:(c)
Solution:
Cohension is a measure that defines the degree of intra-
dependability within elements of a module.

9


Couplings a measured that define the line of inter-dependability
among module of a program it tells at what lines in the modules
interface and interract with each other.
All good software have low coupling and high cohension
13. The initial basic feasible solution of the following
transportation problem:

The image part with relationship ID rId8 was not found in the file.

is give as

The image part with relationship ID rId8 was not found in the file.

Then the minimum cost is
a) 76
b) 78
c) 80
d) 82
Answer: (a)
14. The advantage of is that it can reference memory without
paying the price of having a full memory address in the
instruction.
a) Direct addressing
b) Indexed addressing

10


c) Register addressing
d) Register Indirect addressing
Answer: (d)
Solution:
Register indirect addressing mode: in this mode, the operand
being specified comes from memory or goes to memory, but is
address is not hardware into the instruction as in direct
addressing instead, the address is used in this manner, it is called
a pointer A big advantage of register of register indirect
addressing is that it can reference memory without playing the
price of having a full memory address in the instruction
15. In the context of compiler design “reduction in strength" refers
to
a) code optimization obtained by the use of cheaper machine

instructions
b) reduction in accuracy of the output
c) reduction in the range of values of input variables
d) reduction in efficiency of the program
Answer: (a)
Solution:
Strength reduction is a compiler optimization where expensive
operations are replaced with equivalent but less expensive
operations.

11


16. The time complexity built a heap of n elements is
a) O (1)
b) O (log n)
c) O(n)
d) O (n log n)
Answer: (c)
Solution:
We can have built a heap in linear time first create a binary tree
(insert each element into a node of the tree) and then apply
heapify algorithms from the least internal node in the tree to
root. These algorithms are knowing is as built- up which take Θ
(n) time

17. Using data p = 3, g = 11, n = pq, d = 7 in RSA algorithm find
the cipher text of the given plain text SUZANNE
a) BUTAEEZ
b) SUZANNE
c) XYZABCD
d) ABCDXYZ
Answer:(a)
Solution:
Given, p = 3, q = 11, d = 7, n = 33
Therefore, using RSA algorithms
(n) = (p ‒ 1) (q ‒ 1) = 2*10 = 20 and ed = 1mod(n)
G(1)(e, (n)) =1
So, e = 3, d = 7

12


Now, a = 1, b = 2, c = 3,…z = 26
Given SUZANNE = 19, 21, 26, 1, 14, 14, 5
Since, m’ = me mod N
So,
⟹193 mod 33 = 28(i.e., 28 ‒26 = 2)
=2⟹b
⟹213 mod 33 = 21 ⟹ u
⟹263 mod 33 = 20 ⟹ T
⟹13 mod 33 = 1 ⟹A
⟹143 mod 33 = 5 ⟹ E
⟹53 mod 33 = 26 ⟹ Z
Therefore cipher text is BUTAEEZ
18. Consider a disk pack with 16 surfaces, 128 tracks per surface
and 256 sectors per track. 512 bytes of data are stored in a bit
serial manner in a sector. The capacity of the disk pack and the
number of bits required to specify a particular sector in the disk
are respectively:
a) 256 Mbytes, 19 bits
b) 256 Mbytes, 28 bits
c) 512 Mbytes, 20bits
d) 64 Gbyte, 28 bits
Answer: (a)
Solution:
Disk capacity = 16 × 128 × 256 × 512B = 256MB
Sector address = 4 + 7 + 8 = 19 bits

13


19. All the classes necessary for window programming
are available in the module:
a) win.txt
b) win. main
c) win. std
d) MFC
Answer: (a)
Solution:
All the classes necessary for windows programming are
available in the module win. Text

20. Consider the following statements with respect to user-level
threads and kernel supported threads.
(i) Context switch is faster with kernel supported threads
(ii) For user-level threads, a system call can block the entire
process
(iii) Kernel-supported threads can be scheduled independently
(iv) Use - level threads are transparent to the kernel
Which of the above statements are true?
a) (ii), (iii) & (iv) only
b) (ii) & (iii) only
c) (i) & (iii) only
d) (i) & (ii) only
Answer: (b)
Solution:
Consider the each statement

14


(i) Statement is false because there is no connection between
kernel supported threads and context switch.

(ii) Statement is true and it is drawback of user-level threads.
(iii) Statement is true because kernel supported threads having

own memory area and scheduled independently by the OS.
(iv) Statement is false because kernel is unaware about user

level threads and there is no kernel support to user-level
threads.
21. A virtual memory has a page size of 1 K words. There are
eight pages and four blocks. The associative memory page table
contains the following entries:

The image part with relationship ID rId8 was not found in the file.

Which of the following list of virtual addresses (in decimal) will
not cause any page fault if referenced by the CPU?
a) 1024, 3072, 4096, 6144
b) 1234,4012, 5000, 6200
c) 1020, 3012, 6120, 8100
d) 2021, 4050, 5112,7100
Answer: (c)
Solution:
Since, page size is 1 K – 1024 word, so

15


The image part with relationship ID rId8 was not found in the file.

Given pages 0, 2, 5, 7 are already in memory, so, for these will
not be page fault
a. Generated page numbers : 1, 3, 4, 6
b. Generated page numbers : 1, 3, 4, 6
c. Generated page numbers : 0, 2, 5, 7
d. Generated page numbers : 1, 3, 4, 6
Option (a), (b) and (d) will cause page default However for (c)
page fault will not be occur
22. The process state transition diagram in Figure is representative
of

The image part with relationship ID rId8 was not found in the file.

a) a batch operating System
b) an operating system with a preemptive scheduler
c) an operating system with a non-preemptive scheduler
d) a uni-programmed operating System.
Answer: (b)

16


Solution:

Process going from running to ready state is always pre-

emptive.

23. if h is chosen from a universal collection of hash functions and

is used to hash n keys into a table of size m, where n < m, the

expected number of collisions involving a particular key K is

a) less than 1

b) less than lg n

c) greater than 1

d) greater than lg n

Answer: (a)

Solution:

Theorm: if h is choose from a universal class of hash function

and is used to hash n keys into a table of size m, where n ≤ m,

the expected number of collisions involving a particular key x is

less than 1

Proof:

For each pair of keys x, y let lxy the indirect or that y and x
collide

E(lxy)
Let Cn be total number of collision involving key x.

E(cx) =E�∑ ( )� = ∑ ( ( )) = ( −1)

≠ ≠

Since, n ≤ m, we have E(cx)
int main)
{
int sum =0, maxsum = 0, i, n = 6;
Int a() = {2, ‒2, ‒1, 3, 4, 2};
for(i = 0; i < n; i++)
{
if (i == 0||a[i] )? A[i]:0;
}
else sum + = a[i];
if(sum > maxsum) maxsum = sum;
printf(“%d\n”, maxsum);
}
}
{
What is the value printed out when this program is executed?

21


a) 9
b) 8
c) 7
d) 6
Answer: (c)
Solution:
Output will be 3 + 4 = 7 {for || if 1st argument is true 2nd
argument will not be calculated, and if 1st argument is false, 2nd
argument will be calculated}
30. Cached and interleaved memories are ways of speeding up
memory access between CPU's and slower RAM. Which
memory models are best suited (i.e. improves the performance
most) for which programs?
i. Cache memory is best suited for small loops
ii. Interleaved memory is best suited for large lops
iii. Interleaved memory is best suited for large sequential code.
iv. Cached memory is best suited for large sequential code
a) (i) and (ii) are true.
b) (i) and (iii) are true.
c) (iv) and (ii) are true.
d) (iv) and (iii) are true.
Answer: (b)
Solution:
The cache is simile, faster memory which stores copies of the
data from frequently used in main memory location

22


Interleaved memory is design made to compensate for the
relatively slow speed of dynamic random access memory
(DRAM) or core memory by spreading memory address evenly
across memory banks.

23


Data Loading...