C3-R3: OPERATING SYSTEMS Jan 2006

September 28, 2008

1.

a) Does a process incur more execution overhead compared to a thread? Justify your answer.

b) Distinguish between multiprocessing and multiprogramming.

c) What are the “special files” in Unix?

d) What is the main difference between worm and virus?

e) State the practical limitations of implementing non-preemptive SJF algorithm.

f) What is the difference between a long-term scheduler and a short-term scheduler?

g) How can a single copy of a text editor be used to serve multiple users in a time-sharing system?

(7×4)

2.

a) What is TLB? Find out the effective memory-access time with an 80% hit ratio and the following access times:

TLB access time: 20ns; MM access time: 100ns

b) Describe the public-key encryption scheme and mention how is it advantageous to the data-encryption standard.

(8+10)

3. Consider the following page reference during a given time interval for a memory consisting of 5 frames: y,c,z,c,d,a,y,a,e,a,y,f,d,e. Using the i) FIFO replacement strategy and ii) the LRU replacement strategy compare the results. Repeat both FIFO and LRU replacement strategies for memory with 3 frames and same page reference pattern. Comment on the findings and draw a conclusion justifying the adoption of a particular replacement strategy.

(18)

4.

a) What does ‘init’ do? What happens to the parent process id of a child when the parent terminates before its child? When does a child become ‘zombie’?

b) With reference to Unix when do the following situations occur?

i) Single process table entry contains pointers to the same file table entry.

ii) Different file table entries point to the same i-node table entry.

iii) Shell ‘forks’ a copy of itself and ‘waits’ for the child to terminate.

c) How does CPU time-slice affect the Round-Robin algorithm?

(8+6+4)

5.

a) Show and explain an implementation of the classical producer-consumer (producer produces an item, keeps it in a buffer from where the consumer is picking it up) problem using semaphore.


b) What is dynamic loading? Mention its advantage. How is dynamic linking performed? Mention any disadvantage that you can think of for both the schemes.

(10+8)

6.

a) What is meant by a domain and the rights on it? Describe a Capability list and ways of protecting it from user tampering.

b) Rewrite the following code introducing code parallelism wherever applicable:

For i = 1 to k

a(i) = b(i) + c(i)

For j = 1 to k

d(j) = x(j) – y(j)

For p = 1 to k

x(p) = y(p) + b(p)

read(m,n,o,r)

q = m*n + r/o

write(q)

c) Using preemptive SJF(shortest-job-first) algorithm draw the Gannt chart and calculate the average waiting time for the following processes:

Process Arrival time Burst time

P0 0 6

P1 2 4

P2 3 10

P3 7 9

(9+4+5)

7.

a) Where and how “bit vector/table” is used? What are the advantages and disadvantages of the technique?

b) What is deadlock? How can deadlock be prevented by not allowing “Hold and Wait” ? Is it a feasible policy?

c) How can synchronization be achieved when two processes communicate by message passing?

d) Provide a programming example of multithreading giving improved performance over a single-threaded solution.

(5+5+5+3)


C2-R3: DATA STRUCTURE THROUGH ‘C’ LANGUAGE Jan 2006

September 28, 2008

1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)

1.1. Adjacency matrix for a digraph is

A) Unit Matrix

B) Symmetric Matrix

C) Asymmetric matrix

D) none of the above

1.2. Time complexity of insertion sort algorithm in the best case is

A) O(n)

B) O(n log2 n)

C) O(n2)

D) none of the above

1.3. The prefix expression for the infix expression a * ( b + c ) /e – f is

A) /* a + bc – ef

B) -/ * + abc ef

C) - / * a + bcef

D) none of the above

1.4. In linked list representation, a node contains at least

A) node address field, data field

B) node number, data field

C) next address field, information field

D) none of the above


1.5. Number of nods in a complete binary tree of depth k is

A) 2k

B) 2k

C) 2k-1

D) none of the above

1.6. The smallest number of keys that will force a B-Tree of order 3 to have a height 3 is:

A) 12

B) 10

C) 7

D) none of the above

1.7. Given two sorted lists of size “m” and “n” respectively, the number of comparisons needed in the worst case by the merge sort will be:

A) m*n

B) max(m,n)

C) min(m.n)

D) m + n – 1

1.8 Any string of bits of length n represents a unique non-negative integer between

A) 0 and 2n-1 -1

B) 0 and 2n-1

C) 1 and 2n-1

D) none of the above

1.9 Which of the following expressions accesses the (i,j)th entry of a m ´ n matrix stored in a column major form ?

A) m * ( i –1 ) + j

B) m * ( j –1 ) + i

C) m * ( n – j ) + i

D) m * ( m – i ) + j

1.10 The following sequence of operation is performed on a stack

push(1), push (2), pop, push(1), push(2), pop, pop, pop, push(2), pop.

The sequences of popped out values are

A) 2, 2, 1, 2, 1

B) 2, 2, 1, 1, 2

C) 2, 1, 2, 2, 1

D) 2, 1, 2, 2, 2


2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and ENTER in the “tear-off” sheet attached to the question paper, following instructions therein. (1 x 10)

2.1 All primitive recursive functions can be solved iteratively.

2.2 Breadth – first search algorithm can only be used for undirected graph.

2.3 De-referencing operator * has the same effect when it is applied to a pointer or to a structure.

2.4 Binary search performs efficiently on a linked list.

2.5 A symbol table can be constructed using binary tree.

2.6 A pre-order and post-order traversal sequence uniquely defines a tree.

2.7 If an undirected graph is of “n” vertices and “e” edges then the sum of degrees of all vertices is 2e.

2.8 The adjacency matrix corresponding to a graph consisting of “n” nodes but no edges is a unit matrix.

2.9 Recursion cannot be removed without using a stack.

2.10 Pointers are used for dynamically allocated memory.

3. Match words and phrases in column X with the closest related meaning/ word(s)/phrase(s) in column Y. Enter your selection in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)

X

Y

3.1

Order notation

A.

Stack

3.2

Pattern matching

B.

Dynamic storage allocation

3.3

Dynamic data structure

C.

Two’s compliment

3.4

Height Balanced Trees

D.

Primitive data type

3.5

Data structure for back tracking

E.

Finite automata

3.6

Circular list with “head” pointing to the last node

F.

Adjacency list

3.7

Suitable data structure for efficiently computing adjacent vartices of a given vertex

G.

Adjacency matrix

3.8

Partition exchange sort

H.

AVL Trees

3.9

Stable sorting Algorithm

I.

Adjacency multi list

3.10

Unique representation for zero

J.

Queue

K.

Tree

L.

Breadth – first

M.

Depth – first

N.

Quick sort

O.

merge sort

P.

Complexity measurement


4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in the list below. Enter your choice in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)

A.

circular queue

B.

stack

C.

simple queue

D.

band

E.

sparse

F.

many-to-many

G.

one-to-many

H.

depth-first-search

I.

breadth-first search

J.

log2 n

K.

n log2 n

L.

E / (n + 1)

M.

Insertion

N.

Log2 n + 1

O.

recursive

P.

Compaction

Q.

N

4.1 Matrices in which non-zero entries tend to cluster around the middle of each row are called __________ matrix.

4.2 A graph represents ________ relationship between nodes.

4.3 ___________ can be used to find the shortest distance between given two nodes in a graph.

4.4 Time complexity of inserting an element to a heap of “n” elements is of the order of _________.

4.5 If “E” is the total external length of a binary tree with “n” nodes then average number of comparisons for unsuccessful search is ________________.

4.6 _________ data structure may give overflow error, even though the current number of elements in it is less than its size.

4.7 Conversion of infix arithmetic expression to prefix expression requires the use of __________.

4.8 The minimum number of edges in a connected cyclic graph of “n” vertices is_________.

4.9 Linked list is preferred over an array for _________ operation.

4.10 Recursion often provides elegant solution to programming task but _______ function chew up a lot of memory.


PART TWO

(Answer any FOUR questions)

5.

a) What are the limitations of array data structure?

b) Show with the help of an example, how the above limitations can be avoided by “linked” representation of lists?

c) Show the representation of linked lists using arrays.

d) What do you mean by linear list and generalized list?

(4+4+4+3)

6.

a) Write a “C” function to copy one stack to another assuming the stack is implemented using array.

b) Write an algorithm to evaluate Postfix expression with the help of a stack.

(8+7)

7.

a) Write a “C” function to implement the Knuth Mooris Pratt algorithm for string searching.

b) A function A(m,n) is defined as follows.

A(m,n) = n + 1, if m = 0

= A ( m – 1, 1), if n = 0

= A(m – 1, A(m, n-1)), otherwise

write a recursive “C” function to compute A(m,n)

(8+7)

8.

a) Prove that the maximum number of nodes in a binary tree of height “k” is 2k+1-1.

b) Consider the following binary tree

Indicate the output in the following cases: -

i) When the tree is traversed in an “inorder” fashion.

ii) When the tree is traversed in an “preorder” fashion.

iii) When the tree is traversed in an “Postorder” fashion.

(6+[3×3])


9.

a) Show with the help of an example that the simple selection sort is not data sensitive.

b) Find the time complexity of the simple selection sort.

c) Write a recursive “C” function to implement binary search.

(6+3+6)

10.

a) Write a “C” function to compute the in-degree and out-degree of a vertex of a directed graph when the graph is represented by an adjacency list.

b) What is a spanning tree? What do you mean by minimal spanning tree?

(9+[3+3])


C1-R3: COMPUTER ORGANIZATION Jan 2006

September 28, 2008

1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)

1.1 ‘Cycle Stealing’ is associated with

A) Data transfer among registers

B) DMA

C) Pipelining

D) Microprogramming

1.2 The largest integer that can be represented in signed-2’s complement representation using n bits is

A) 2n-1

B) 2n

C) 2n-1 – 1

D) 2n – 1

1.3 Using an additional NOT gate, a JK flip-flop can be converted into

A) T flip-flop

B) RS flip-flop

C) Master Slave flip-flop

D) D flip-flop

1.4 A microprocessor has a data bus with 64 lines and an address bus with 32 lines. The maximum number of bits that can be stored in this memory is

A) 32 x 232

B) 32 x 264

C) 64 x 232

D) 64 x 264


1.5 The expression ‘delayed load’ is used in context of

A) Processor-printer communication

B) Memory-monitor communication

C) Pipelining

D) Computer Arithmetic

1.6 Break points are used for

A) stopping a program at a desired place

B) manipulating the stack

C) executing each instruction individually

D) calling a subroutine

1.7 A truth table of n variables has _______ minterms.

A) n2

B) (n – 1)2

C) 2n

D) 2n -1

1.8 Which of the following shift operations divide a signed binary number by 2?

A) logical left shift

B) logical right shift

C) arithmetic left shift

D) arithmetic right shift

1.9 The condition to detect overflow during the addition of two binary numbers is

A) Cn XOR Cn-1

B) Cn NOR Cn-1

C) Cn OR Cn-1

D) Cn AND Cn-1

where Ci is the carry out of the ith significant bit.

1.10 Dual of a + b • c is

A) (a + b) • (a + c)

B) a • ( b + c)

C) a′ • ( b′ + c′)

D) (a′ + b′) • (a′ + c′)


2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and ENTER in the “tear-off” sheet attached to the question paper, following instructions therein. (1 x 10)

2.1 A high-level language program is converted to the executable form by the compiler itself.

2.2 A negative number has same representation in signed-magnitude, signed 1’s complement and signed 2’s complement forms.

2.3 In Booth’s algorithm, numbers in 2’s complement are multiplied along with their sign bits.

2.4 In virtual memory management, physical addresses are mapped to logical addresses.

2.5 x + y • z = (x + y) • (x + z) is true in Boolean algebra.

2.6 An instruction pipeline operates on a stream of instructions by overlapping the phases of instruction cycle.

2.7 A race condition is not possible in combinational circuits.

2.8 Zero cannot be normalized.

2.9 In content addressable memories all the words in the memory are compared simultaneously.

2.10 Retrieving instruction from the memory is the instruction cycle.

3. Match words and phrases in column X with the closest related meaning/ word(s)/phrase(s) in column Y. Enter your selection in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)

X

Y

3.1

Single Output Line

A.

von Neumann

3.2

Self complementing code

B.

Programmed Control Transfer

3.3

Indirect Address

C.

BSA

3.4

Stored program concept

D.

Multiplexer

3.5

CPU checking I/O flag

E.

2421

3.6

Subroutine call

F.

Odd function

3.7

Bracket less expression

G.

M[AR]

3.8

Simple instructions computer

H.

BCD

3.9

Zero address instructions

I.

Decoder

3.10

Multiple variable exclusive –OR

J.

Interrupt driven transfer

K.

M[M[AR]]

L.

Prefix

M.

BUN

N.

RISC

O.

ISZ

P.

Stack Organized Computer

Q.

Infix

R.

Even function

S.

CISC


4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in the list below. Enter your choice in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)

A.

AR

B.

First

C.

Adders

D.

Two’s Complement

E.

Sequential

F.

Serial

G.

Stored Program

H.

Virtual

I.

IR

J.

Combinational

K.

Subtractor

L.

Second

M.

Memory mapped

N.

One’s Complement

O.

Primary

P.

PC

Q.

Locality of reference

R.

Parallel

S.

ROM

T.

Isolated

U.

Magnetic tape

4.1 In two pass assembler, the address symbol table is generated in ________ pass.

4.2 An adder-subtractor single unit can be designed using full ________ and XOR gates.

4.3 A(n) ________ circuit can be described using truth table.

4.4 The carry out of the most significant bit is discarded during addition of two numbers in ________ form.

4.5 CPU register storing the address of next instruction to be executed is ________.

4.6 Having same read/write instructions for memory and I/O addresses is ________ I/O concept.

4.7 High hit ratio of cache memory is possible because of ________.

4.8 In ________ memory management, there is no need to have entire program in the primary memory.

4.9 In daisy-chaining priority method, all the devices that can request an interrupt are connected in ________.

4.10 A(n) ________ is a random access device.


PART TWO

(Answer any FOUR questions)

5.

a) A computer uses a memory unit with 128MB words of 64 bits each. A binary instruction code is stored in one word of memory. The instruction has four parts – some bits to differentiate between one of the four addressing modes supported by the system, an operation code, a register code part to specify one of the 512 registers and an address part. Draw the instruction word format and indicate the number of bits in each part.

b) What disadvantage of strobe control method of data transfer does the handshaking protocol overcome and how?

c) Briefly describe the working of DMA.

(4+5+6)

6. A minority function is desired to be generated in a combinatorial circuit. The output should be 1 when the number of 1’s is less than the number of 0’s in the input. The output should be 0 otherwise. Design a 4 input minority function. Draw the circuit also.

(15)

7.

a) Using a stack organized computer with zero-address operation instructions, write a program to evaluate the arithmetic statement

b) List at least three differences between a branch, a subroutine call and an interrupt.

(9+6)

8.

a) Write a subroutine in assembly language to compare two words for equality.

b) Consider a computer with virtual memory having four frames/block and eight pages. Through diagrams show how many page faults will occur with the reference string 0, 1, 7, 2, 3, 2, 7, 1, 0, 3 if page replacement policies used are (i) First In First Out (ii) Least Recently Used.

(7+8)

9.

a) Draw the flowchart to perform the subtraction of two numbers in signed magnitude form.

b) An instruction is stored at location 100 with its address field at location 101. The address field has the value 600. The value at location 600 is 400, at 900 is 300 and at 400 is 200. A processor register R1 contains the number 300. Evaluate the effective address and the operand if the addressing mode of instruction is

i) indirect

ii) direct

iii) immediate

iv) indexed with R1 as index register.

Also diagrammatically show the contents of the part of the memory according to the data given above.

(9+6)