## GATE 2002

Question 1 |

The rank of the matrix is

4 | |

2 | |

1 | |

0 |

Question 2 |

The trapezoidal rule for integration give exact result when the integrand is a polynomial of degree:

0 but not 1 | |

1 but not 0 | |

0 or 1 | |

2 |

Question 3 |

The solution to the recurrence equation T(2^{k}) = 3 T(2^{k-1}) + 1, T(1)=1, is:

^{k}) = 3T(2

^{k-1}) + 1

T(1)=1

k=0; T(1) = 3T(2

^{-1})+1

k=1; T(2) = 3T(2

^{0})+1 = 3(1)+1 = 4

k=2; T(4) = 3T(2

^{1})+1 = 3(4)+1 = 13

k=3; T(8) = 3T(2

^{2})+1 = 3(13)+1 = 40

k=4; T(16) = 3T(2

^{3})+1 = 3(40)+1 = 121

Simply go through the options.

Option B:

k=4 ⇒ (3

^{4+1}-1)/2

⇒ (243-1)/2

⇒ 121

Question 4 |

The minimum number of colours required to colour the vertices of a cycle with η nodes in such a way that no two adjacent nodes have the same colour is

2 | |

3 | |

4 | |

n - 2[n/2] + 2 |

Question 5 |

log n | |

n/2 | |

(log _{2})^{n} - 1 | |

n |

Question 6 |

Which of the following is true?

The set of all rational negative numbers forms a group under multiplication. | |

The set of all non-singular matrices forms a group under multiplication. | |

The set of all matrices forms a group under multiplication. | |

Both B and C are true. |

a. Closure: result of a * b must be in group G.

b. There must be an identity element i.e. e * a = a * e = a

c. There must be an inverse element b for every element a such that a * b = b * a = e

d. Associativity i.e. (a * b) * c = a * (b * c)

Rational negative numbers don't form a group under multiplication, as multiplying two negative numbers results into a positive number, so closure property is not satisfied.

Set of non-singular matrices forms a group under multiplication.

The set of all matrices doesn't form a group under multiplication, since there may not be an inverse for a matrix (in particular, for singular matrices).

Question 7 |

The language accepted by a Pushdown Automaton in which the stack is limited to 10 items is best described as

Context free | |

Regular | |

Deterministic Context free | |

Recursive |

Question 8 |

“If X then Y unless Z” is represented by which of the following formulas in prepositional logic? (“¬“, is negation, “∧” is conjunction, and “→” is implication)

(X∧¬Z)→Y | |

(X∧Y)→¬Z | |

X→(Y∧¬Z) | |

(X→Y)∧¬Z |

⇒ Z ∨ ¬X ∨ Y

⇒ ¬X ∨ Z ∨ Y

Option A:

(X ∧ ¬Z) → Y = ¬(X ∧ ¬Z ) ∨ Y = ¬X ∨ Z ∨ Y Hence, option (A) is correct.

Question 9 |

A device employing INTR line for device interrupt puts the CALL instruction on the data bus while

HOLD is active | |

READY is active | |

None of the above |

Question 10 |

In 8085 which of the following modifies the program counter?

Only PCHL instruction | |

Only ADD instructions | |

Only JMP and CALL instructions | |

All instructions |

ADD Instruction: increments the program counter.

JMP & CALL: Change the values of PC.

Question 11 |

In serial data transmission, every byte of data is padded with a ‘0’ in the beginning and one or two ‘1’s at the end of byte because

Receiver is to be synchronized for byte reception | |

Receiver recovers lost ‘0’s and ‘1’s from these padded bits | |

Padded bits are useful in parity computation | |

None of the above |

Question 12 |

Minimum sum of product expression for f(w,x,y,z) shown in Karnaugh-map below is

xz+y'z | |

xz'+zx' | |

x'y+zx' | |

None of the above |

⇒ xz' + zx'

Question 13 |

Which of the following is not a form of memory?

instruction cache | |

instruction register | |

instruction opcode | |

translation look-a-side buffer |

Question 14 |

The decimal value 0.25

is equivalent to the binary value 0.1 | |

is equivalent to the binary value 0.01 | |

is equivalent to the binary value 0.00111… | |

cannot be represented precisely in binary |

__:__

**1**^{st}Multiplication iterationMultiply 0.25 by 2.

0.25×2 = 0.50 (product)

Fractional part = 0.50

Carry = 0

__:__

**2**^{nd}Multiplication iterationMultiply 0.50 by 2.

0.50×2 = 1.00 (product)

Fractional part = 0.00

Carry = 1

The fractional part in the 2

^{nd}iteration becomes zero and so we stop the multiplication iteration.

Carry from 1

^{st}multiplication iteration becomes MSB and carry from 2

^{nd}iteration becomes LSB. So the result is 0.01.

Question 15 |

The 2’s complement representation of the decimal value -15 is

1111 | |

11111 | |

111111 | |

10001 |

-15 = 11111

1's complement = 10000

2's complement = 10001

Question 16 |

Sign extension is a step in

floating point multiplication | |

signed 16 bit integer addition | |

arithmetic left shift | |

converting a signed integer from one size to another |

Question 17 |

In the C language

At most one activation record exists between the current activation record and the activation record for the main | |

The number of activation records between the current activation record and the activation record for the main depends on the actual function calling sequence. | |

The visibility of global variables depends on the actual function calling sequence. | |

Recursion requires the activation record for the recursive function to be saved on a different stack before the recursive fraction can be called. |

Question 18 |

The results returned by function under value-result and reference parameter passing conventions

Do not differ | |

Differ in the presence of loops | |

Differ in all cases | |

May differ in the presence of exception |

Question 19 |

Relation R with an associated set of functional dependencies, F, is decomposed into BCNF. The redundancy (arising out of functional dependencies) in the resulting set of relations is

Zero | |

More than zero but less than that of an equivalent 3NF decomposition | |

Proportional to the size of F ^{+} | |

Indetermine |

Question 20 |

With regard to the expressive power of the formal relational query languages, which of the following statements is true?

Relational algebra is more powerful than relational calculus. | |

Relational algebra has the same power as relational calculus. | |

Relational algebra has the same power as safe relational calculus. | |

None of the above. |

A query can be formulated in safe Relational Calculus if and only if it can be formulated in Relational Algebra.

Question 21 |

In 2’s complement addition, overflow

is flagged whenever there is carry from sign bit addition | |

cannot occur when a positive value is added to a negative value | |

is flagged when the carries from sign bit and previous bit match | |

None of the above |

Question 22 |

Which of the following scheduling algorithms is non-preemptive?

Round Robin | |

First-In First-Out | |

Multilevel Queue Scheduling | |

Multilevel Queue Scheduling with Feedback |

Question 23 |

The optimal page replacement algorithm will select the page that

Has not been used for the longest time in the past. | |

Will not be used for the longest time in the future. | |

Has been used least number of times. | |

Has been used most number of times. |

Question 24 |

In the absolute addressing mode

the operand is inside the instruction | |

the address of the operand is inside the instruction | |

the register containing the address of the operand is specified inside the instruction | |

the location of the operand is implicit |

The operand is inside the instruction --- absolute addressing.

The register containing the address of the operand is specified inside the instruction --- Register addressing.

The location of the operand is implicit --- Implicit addressing.

Question 25 |

Maximum number of edges in a n-node undirected graph without self loops is

n ^{2} | |

n(n-1)/2 | |

n-1 | |

(n+1)(n)/2 |

Question 26 |

Consider the following logic circuit whose inputs are functions f_{1}, f_{2}, f_{3} and output is f.

Given that

f_{1}(x,y,z) = ∑(0,1,3,5), f_{2}(x,y,z) = ∑(6,7) and f(x,y,z) = ∑(1,4,5),

f_{3} is:

Σ(1,4,5) | |

Σ(6,7) | |

Σ(0,1,3,5) | |

None of the above |

_{1}', (x,y,z) ⋅ f

_{2}'(x,y,z) + f

_{3}'(x,y,z))

= (Σ(0,1,3,5) ⋅ Σ(6,7) + Σ(1,4,5))

[Σ(0,1,3,5) and Σ(6,7) ⇒ No common terms]

= (Σ(1,4,5))

Question 27 |

Consider the following multiplexor where 10, 11, 12, 13 are four data input lines selected by two address line combinations A1A0 = 00,01,10,11 respectively and f is "the output of the multiplexor. EN is the enable input.

The function f(x,y,z) implemented by the above circuit is:

xyz' | |

xy+z | |

x+y | |

None of the above |

_{0}'10 + A'A

_{0}'11 + A'A

_{0}'12 + A

_{1}A

_{0}13) EN

F = (xyz' + xyz + y'zy + zy')z'

= (xyz' + xyz + y'z(y+1))z'

= (xyz' + xyz + y'z)z'

= (xy(z+z') + y'z)z'

= (xy + y'z)z'

= (xyz' + y'zz')

= (xyz')

Question 28 |

Let f(A,B) = A' + B. Simplified expression for function f(f(x + y, y)z) is:

x'+z | |

xyz | |

xy'+z | |

None of the above |

⇒ f(f((x+y), y), z)

⇒ f(((x+y)' + y), z)

⇒ f(((x'⋅y') + y), z)

⇒ f((x'⋅y') + y), z)

⇒ ((x'⋅y') + y)' + z

⇒ (x'⋅y')⋅y' + z

⇒ (x+y)⋅y' + z

⇒ (xy'+yy') + z

⇒ xy' + z

Question 29 |

What are the states of the Auxiliary Carry (AC) and Carry Flag (dCY) after executing the following 8085 program?

MVI H, 5DH MVI L, 6BH MOV A, H ADD L

AC = 0 and CY = 0 | |

AC = 1 and CY = 1 | |

AC = 1 and CY = 0 | |

AC = 0 and CY = 1 |

⇒ H = 0101 1101

MOV L, 6BH

⇒ L = 0110 1011

MOV A, H

A = 0101 1101

ADD L ⇒ A+L =

Here, AC=1; CY=0

Question 30 |

The Finite state machine described by the following state diagram with A as starting state, where an arc label is x/y and x stands for 1-bit input and y stands for 2- bit output

Outputs the sum of the present and the previous bits of the input. | |

Outputs 01 whenever the input sequence contains 11 | |

Outputs 00 whenever the input sequence contains 10 | |

None of the above |

(A,1) = (B, 01)

Previous input + Present input = 0+1 = 01

(B,0) = (A, 01)

Previous input + Present input = 1+0 = 01

(A,0) = (A, 00)

Previous input + Present input = 0+0 = 00

(A,1) = (B, 01)

Previous input + Present input = 0+1 = 01

(B,1) = (C, 10)

Previous input + Present input = 1+1 = 10

(C,1) = (C, 10)

Previous input + Present input = 1+1 = 10

Question 31 |

The performance of a pipelined processor suffers if

the pipeline stages have different delays | |

consecutive instructions are dependent on each other | |

the pipeline stages share hardware resources | |

All of the above |

If pipeline stages can’t have different delays, no dependency among consecutive instructions and sharing of hardware resources should not be there.

Question 32 |

Horizontal microprogramming

does not require use of signal decoders | |

results in larger sized microinstructions than vertical microprogramming | |

uses one bit for each control signal | |

all of the above |

Question 33 |

Consider the 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:

4040 | |

4050 | |

5040 | |

5050 |

= 0 + [40 * 100 * 1] + [50 * 1]

= 4000 + 50

= 4050

Question 34 |

The number of leaf nodes in a rooted tree of n nodes, with each node having 0 or 3 children is:

n/2 | |

(n-1)/3 | |

(n-1)/2 | |

(2n+1)/3 |

Question 35 |

Consider the following algorithm for searching for a given number x in an unsorted array A[1...n] having n distinct values:

1. Choose an i uniformly at random from 1...n; 2. If A[i]=x then Stop else Goto 1;

Assuming that x is present in A, what is the expected number of comparisons made by the algorithm before it terminates?

n | |

n-1 | |

2n | |

n/2 |

Question 36 |

The running time of the following algorithm

ProcedureA(n) If n <= 2 return(1) else return (A(⌈√n⌉));

is best described by:

O(n) | |

O(log n) | |

O(log log n) | |

O(1) |

Let n=2

^{m}

So, T(2

^{m}) = T(2

^{m/2})+1

We substitute T(2

^{m}) = S(m),

So now the equation becomes,

S(m) = S(m/2)+1

Now after applying master's theorem,

S(m) = O(log m)

T(n) = O(log log n)

Question 37 |

A weight-balanced tree is a binary tree in which for each node, the number of nodes in the left subtree is at least half and at most twice the number of nodes in the right subtree. The maximum possible height (number of nodes on the path from the root to the furthest leaf) of such a tree on n nodes is best described by which of the following?

log _{2}n | |

log _{4/3}n | |

log _{3}n | |

log _{3/2}n |

No. of nodes in left sub tree = 2 right sub tree

No. of nodes in left sub tree = (n-1/3)

No. of nodes in right sub tree = 2(n-1/3)

Height of the tree = log

_{3/2}n

Question 38 |

The smallest finite automaton which accepts the language {x|length of x is divisible by 3} has

2 states | |

3 states | |

4 states | |

5 states |

Minimum no. of states that we require is "3".

Question 39 |

Which of the following is true?

The complement of a recursive language is recursive. | |

The complement of a recursively enumerable language is recursively enumerable. | |

The complement of a recursive language is either recursive or recursively enumerable. | |

The complement of a context-free language is context-free. |

Question 40 |

The Newton-Raphson iteration X_{n+1} = (X_{n}/2) + 3/(2X_{n}) can be used to solve the equation

X ^{2} = 3 | |

X ^{3} = 3 | |

X ^{2} = 2 | |

X ^{3} = 2 |

X

_{n+1}= X

_{n+1}- f(X

_{n})/f'(X

_{n})

Option A:

X

^{2}= 3 ⇒ X

^{2}- 3 = 0

f(X) = X

^{2}- 3; f'(X) = 2X

X

_{n+1}= X

_{n}- (X

_{n}

^{2}-3)/(2X

_{n})

X

_{n+1}= (X

_{n}/2) + 3/(2X

_{n})

Question 41 |

Four fair coins are tossed simultaneously. The probability that at least one head and one tail turn up is

1/16 | |

1/8 | |

7/8 | |

15/16 |

^{2}= 16

Atleast one head = 1/16

Atleast one tail = 1/16

Probability of getting one head and one tail is = 1 - 1/16 - 1/16 = 16 - 1 - 1/16 = 14/16 = 7/8

Question 42 |

The binary relation S = ɸ (empty set) on set A = {1,2,3} is

Neither reflexive nor symmetric | |

Symmetric and reflexive | |

Transitive and reflexive | |

Transitive and symmetric |

A×S = {(ɸ,1), (ɸ,2), (ɸ,3), (1,ɸ), (2,ɸ), (3,ɸ)}

Not reflexive = (1,1), (2,2), (3,3) not there

Symmetric: if (a,b) is present then (b,a) is also present

Transitive: True; if (x,y), (y,z) then (z,x) is also present

Question 43 |

The C language is:

A context free language | |

A context sensitive language | |

A regular language | |

Parsable fully only by a Turing machine |

Question 44 |

To evaluate an expression without any embedded function calls

One stack is enough | |

Two stacks are needed | |

As many stacks as the height of the expression tree are needed | |

A Turning machine is needed in the general case |

Question 45 |

Dynamic linking can cause security concerns because

Security is dynamic | |

The path for searching dynamic libraries is not known till runtime | |

Linking is insecure | |

Cryptographic procedures are not available for dynamic linking |

Question 46 |

Which combination of the following features will suffice to characterize an OS as a multi-programmed OS?

- (a) More than one program may be loaded into main memory at the same time for execution.

(b) If a program waits for certain events such as I/O, another program is immediately scheduled for execution.

(c) If the execution of program terminates, another program is immediately scheduled for execution.

A | |

A and B | |

A and C | |

A, B and C |

Question 47 |

In the index allocation scheme of blocks to a file, the maximum possible size of the file depends on

the size of the blocks, and the size of the address of the blocks. | |

the number of blocks used for the index, and the size of the blocks. | |

the size of the blocks, the number of blocks used for the index, and the size of the address of the blocks. | |

None of the above |

No. of block addresses available for addressing one file(B) = No. of Maximum blocks we can use for the Index * No. of addressable blocks using one Index block(A)

Size of File = B * Size of Block

Question 48 |

A B^{+}- tree index is to be built on the *Name* attribute of the relation *STUDENT*. Assume that all student names are of length 8 bytes, disk blocks are of size 512 bytes, and index pointers are of size 4 bytes. Given this scenario, what would be the best choice of the degree (i.e. the number of pointers per node) of the B^{+}-tree?

16 | |

42 | |

43 | |

44 |

Then,

8(P-1) + 4P ≤ 512

12P - 8 ≤ 512

12P ≤ 520

P ≤ 43.33

P = 43

Question 49 |

Relation R is decomposed using a set of functional dependencies, F, and relation S is decomposed using another set of functional dependencies, G. One decomposition is definitely BCNF, the other is definitely 3NF, but it is not known which is which. To make a __quaranteed__ identification, which one of the following tests should be used on the decompositions? (Assume that the closures of F and G are available).

Dependency-preservation | |

Lossless-join | |

BCNF definition | |

3NF definition |

Question 50 |

From the following instance of a relation scheme R(A,B,C), we can conclude that:

A functionally determines B and B functionally determines C | |

A functionally determines B and B does not functionally determines C | |

B does not functionally determines C | |

A does not functionally determines B and B does not functionally determines C |

But for the given instance it can be seen that B does not functionally determines C, and it can be concluded for entire relation.

Question 51 |

Let A be a set of n(>0) elements. Let N_{r} be the number of binary relations on A and let N_{f} be the number of functions from A to A.

- (a) Give the expression for N

_{r}in terms of n.

(b) Give the expression for N

_{f}in terms of n.

(c) Which is larger for all possible n, N

_{r}or N

_{f}?

Theory Explanation is given below. |

Question 52 |

(a) S = {〈1,2〉,〈2,1〉} is binary relation on set A = {1,2,3}. Is it irreflexive? Add the minimum number of ordered pairs to S to make it an equivalence relation. Give the modified S.

(b) Let S = {a,b} and let (S) be the powerset of S. Consider the binary relation ‘⊆ (set inclusion)’ on (S). Draw the Hasse diagram corresponding to the lattice ((S),⊆).

Theory explanation is given below. |

The given relation S is irreflexive because no diagonal elements are present in the relation i.e., (x,x)∉R, ∀x∈A

If a relation is equivalence then it is

Reflexive

Symmetric

Transitive

Given relation S is not Reflexive & Transitive.

Reflexive closure on S = {(1,1), (2,2), (3,3), (1,2), (2,1)}

Transitive closure on S is does not change after performing reflexive closure on S.

S = {(1,1), (2,2), (3,3), (1,2), (2,1)}

(b) Given S = {a,b}

Powerset of S i.e., P(S) = {(ɸ), (a), (b), (a,b)}

__Hasse diagram__:

Question 53 |

(a) Obtain the eigen values of the matrix

(b) Determine whether each of the following is a tautology, a contradiction, or neither (“∨” is disjunction, “∧” is conjunction, “→” is implication, “¬” in negation, and “↔” is biconditional (if and only if).

(i) A ↔ (A ∨ A) (ii) (A ∨ B) → B (iii) A ∧(¬(A ∨ B)

Theory Explanation is given below. |

Eigen value of upper/ lower triangular matrix are the diagonal elements of matrix.

(b) (i) A↔(A∨A): This can tells that if A then (A or A)and if (A or A) then A. It represents result as a tautology.

(ii) (A∨B)→B: This is neither tautology nor contradiction.

(iii) A∧(¬(A∨B)): here when A is true then (¬(A∨B)) is false, then it results contradiction.

Question 54 |

Draw all binary trees having exactly three nodes labeled A, B and C on which Preorder traversal gives the sequence C, B, A.

Theory Explanation is given below. |

Total 5 binary trees are possible with the preorder C, B, A.

Question 55 |

(a) Express the function f(x,y,z) = xy' + yz' with only one complement operation and one or more AND/OR operations. Draw the logic circuit implementing the expression obtained, using a single NOT gate and one or more AND/OR gates.

(b) Transform the following logic circuit (without expressing its switching function) into an equivalent logic circuit that employs only 6 NAND gates each with 2-inputs.

Theory Explanation is given below. |

(A) f(x,y,z) = xy' +yz'

It is not possible to express only one NOT gate.

Question 56 |

Consider the following circuit. A = a_{2}a_{1}a_{0} and B = b_{2}b_{1}b_{0} are three bit binary numbers input to the circuit. The output is Z = z_{3}z_{2}z_{1}z_{0}. R_{0}, R_{1} and R_{2} are registers with loading clock shown. The registers are loaded with their input data with the falling edge of a clock pulse (signal CLOCK shown) and appears as shown. The bits of input number A, B and the full adders are as shown in the circuit. Assume Clock period is greater than the settling time of all circuits.

(a) For 8 clocks pulses on the CLOCK terminal and the inputs A, B as shown, obtain the output Z (sequence of 4-bit values of Z). Assume initial contents of R_{0}, R_{1} and R_{2} as all zeros.

A= 110 011 111 101 000 000 000 000 B= 101 101 011 110 000 000 000 000 Clock No 1 2 3 4 5 6 7 8

(b) What does the circuit implement?

Theory Explanation is given below. |

Question 57 |

Consider the following 32-bit floating-point representation scheme as shown in the formal below. A value is specified by 3 fields, a one bit sign field (with 0 for positive and 1 for negative values), a 24 bit fraction field (with the binary point being at the left end of the fraction bits), and a 7 bit exponent field (in excess-64 signed integer representation, with 16 being the base of exponentiation). The sign bit is the most significant bit.

(a) It is required to represent the decimal value –7.5 as a normalized floating point number in the given format. Derive the values of the various fields. Express your final answer in the hexadecimal.

(b) What is the largest values that can be represented using this format? Express your answer as the nearest power of 10.

Theory of Explanation is given below. |

Question 58 |

In a C program, an array is declared as float A[2048]. Each array element is 4 Bytes in size, and the starting address of the array is 0×00000000. This program is run on a computer that has a direct mapped data cache of size 8 Kbytes, with block (line) size of 16 Bytes.

(a) Which elements of the array conflict with element A[0] in the data cache? Justify your answer briefly.

(b) If the program accesses the elements of this array one by one in reverse order i.e., starting with the last element and ending with the first element, how many data cache misses would occur? Justify your answer briefly. Assume that the data cache is initially empty and that no other data or instruction accesses are to be considered.

Theory Explanation is given below. |

Question 59 |

The following recursive function in C is a solution to the Towers of Hanoi problem.

Void move (int n, char A, char B, char C) { if (…………………………………) { move (…………………………………); printf(“Move disk %d from pole %c to pole %c\n”, n,A,C); move (………………………………….);

Fill in the dotted parts of the solution.

Theory Explanation is given below. |

move disk from source to dest //Step-2

move (disk-1, aux, dest, source) //Step-3

Recurrence: 2T(n - 1) + 1

T(n) = 2T (n - 1) + 1

= 2[2T(n - 2) + 1] + 1

= 2

^{2}T(n - 2) + 3

⁞

2

^{k}T(n - k) + (2

^{k}- 1)

= 2

^{n-1}T(1) + (2

^{n-1}- 1)

= 2

^{n-1}+ 2

^{n-1}- 1

= 2

^{n}- 1

≅ O(2

^{n})

void move (int n, char A, char B, char C) {

if (n>0)

move(n-1, A, C, B);

printf("Move disk%d from pole%c to pole%c\n", n,A,C);

move(n-1, B, A, C);

}

}

Question 60 |

Fill in the blanks in the following template of an algorithm to compute all pairs shortest path lengths in a directed graph G with n*n adjacency matrix A. A[i,j]equals if there is an edge in G from i to j, and 0 otherwise. Your aim in filling in the blanks is to ensure that the algorithm is correct.

INITIALIZATION: For i = 1 … n {For j = 1 … n { if A[i,j]=0 then P[i,j] = _______ else P[i,j] =____;} ALGORITHM: For i = 1 …n { For j = 1 …n {For k = 1 …n {P[__,___]=min{_______,_______};} } }

- (a) Copy the complete line containing the blanks in the Initialization step and fill in the blanks.

(b) Copy the complete line containing the blanks in the Algorithm step and fill in the blanks.

(c) Fill in the blank: The running time of the Algorithm is O(____).

Theory Explanation is given below. |

{ for j = 1 ... n

{ if a[i,j] = 0 then P[i,j] =

__infinite__;

else P[i,j] =

__a[i,j]__;

}

}

(b) ALGORITHM: For i = 1 ... n

{ for j = 1 ... n;

{ for k = 1 ... n

{

P[

__i__,

__j__] = min (

__P[i,j]__,

__P[i,k]+P[k,j]__)

}

}

}

(c) Actual graph:

MST: There are 2 possible MST's

Question 61 |

(a) In how many ways can a given positive integer n ≥ 2 be expressed as the sum of 2 positive integers (which are not necessarily distinct). For example, for n = 3, the number of ways is 2, i.e., 1+2, 2+1. Give only the answer without any explanation.

(b) In how many ways can a given positive integer n ≥ 3 be expressed as the sum of 3 positive integers (which are not necessarily distinct). For example, for n = 4, the number of ways is 3, i.e., 1+2+1, 2+1+1. Give only the answer without any explanation.

(c) In how many ways can a given positive integer n ≥ k be expressed as the sum of k positive integers (which are not necessarily distinct)? Give only the answer without explanation.

Theory Explanation is given below. |

Question 62 |

The aim of the following question is to prove that the language {M| M is the code of a Turing Machine which, irrespective of the input, halts and outputs a 1}, is undecidable. This is to be done by reducing form the language {M',x| M' halts on x}, which is known to be undecidable. In parts (a) and (b) describe the 2 main steps in the construction of M. in part (c) describe the key property which relates the behaviour of M on its input w to the behaviour of M′ on x.

- (a) On input w, what is the first step that M must make?

(b) On input w, based on the outcome of the first step, what is the second step that M must make?

(c) What key property relates the behaviour of M on w to the behaviour of M′ on x?

Theory Explanation is given below. |

Question 63 |

A university placement center maintains a relational database of companies that interview students on campus and make job offers to those successful in the interview. The schema of the database is given below:

COMPANY (cname, clocation) STUDENT (scrollno, sname, sdegree) INTERVIEW (cname, srollno, idate) OFFER (cname,srollno, osalary)

The COMPANY relation gives the name and location of the company. The STUDENT relation gives the student’s roll number, name and the degree program for which the student is registered in the university. The INTERVIEW relation gives the date on which a students is interviewed by a company. The OFFER relation gives the salary offered to a student who is successful in a company’s interview. The key for each relation is indicated by the underlined attributes.

(a) Write **relational algebra** expressions (using only the operator ⨝,σ,π,∪,−) for the following queries:

- (i) List the rollnumbers and names of those students who attended at least one interview but did not receive any job offer.

(ii) List the rollnumbers and names of students who went for interviews and received job offers from every company with which they interviewed.

(b) Write an SQL query to list, for each degree program in which more than five students were offered jobs, the name of the degree and the average offered salary of students in this degree program.

Theory Explanation is given below. |

Question 64 |

For relation **R = (L, M, N , O, P),** the following dependencies hold:

M → O NO → P P → L and L → MN

R is decomposed into **R _{1} = (L, M, N , P)** and

**R**.

_{2}= (M, O)- (a) Is the above decomposition a lossless-join decomposition? Explain.

(b) Is the above decomposition dependency-preserving? If not, list all the dependencies that are not preserved.

(c) What is the highest normal form satisfied by the above decomposition?

Theory Explanation is given below. |

Question 65 |

(a) The following table refers to search times for a key in B-trees and B^{+}-trees.

A successful search means that the key exists in the database and unsuccessful means that it is not present in the database. Each of the entries X_{1}, X_{2}, X_{3} and X_{4} can have a value of either Constant or Variable. Constant means that the search time is the same, independent of the specific key value, where Variable means that it is dependent on the specific key value chosen for the search.

Give the correct values for the entries X_{1}, X_{2}, X_{3} and X_{4} (for example X_{1} = Constant, X_{2} = Constant, X_{3} = Constant, X_{4} = Constant).

(b) Relation R(A,B) has the following view defined on it:

CREATE VIEW V AS (SELECT R1.A, R2.B FROM R AS R1, R AS R2 WHERE R1.B = R2.A)

(i) The current contents of relation R are shown below. What are the contents of the view V?

(ii) The tuples (2,11) and (11,6) are now inserted into R. What are the additional tuples that are inserted in V?

Theory Explanation is given below. |

Question 66 |

(a) Draw the process state transition diagram of an OS in which (i) each process is in one of the five states: created, ready, running, blocked (i.e. sleep or wait), or terminated, and (ii) only non-preemptive scheduling is used by the OS. Label the transitions appropriately.

(b) The functionality of atomic TEST-AND-SET assembly language instruction is given by the following C function.

int TEST-AND-SET (int *x) { int y; A1:y=*x; A2:*x=1; A3:return y; }

(i) Complete the following C functions for implementing code for entering and leaving critical sections based on the above TEST-AND-SET instruction.

int mutex=0; void enter-cs() { while (…………………………………); } void leave-cs() { …………………………………..; }

(ii) Is the above solution to the critical section problem deadlock free and starvation-free?

(iii) For the above solution, show by an example that mutual exclusion is not ensured if TEST-AND-SET instruction is not atomic.

Theory Explanation is given below. |

Question 67 |

A computer system uses 32-bit virtual address, and 32-bit physical address. The physical memory is byte addressable, and the page size is 4 kbytes. It is decided to use two level page tables to translate from virtual address to physical address. Equal number of bits should be used for indexing first level and second level page table, and the size of each page table entry is 4 bytes.

- (a) Give a diagram showing how a virtual address would be translated to a physical address.

(b) What is the number of page table entries that can be contained in each page?

(c) How many bits are available for storing protection and other information in each page table entry?

Theory Explanation is given below. |

Question 68 |

The following solution to the single producer single consumer problem uses semaphores for synchronization.

#define BUFFSIZE 100 buffer buf[BUFFSIZE]; int first=last=0; semaphore b_full=0; semaphore b_empty=BUFFSIZE; void producer() { while (1) { produce an item; p1: …………………..; put the item into buff (first); first=(first+1)%BUFFSIZE; p2: …………………..; } } void consumer() { while (1) { c1:…………………….. take the item from buf[last]; last=(last+1)%BUFFSIZE; c2: ……………………..; consume the item; } }

- (a) Complete the dotted part of the above solution.

(b) Using another semaphore variable, insert one line statement each immediately after p1, immediately before p2, immediately after c1, and immediately before c2 so that the program works correctly for multiple procedures and consumers.

Theory Explanation is given below. |

Question 69 |

We require a four state automaton to recognize the regular expression (a|b)*abb.

- (a) Give an NFA for this purpose.

(b) Give a DFA for this purpose.

Theory Explanation is given below. |

Question 70 |

(a) Construct all the parse trees corresponding to i + j * k for the grammar

E → E+E E → E*E E → id

- (b) In this grammar, what is the precedence of the two operators * and +?

(c) If only one parse tree is desired for any string in the same language, what changes are to be made so that the resulting LALR(1) grammar is non-ambiguous?

Theory Explanation is given below. |