Alien head

Computer Science (GATE Exam) 2007 - Previous Question Paper Solution

Description: GATE Exam Previous Year Question Paper Solution Computer Science(CS) - 2007
Number of Questions: 85
Created by:
Tags: Computer Science GATE CS Previous Year Paper
Attempted 0/85 Correct 0 Score 0

Let S be a set of n elements. The number of ordered pairs in the largest and the smallest equivalence relations on S are:

  1. n and n

  2. n2 and n

  3. n2 and 0

  4. n and 1


Correct Option: B
Explanation:

Smallest equivalence relation for set of n elements has n ordered pair and largest equivalence relation has n2 ordered pairs.

What is the maximum number of different Boolean functions involving n Boolean variables?

  1. n2

  2. 2n

  3. 22n

  4. $2^{n^2}$


Correct Option: C
Explanation:

Let G be the non-planar graph with the minimum possible number of edges. Then G has

  1. 9 edges and 5 vertices

  2. 9 edges and 6 vertices

  3. 10 edges and 5 vertices

  4. 10 edges and 6 vertices


Correct Option: B
Explanation:

Kurtowskis 3,3 (K3,3) is a non - planer graph with minimum number of edges. It has 9 edges and 6 vertices.

How many 3-to-8 line decoders with an enable input are needed to construct a 6-to-64 line decoder without using any other logic gates?

  1. 7

  2. 8

  3. 9

  4. 10


Correct Option: C
Explanation:


But we need one more decoder i.e for combining result.
8 + 1 = 9 decoders

Consider the DAG with V = {1, 2, 3, 4, 5, 6}, shown below.

Which of the following is NOT a topological ordering?

  1. 1 2 3 4 5 6

  2. 1 3 2 4 5 6

  3. 1 3 2 4 6 5

  4. 3 2 4 1 6 5


Correct Option: D
Explanation:

We have
INDEG (v) = In degree of verter v.
As, INDEG (1) = 0, INDEG (2) = 1
INDEG (3) = 1  INDEG (4) = 2
INDEG (5) = 2m            INDEG (6) = 2
Node 1 is with zero indegree, therefore first node in ordering will always 1 thus answer (4) is not a
topological ordering.

Consider the following Boolean function of four variables:
f (w, x, y, z) = $\sum$(1,3,4,6,9,11,12,14)
The function is:

  1. independent of one variables.

  2. independent of two variables.

  3. independent of three variables.

  4. dependent on all the variables.


Correct Option: B
Explanation:

Consider the following statements about user level threads and kernel level threads. Which one of the following statements is FALSE?

  1. Context switch time is longer for kernel level threads than for user level threads.

  2. User level threads do not need any hardware support.

  3. Related kernel level threads can be scheduled on different processors in a multi-processor system.

  4. Blocking one kernel level thread blocks all related threads.


Correct Option: D
Explanation:

The maximum number of binary trees that can be formed with three unlabeled nodes is:

  1. 1

  2. 5

  3. 4

  4. 3


Correct Option: B
Explanation:

Which one of the following is a top-down parser?

  1. Recursive descent parser.

  2. Operator precedence parser

  3. An LR(k) parser.

  4. An LALR(k) parser.


Correct Option: A
Explanation:

Consider the following two statements about the function f (x) = x:
P. f (x) is continuous for all real values of x
Q. f (x) is differentiable for all real values of x
Which of the following is TRUE?

  1. P is true and Q is false.

  2. P is false and Q is true.

  3. Both P and Q are true.

  4. Both P and Q are false.


Correct Option: A
Explanation:

$\because$        f(x) = |x|

X-X
Y0
= $\begin{cases} x, & x \ge 0 \\ ix, & x < 0 \end{cases}$
Graph of f(x) will be -

We can easily see from the above graph that f(x) is continuous for all real values of x.
But f(x) is not differentiable for all real values of x eg; at x = 0
So, Let hand derivative
= $h \rightarrow0 $$\dfrac{f(0 -h) -f(0)}{-h}$
= $h \rightarrow0 $$\dfrac{-(0 -h)}{-h}$
And Right hand derivative
= $h \rightarrow0 $$\dfrac{f(0 -h) -f(0)}{-h}$
= $h \rightarrow0 $$\dfrac{h}{h} = 1$
As if, Left hand derivative $\ne$Right hand derivative.
So, f(x) is not differentiable at x = 0 hence it is not differentiable for all real values of x.

Let A be a $4 \times 4$ matrix with eigen values -5,-2,1,4. Which of the following is an eigen value of the matrix$\begin{bmatrix} A & I \\ I & A \end{bmatrix}$, where $I$ is the $4 \times 4$ identity matrix?

  1. -5

  2. -7

  3. 2

  4. 1


Correct Option: D

The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a binary tree of height h is:

  1. 2h - 1

  2. 2h-1 - 1

  3. 2h+1 - 1

  4. 2h+1


Correct Option: C
Explanation:

Which of the following sorting algorithms has the lowest worst-case complexity?

  1. Merge sort

  2. Bubble sort

  3. Quick sort

  4. Selection sort


Correct Option: A
Explanation:

In Ethernet when Manchester encoding is used, the bit rate is:

  1. Half the baud rate

  2. Twice the baud rate.

  3. Same as the baud rate.

  4. None of the above


Correct Option: B
Explanation:

How many different non-isomorphic Abelian groups of order 4 are there?

  1. 2

  2. 3

  3. 4

  4. 5


Correct Option: B

Consider the series $x_{n+1} = \frac{x_n}{2}+\frac{9}{8x_n},x_0 = 0.5$ obtained from the Newton-Raphson method. The series converges to

  1. 1.5

  2. $\sqrt{2}$

  3. 1.6

  4. 1.4


Correct Option: A
Explanation:

The given series converges to 1.5.

Suppose we uniformly and randomly select a permutation from the 20!
Permutations of 1, 2, 3,….., 20. What is the probability that 2 appears at an earlier position than any other even number in the selected permutation?

  1. $\dfrac{1}{2}$

  2. $\dfrac{1}{10}$

  3. $\dfrac{9!}{20!}$

  4. None of these


Correct Option: D
Explanation:

null

Consider the set of (column) vectors defined by
$$X = \left \{x \in R^3 \mid x_1 + x_2 + x_3 = 0, \text{ where } x^T = \left[x_1,x_2,x_3\right]^T\right \}$$.

Which of the following is TRUE?

  1. $\left\{\left[1,-1,0\right]^T,\left[1,0,-1\right]^T\right\}$ is a basis for the subspace $X$.

  2. $\left\{\left[1,-1,0\right]^T,\left[1,0,-1\right]^T\right\}$ is a linearly independent set, but it does not span $X$ and therefore is not a basis of $X$.

  3. X is not a subspace of R3

  4. None of the above


Correct Option: B

Let Graph(x) be a predicate which denotes that x is a graph. Let Connected(x) be a predicate which denotes that x is connected. Which of the following first order logic sentences DOES NOT represent the statement: “Not every graph is connected”?

  1. $\lnot \forall x\, \Bigl ( Graph(x) \implies Connected(x) \Bigr )$

  2. $\exists x\, \Bigl (Graph(x) \land \lnot Connected(x) \Bigr )$

  3. $\lnot \forall x \, \Bigl ( \lnot Graph(x) \lor Connected(x) \Bigr )$

  4. $\forall x \, \Bigl ( Graph(x) \implies \lnot Connected(x) \Bigr )$


Correct Option: D
Explanation:

Vx[ Graph (x) $\Rightarrow$7 connected (x) ]
Indicates “for every x if x is a graph, then it is not connected”

The control signal functions of a 4-bit binary counter are given below (where X is “don't care”):
Clear Clock Load Count Function

The counter is connected as follows:

Assume that the counter and gate delays are negligible. If the counter starts at 0, then it cycles through the following sequence:

  1. 0, 3, 4

  2. 0, 3, 4, 5

  3. 0, 1, 2, 3, 4

  4. 0, 1, 2, 3, 4, 5


Correct Option: D
Explanation:

Which of the following graphs has an Eulerian circuit?

  1. Any k-regular graph where k is an even number.

  2. A complete graph on 90 vertices.

  3. The complement of a cycle on 25 vertices.

  4. None of the above


Correct Option: A
Explanation:

A k-regular graph is one in which vertex is of degree k. If k is even then, such a graph will have an Eulerian circuit.

Group 1 contains some CPU scheduling algorithms and Group 2 contains some applications. Match the entries in Group 1 to the entries in Group 2.

Group I
Group II
(P) Gang Scheduling (1) Guaranteed Scheduling (Q) Rate Monotonic Scheduling (2) Real-time Scheduling (R) Fair Share Scheduling (3) Thread Scheduling

  1. P - 3, Q - 2, R - 1

  2. P - 1, Q - 2, R - 3

  3. P - 2, Q - 3, R - 1

  4. P - 1, Q - 3, R - 2


Correct Option: A
Explanation:

Define the connective * for the Boolean variables X and Y as: X * Y = XY + X'Y'. Let Z = X *Y. Consider the following expressions P, Q and R.

$\pi P$ : X = Y * Z Q : Y = X * Z R : X *Y * Z = 1

Which of the following is TRUE?

  1. Only P and Q are valid.

  2. Only Q and R are valid.

  3. Only P and R are valid.

  4. All P, Q, R are valid.


Correct Option: A
Explanation:


Suppose only one multiplexer and one inverter are allowed to be used to implement any Boolean function of n variables. What is the minimum size of the multiplexer needed?

  1. 2n line to 1 line

  2. 2n+1 line to 1 line

  3. 2n−1 line to 1 line

  4. 2n−2 line to 1 line


Correct Option: C
Explanation:

Which one of the following uses UDP as the transport protocol?

  1. HTTP

  2. Telnet

  3. DNS

  4. SMTP


Correct Option: C
Explanation:

HTTP & SMTP uses TCP to make call. DNS which is used for mapping name to IP addresses uses UDP to make function calls.

Let f (w, x, y, z) = $\sum$(0,4,5,7,8,9,13,15). Which of the following expressions is/are NOT equivalent to f?

P. x’y’z’ + w’xy’ + wy’z + xz
Q. w’y’z’ + wx’y’ + xz
R. w’y’z’ + wx’y’ + xyz + xy’z
S. x’y’z’ + wx’y’ + w’y

  1. P only

  2. Q and S

  3. R and S

  4. S only


Correct Option: B
Explanation:

The in order and preorder traversal of a binary tree are
d b e a f c g and a b d e c f g, respectively
The post order traversal of the binary tree is:

  1. d e b f g c a

  2. e d b g f c a

  3. e d b f g c a

  4. d e f g b c a


Correct Option: A
Explanation:


Consider a hash table of size seven, with starting index zero, and a hash function (3x + 4) mod 7. Assuming the hash table is initially empty, which of the following is the contents of the table when the sequence 1, 3, 8, 10 is inserted into the table using closed hashing? Note that − denotes an empty location in the table.

  1. 8, −, −, −, −, −, 10

  2. 1, 8, 10, −, −, −, 3

  3. 1, −, −, −, −, −, 3

  4. 1, 10, 8, −, −, −, 3


Correct Option: B
Explanation:

In an unweighted, undirected connected graph, the shortest path from a node S to every other node is computed most efficiently, in terms of time complexity, by

  1. applying Dijkstra’s algorithm starting from S

  2. applying Warshall’s algorithm

  3. performing a DFS starting from S

  4. performing a BFS starting from S


Correct Option: D
Explanation:

A complete n-ary tree is a tree in which each node has n children or no children. Let I be the number of internal nodes and L be the number of leaves in a complete n-ary tree. If L = 41, and I = 10, what is the value of n?

  1. 3

  2. 4

  3. 5

  4. 6


Correct Option: C
Explanation:

In a look-ahead carry generator, the carry generate function Gi and the carry propagate function Pi for
inputs Ai and Bi are given by:

Pi = Ai $\oplus$ Bi and Gi = Ai Bi
The expressions for the sum bit Si and the carry bit Ci+1 of the look-ahead carry adder are given by:
Si = Pi Ci and Ci+1 = Gi + Pi Ci, where Co is the input carry.
Consider a two-level logic implementation of the look-ahead carry generator.
Assume that all Pi and Gi are available for the carry generator circuit and that the AND and OR gates
can have any number of inputs. The number of AND gates and OR gates needed to implement the
look-ahead carry generator for a 4-bit adder with 3 2 1 0 4 S ,S ,S ,S and C as its outputs are
respectively:

  1. 6, 3

  2. 10, 4

  3. 6, 4

  4. 10, 5


Correct Option: B
Explanation:

Which of the following is TRUE about formulae in Conjunctive Normal Form?

  1. For any formula, there is a truth assignment for which at least half the clauses evaluate to true.

  2. For any formula, there is a truth assignment for which all the clauses evaluate to true.

  3. There is a formula such that for each truth assignment, at most one-fourth of the clauses evaluate to true.

  4. None of the above.


Correct Option: B
Explanation:

Since all clauses must be true for a formula (in conjunctive Normal Form) to be true, hence at least for one truth assignments all clauses will evaluate to true.

What is the time complexity of the following recursive function?
Int Do Something (int n) {
return 1;
else
return (Do Something (floor sqrt (n))) + n);

  1. $\odot$(n2)

  2. $\odot$(n log2 n)

  3. $\odot$(log2 n)

  4. $\odot$(log2 log2 n)


Correct Option: D
Explanation:


Let w be the minimum weight among all edge weights in an undirected connected graph. Let e be a specific edge of weight w . Which of the following is FALSE?

  1. There is a minimum spanning tree containing e.

  2. If e is not in a minimum spanning tree T, then in the cycle formed by adding e to T, all edges have the same weight.

  3. Every minimum spanning tree has an edge of weight w.

  4. e is present in every minimum spanning tree.


Correct Option: D
Explanation:

Consider the process of inserting an element into a Max Heap, where the Max Heap is represented by an array. Suppose we perform a binary search on the path from the new leaf to the root to find the position for the newly inserted element, the number of comparisons performed is:

  1. $\odot$ (log2 n)

  2. $\odot$(log2 log2 n)

  3. $\odot$ (n)

  4. $\odot$(nlog2 n)


Correct Option: A
Explanation:

In the following C function, let n $\ge$ m.

Int gcd (n,m)
{
if (n% m ==0) return m;
n = n %m;
return gcd (m, n);
}

How many recursive calls are made by this function?

  1. $\odot$(log2 n)

  2. $\Omega$(n)

  3. $\odot$(log2log2 n)

  4. $\odot$($\sqrt n$)


Correct Option: A
Explanation:

An array of n numbers is given, where n is an even number. The maximum as well as the minimum of these n numbers needs to be determined. Which of the following is TRUE about the number of comparisons needed?

  1. At least 2n − c comparisons, for some constant c, are needed.

  2. At most 1.5n − 2 comparisons are needed.

  3. At least nlog2 comparisons are needed.

  4. None of the above.


Correct Option: B
Explanation:


Consider the following two statements:
P: Every regular grammar is LL(1)
Q: Every regular set has a LR(1) grammar
Which of the following is TRUE?

  1. Both P and Q are true

  2. P is true and Q is false

  3. P is false and Q is true

  4. Both P and Q are false


Correct Option: B
Explanation:

A single processor system has three resource types X, Y and Z, which are shared by three processes. There are 5 units of each resource type. Consider the following scenario, where the column alloc denotes the number of units of each resource type allocated to each process, and the column request denotes the number of units of each resource type requested by a process in order to complete execution. Which of these processes will finish LAST?

  1. P0

  2. P1

  3. P2

  4. None of the above, since the system is in a deadlock.


Correct Option: C
Explanation:

Consider the grammar with non-terminals N = { S, C, S1), terminals T = {a, b, i, t, e}, with S as the start symbol, and the following set of rules:

S $\rightarrow$iCtSS1 | a
S1 $\rightarrow$ eS |$\in$
C $\rightarrow$ b

The grammar is NOT LL(1) because:

  1. it is left recursive

  2. it is right recursive

  3. it is ambiguous

  4. it is not context-free.


Correct Option: A
Explanation:

A virtual memory system uses First In First Out (FIFO) page replacement policy and allocates a fixed
number of frames to a process. Consider the following statements:
P: Increasing the number of page frames allocated to a process sometimes increases the page fault rate.
Q: Some programs do not exhibit locality of reference.
Which one of the following is TRUE?

  1. Both P and Q are true, and Q is the reason for P

  2. Both P and Q are true, but Q is not the reason for P.

  3. P is false, but Q is true

  4. Both P and Q are false.


Correct Option: B
Explanation:

Consider the following C code segment:
int Is Prime (n)
{
int i, n;
for (i = 2; i <= sqrt (n) ; i ++)
if (n% i == 0) { print f (“ Not Prime n”); return 0; }
return 1;
}
Let T (n) denote the number of times the for loop is executed by the program on input n. Which of the following is TRUE?

  1. T (n) = O($\sqrt n$) and T (n) =$\Omega$($\sqrt n$)

  2. T (n) = O($\sqrt n$) and T (n) = $\Omega$ (1)

  3. T (n) = O(n) and T (n) = $\Omega$ ($\sqrt n$)

  4. None of the above


Correct Option: B
Explanation:

Two processes, P1 and P2, need to access a critical section of code. Consider the following synchronization construct used by the processes:

Here, wants1 and wants2 are shared variables, which are initialized to false.
Which one of the following statements is TRUE about the above construct?

  1. It does not ensure mutual exclusion.

  2. It does not ensure bounded waiting.

  3. It requires that processes enter the critical section in strict alternation.

  4. It does not prevent deadlocks, but ensures mutual exclusion.


Correct Option: D
Explanation:

There are n stations in a slotted LAN. Each station attempts to transmit with a probability p in each time slot. What is the probability that ONLY one station transmits in a given time slot?

  1. np (1-p)n-1

  2. (1- p)n-1

  3. p (1- p)n-1

  4. 1- (1- p)n-1


Correct Option: A
Explanation:

The message 11001001 is to be transmitted using the CRC polynomial x3 + 1 to protect it from errors. The message that should be transmitted is:

  1. 11001001000

  2. 11001001011

  3. 11001010

  4. 110010010011


Correct Option: B
Explanation:

An operating system uses shortest remaining time first (SRT) process scheduling algorithm. Consider the arrival times and execution times for the following processes:

Process Execution time Arrival time P1 20 0 P2 25 15 P3 10 30 P4 15 45

What is the total waiting time for process P2?

  1. 5

  2. 15

  3. 40

  4. 55


Correct Option: B
Explanation:

In a simplified computer the instructions are:
OP Rj , Ri - Performs Rj OP Ri and stores the result in register . Ri
OP m, Ri - Performs val i OP Ri and stores the result in Ri. val denotes the content of memory location m.
MOV m, Ri - Moves the content of memory location m to register Ri
MOV Ri , m - Moves the content of register Ri to memory location m.
The computer has only to registers, and OP is either ADD or SUB. Consider the following basic block:
t1 = a + b
t2 = c + d
t3 = e - t2
t4 = t1 - b
Assume that all operands are initially in memory. The final value of the computation should be in memory. What is the minimum number of MOV instructions in the code generated for this basic block?

  1. 2

  2. 3

  3. 5

  4. 6


Correct Option: B
Explanation:

The address of a class B host is to be split into subnets with a 6-bit subnet number. What is the maximum number of subnets and the maximum number of hosts in each subnet?

  1. 62 subnets and 262142 hosts

  2. 64 subnets and 262142 hosts

  3. 62 subnets and 1022 hosts

  4. 64 subnets and 1024 hosts


Correct Option: C
Explanation:

In a token ring network the transmission speed is107 bps and the propagation speed is 200 metres/$\mu$s. The 1-bit delay in this network is equivalent to:

  1. 500 metres of cable.

  2. 200 metres of cable.

  3. 20 metres of cable.

  4. 50 metres of cable.


Correct Option: C
Explanation:

The distance between two stations M and N is L kilometers. All frames are K bits long. The propagation delay per kilometer is t seconds. Let R bits/second be the channel capacity. Assuming that processing delay is negligible, the minimum number of bits for the sequence number field in a frame for maximum utilization, when the sliding window protocol is used, is:

  1. $\left[ log_2 \dfrac{2LtR +2K}{K} \right]$

  2. $\left[ log_2 \dfrac{2LtR +2K}{K} \right]$

  3. $\left[ log_2 \dfrac{2LtR +2K}{K} \right]$

  4. $\left[ log_2 \dfrac{2LtR +2K}{K} \right]$


Correct Option: B
Explanation:


Suppose the letters a, b, c, d, e, f have probabilities $ \dfrac{1}{2},\dfrac{1}{4},\dfrac{1}{8},\dfrac{1}{16},\dfrac{1}{32},\dfrac{1}{32}$ respectively.

Which of the following is the Huffman code for the letter a, b, c, d, e, f?

  1. 0, 10, 110, 1110, 11110, 11111

  2. 11, 10, 011, 010, 001, 000

  3. 11, 10, 01, 001, 0001, 0000

  4. 110, 100, 010, 000, 001, 111


Correct Option: A
Explanation:


Match the following:

(P) SMTP (1) Application layer
(Q) BGP (2) Transport layer
(R) TCP (3) Data link layer
(S) PPP (4) Network layer
(5) Physical layer
  1. P - 2, Q - 1, R - 3, S - 5

  2. P - 1, Q - 4, R - 2, S - 3

  3. P - 1, Q - 4, R - 2, S - 5

  4. P - 2, Q - 4, R - 1, S - 3


Correct Option: B
Explanation:

Suppose the letters a, b, c, d, e, f have probabilities $ \dfrac{1}{2},\dfrac{1}{4},\dfrac{1}{8},\dfrac{1}{16},\dfrac{1}{32},\dfrac{1}{32}$ respectively.

What is the average length of the correct answer to Q.?

  1. 3

  2. 2.1875

  3. 2.25

  4. 1.9375


Correct Option: D
Explanation:


A process has been allocated 3 page frames. Assume that none of the pages of the process are available in the memory initially. The process makes the following sequence of page references (reference string): 1, 2, 1, 3, 7, 4, 5, 6, 3, 1

If optimal page replacement policy is used, how many page faults occur for the above reference string?

  1. 7

  2. 8

  3. 9

  4. 10


Correct Option: A
Explanation:


A process has been allocated 3 page frames. Assume that none of the pages of the process are available in the memory initially. The process makes the following sequence of page references (reference string): 1, 2, 1, 3, 7, 4, 5, 6, 3, 1

Least Recently Used (LRU) page replacement policy is a practical approximation to optimal page replacement. For the above reference string, how many more page faults occur with LRU than with the optimal page replacement policy?

  1. 0

  2. 1

  3. 2

  4. 3


Correct Option: C
Explanation:

Consider the CFG with {S, A, B} as the non-terminal alphabet, {a, b} as the terminal alphabet, S as the start symbol and the following set of production rules:

S$ \rightarrow$ a B S $ \rightarrow$bA
B $ \rightarrow$b A$ \rightarrow$ a
B $ \rightarrow$bS A $ \rightarrow$aS
B $ \rightarrow$aBB S$ \rightarrow$ bAA

Which of the following strings is generated by the grammar?

  1. aaaabb

  2. aabbbb

  3. aabbab

  4. abbbba


Correct Option: C
Explanation:

Suppose that a robot is placed on the Cartesian plane. At each step it is allowed to move either one unit up or one unit right, i.e., if it is at (i, j) then it can move to either (i + 1, j) or (i, j + 1).

Suppose that the robot is not allowed to traverse the line segment from (4, 4) to (5, 4). With this
constraint, how many distinct paths are there for the robot to reach (10, 10) starting from (0, 0)?

  1. 29

  2. 219

  3. $ ^{8}C_{4} \times^{11}C_{5}$

  4. $ ^{20}C_{10} - ^{8}C_{4}\times ^{11}C_{5}$


Correct Option: D

Suppose that a robot is placed on the Cartesian plane. At each step it is allowed to move either one unit up or one unit right, i.e., if it is at (i, j) then it can move to either (i + 1, j) or (i, j + 1).

How many distinct paths are there for the robot to reach the point (10,10) starting from the initial position (0,0)?

  1. $^{20}\mathrm{C}_{10}$

  2. 220

  3. 210

  4. None of the above


Correct Option: A
Explanation:

null

Consider the CFG with {S, A, B} as the non-terminal alphabet, {a, b} as the terminal alphabet, S as the start symbol and the following set of production rules:

S $\rightarrow$ aB S $\rightarrow$ bA
B $\rightarrow$ b A $\rightarrow$ a
B $\rightarrow$ bS A $\rightarrow$ aS
B $\rightarrow$ aBB S $\rightarrow$ bAA

How many derivation trees are there?

  1. 1

  2. 2

  3. 3

  4. 4


Correct Option: B
Explanation:

$\rightarrow$ aB $\rightarrow$ aBB $\rightarrow$ abSbS $\rightarrow$ abbAbaB $\rightarrow$ abbabab
$\rightarrow$ bA $\rightarrow$ baS $\rightarrow$ babAA $\rightarrow$ babaSaS $\rightarrow$ bababAabA $\rightarrow$ bababaaba

Consider a 4-way set associative cache consisting of 128 lines with a line size of 64 words. The CPU generates a 20-bit address of a word in main memory. The number of bits in the TAG, LINE and WORD fields are respectively:

  1. 9, 6, 5

  2. 7, 7, 6

  3. 7, 5, 8

  4. 9, 5, 6


Correct Option: D
Explanation:

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:

  1. 256 Mbyte, 19 bits

  2. 256 Mbyte, 28 bits

  3. 512 Mbyte, 20 bits

  4. 64 Gbyte, 28 bits


Correct Option: A
Explanation:

Consider a machine with a byte addressable main memory of 216 bytes. Assume that a direct mapped data cache consisting of 32 lines of 64 bytes each is used in the system. A 50 × 50 two-dimensional array of bytes is stored in the main memory starting from memory location 1100H. Assume that the data cache is initially empty. The complete array is accessed twice. Assume that the contents of the data cache do not change in between the two accesses.

Which of the following lines of the data cache will be replaced by new blocks in accessing the array for the second time?

  1. line 4 to line 11

  2. line 4 to line 12

  3. line 0 to line 7

  4. line 0 to line 8


Correct Option: C
Explanation:

Consider a pipelined processor with the following four stages:
IF: Instruction Fetch
ID: Instruction Decode and Operand Fetch
EX: Execute
WB: Write Back
The IF, ID and WB stages take one clock cycle each to complete the operation.
The number of clock cycles for the EX stage depends on the instruction. The ADD and SUB instructions
need 1 clock cycle and the MUL instruction needs 3 clock cycles in the EX stage. Operand forwarding
is used in the pipelined processor.
What is the number of clock cycles taken to complete the following sequence of instructions?
ADD R2, R1, R0 R2 $\rightarrow$ R1 + R0
MUL R4, R3, R2 R4$\rightarrow$ R3 * R2
SUB R6, R5, R4 R6 $\rightarrow$R5 - R4

  1. 7

  2. 8

  3. 10

  4. 14


Correct Option: B
Explanation:


Consider a machine with a byte addressable main memory of 216 bytes. Assume that a direct mapped data cache consisting of 32 lines of 64 bytes each is used in the system. A 50 × 50 two-dimensional array of bytes is stored in the main memory starting from memory location 1100H. Assume that the data cache is initially empty. The complete array is accessed twice. Assume that the contents of the data cache do not change in between the two accesses.

How many data cache misses will occur in total?

  1. 48

  2. 50

  3. 56

  4. 59


Correct Option: C
Explanation:

Consider the following program segment. Here R1, R2 and R3 are the general purpose registers.

Instruction Operation Instruction size (no. of words)
MOV R1, (3000) R1 _ m[3000] 2
LOOP: MOV R2, (R3) R2 _ M[R3] 1
ADD R2, R1 R2 _ R1 + R2 1
MOV (R3), R2 M[R3] _ R2 1
INC R3 R3 _ R3 + 1 1
DEC R1 R1 _ R1 - 1 1
BNZ LOOP Branch on not zero 2
HALT Stop 1

Assume that the content of memory location 3000 is 10 and the content of the register R3 is 2000. The content of each of the memory locations from 2000 to 2010 is 100. The program is loaded from the memory location 1000. All the numbers are in decimal.

Assume that the memory is word addressable. The number of memory references for accessing the data in executing the program completely is:

  1. 10

  2. 11

  3. 20

  4. 21


Correct Option: D
Explanation:

Consider the following program segment. Here R1, R2 and R3 are the general purpose registers.

Instruction Operation Instruction size (no. of words)
MOV R1, (3000) R1 _ m[3000] 2
LOOP: MOV R2, (R3) R2 _ M[R3] 1
ADD R2, R1 R2 _ R1 + R2 1
MOV (R3), R2 M[R3] _ R2 1
INC R3 R3 _ R3 + 1 1
DEC R1 R1 _ R1 - 1 1
BNZ LOOP Branch on not zero 2
HALT Stop 1

Assume that the content of memory location 3000 is 10 and the content of the register R3 is 2000. The content of each of the memory locations from 2000 to 2010 is 100. The program is loaded from the memory location 1000. All the numbers are in decimal.

Assume that the memory is word addressable. After the execution of this program, the content of memory location 2010 is:

  1. 100

  2. 101

  3. 102

  4. 110


Correct Option: A
Explanation:

Consider the following program segment. Here R1, R2 and R3 are the general purpose registers.

Instruction Operation Instruction size (no. of words)
MOV R1, (3000) R1 _ m[3000] 2
LOOP: MOV R2, (R3) R2 _ M[R3] 1
ADD R2, R1 R2 _ R1 + R2 1
MOV (R3), R2 M[R3] _ R2 1
INC R3 R3 _ R3 + 1 1
DEC R1 R1 _ R1 - 1 1
BNZ LOOP Branch on not zero 2
HALT Stop 1

Assume that the content of memory location 3000 is 10 and the content of the register R3 is 2000. The content of each of the memory locations from 2000 to 2010 is 100. The program is loaded from the memory location 1000. All the numbers are in decimal.

Assume that the memory is byte addressable and the word size is 32 bits. If an interrupt occurs during the execution of the instruction “INC R3”, what return address will be pushed on to the stack?

  1. 1005

  2. 1020

  3. 1024

  4. 1040


Correct Option: C
Explanation:


Consider the following C function:

int f(int n) {
  static int r = 0;
  if (n &lt;= 0) return 1;
  if (n &gt; 3) {
    r = n;
    return f(n - 2) + 2;
  }
  return f(n - 1) + r;
}

What is the value of f (5)?

  1. 5

  2. 7

  3. 9

  4. 18


Correct Option: D
Explanation:


The following postfix expression with single digit operands is evaluated using a stack:
8 2 3 $\land$/ 2 3 * + 5 1 * -

Note that $\land$ is the exponentiation operator. The top two elements of the stack after the first * is evaluated are:

  1. 6, 1

  2. 5, 7

  3. 3, 2

  4. 1, 5


Correct Option: B
Explanation:


Consider the following segment of C-code:

int j, n;
    j = 1;
   while (j &lt;= n)
         j = j*2

The number of comparisons made in the execution of the loop for any n > 0 is:

  1. [log2 n] + 1

  2. n

  3. [log2 n]

  4. [log2 n] + 2


Correct Option: A
Explanation:

Consider the following C program segment where CellNode represents a node in a binary tree:

Struct Cell Node {
  Struct Cell Node * left child;
  Int element;
  Struct Cell Node * right Child;
};
Int Get Value(struct Cell Node * ptr) {
  Int Value = 0;
  if (ptr! = NULL)
    if ((ptr - &gt; left child == NULL) &amp;&amp;
      (ptr - &gt; right Child == NULL))
      Value = 1;
    else
      Value = value + GetValue(ptr - &gt; left Child) + Get Value(ptr - &gt; right child);
}
return (value);
}

The value returned by GetValue when a pointer to the root of a binary tree is passed as its argument is:

  1. the number of nodes in the tree

  2. the number of internal nodes in the tree

  3. the number of leaf nodes in the tree

  4. the height of the tree


Correct Option: C
Explanation:

Information about a collection of students is given by the relation studinfo (studId, name, sex). The relation enroll (studId, courseId) gives which student has enrolled for (or taken) what course(s). Assume that every course is taken by at least one male and at least one female student. What does the following relational algebra expression represent?

$\pi_{courceId}\left(\left(\pi_{\text{studId}}\left(\sigma_{sex="female"}\left(\text{studInfo}\right)\right) \times \pi_{courseId}\left(\text{enroll}\right)\right) -\text{enroll}\right)$

  1. Courses in which all the female students are enrolled.

  2. Courses in which a proper subset of female students are enrolled.

  3. Courses in which only male students are enrolled.

  4. None of the above


Correct Option: B
Explanation:

Consider the table employee (empId, name, department, salary) and the two queries Q1, Q2 below.
Assuming that department 5 has more than one employee, and we want to find the employees who get higher salary in department 5, which one of the statements is TRUE for any arbitrary employee table?

$Q_1$ : Select e. empId
            From employee 
            Where not exists 
            (Select * From employee s where s. department = “5” and s. salary &gt;= e. salary) 
$Q_2$ : Select e. empId
            From employee e
            Where e. salary &gt; any
            (select distinct salary From employee s where s. Where s. department = “5”)
  1. Q1 is the correct query.

  2. Q2 is the correct query.

  3. Both Q1 and Q2 produce the same answer.

  4. Neither Q1 nor Q2 is the correct query.


Correct Option: B
Explanation:

Consider the following schedules involving two transactions. Which one of the following statements is TRUE?

S1 : r1 (X); r1 (Y); r2 (X); r2 (Y); w2 (Y); W1 (X)
S2 : r1 (X); r2 (Y); r2 (X); w2 (Y); r1 (Y); W1 (X)

  1. Both S1 and S2 are conflict serializable.

  2. S1 is conflict serializable and S2 is not conflict serializable.

  3. S1 is not conflict serializable and S2 is conflict serializable.

  4. Both S1 and S2 are not conflict serializable.


Correct Option: C
Explanation:

Consider the relation employee (name, sex, supervisor Name) with name as the key; supervisor Name gives the name of the supervisor of the employees under consideration. What does the following Tuple Relational Calculus query produce?
{
e. name| employee (e) $\land$
$\forall X$[$\neg$employee (x) $\lor$ x.supervisorName $\ne$e.name $\lor$ x.sex = “male”]
}

  1. Names of employees with a male supervisor.

  2. Names of employees with no immediate male supervisor.

  3. Names of employees with no immediate female supervisor.

  4. Names of employees with a female supervisor.


Correct Option: B
Explanation:

Which one of the following statements is FALSE?

  1. Any relation with two attributes is in BCNF.

  2. A relation in which every key has only one attribute is in 2NF.

  3. A prime attribute can be transitively dependent on a key in a 3 NF relation.

  4. A prime attribute can be transitively dependent on a key in a BCNF relation.


Correct Option: D
Explanation:

(1) True, because any relation with 2 attributes is in BCNF.
(2) True, because in 2NF non-prime attributes should fully functional dependent upon keys.
(3) A prime attribute can functionally dependent on a key in 3 NF.
(4) In BCNF, transitivity is eliminated. 
 

The order of a leaf node in a B+ - tree is the maximum number of (value, data record pointer) pairs it can hold. Given that the block size is 1K bytes, data record pointer is 7 bytes long, the value field is 9 bytes long and a block pointer is 6 bytes long, what is the order of the leaf node?

  1. 63

  2. 64

  3. 67

  4. 68


Correct Option: B
Explanation:

Which of the following problems is undecidable?

  1. Membership problem for CFGs.

  2. Ambiguity problem for CFGs.

  3. Finiteness problem for FSAs.

  4. Equivalence problem for FSAs.


Correct Option: B
Explanation:

Which of the following is TRUE?

  1. Every subset of a regular set is regular.

  2. Every finite subset of a non-regular set is regular.

  3. The union of two non-regular sets is not regular.

  4. Infinite union of finite sets is regular.


Correct Option: B
Explanation:

Consider the following Finite State Automaton:

The language accepted by this automaton is given by the regular expression

  1. b* ab* ab* ab*

  2. (a + b)*

  3. b*a (a + b)*

  4. b* ab* ab*


Correct Option: C
Explanation:

The language {0i 21i | i $\ge$0} over the alphabet {0, 1, 2} is:

  1. not recursive

  2. is recursive and is a deterministic CFL.

  3. is a regular language.

  4. is not a deterministic CFL but a CFL.


Correct Option: B
Explanation:

A minimum state deterministic finite automaton accepting the language L = {w | w $\in${0, 1}*, number of 0s and 1s in w are divisible by 3 and 5, respectively} has

  1. 15 states

  2. 11 states

  3. 10 states

  4. 9 states


Correct Option: A
Explanation:

Consider the following Finite State Automaton:

The minimum state automaton equivalent to the above FSA has the following number of states

  1. 1

  2. 2

  3. 3

  4. 4


Correct Option: B
Explanation:


So only 2 states

Which of the following languages is regular?

  1. $\left\{ww^R \mid w \in {0, 1}^+\right\}$

  2. $\left\{ww^Rx \mid x,w \in {0, 1}^+\right\}$

  3. $\left\{wxw^R \mid x, w \in {0, 1}^+\right\}$

  4. $\left\{xww^R \mid x, w \in {0, 1}^+\right\}$


Correct Option: C
Explanation:

Consider the set $S = \left\{ a , b , c , d \right\}$ . Consider the following 4 partitions $\pi_1,\pi_2,\pi_3,\pi_4$ on $S : \pi_1 = \left\{\overline{abcd}\right\} , \pi_2 = \left\{\overline{ab}, \overline{cd}\right\}, \pi_3 = \left\{\overline{abc}, \overline{d}\right\}, \pi_4 = \left\{\bar{a}, \bar{b}, \bar{c}, \bar{d}\right\}$. Let $\prec$ be the partial order on the set of partitions $S' = \{\pi_1,\pi_2,\pi_3,\pi_4\}$ defined as follows: $ \pi_i \prec \pi_j$ if and only if $\pi_i \text{ refines }\pi_j $. The poset diagram for $ (S',\prec)$ is:


Correct Option: C
Explanation:

As $\pi$,$\propto$,$\pi$, only if $\pi$ refines $\pi$

$\pi_1$= {$\overline{abcd}$} refines
$\pi_2$= {$\overline{ab}$,$\overline{cd}$}
$\pi_3$= {$\overline{abc}$,$\overline{d}$}
and these both refines
 $\pi_4$={$\bar{a}\bar{b}\bar{c}\bar{d}$}

+ View questions