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

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

$\lim_{x \to \infty}\frac{x-\sin x}{x+\cos x}$ equals

  1. 1

  2. -1

  3. $\infty$

  4. $-\infty$


Correct Option: A
Explanation:

$\lim_{x \to \infty}\frac{x-\sin x}{x+\cos x}$ = $\lim_{x \to \infty}\frac{1- \dfrac{\sin x}{x}}{1+\dfrac{\cos x}{x}}$

If P, Q, R are subsets of the universal set U, then $(P\cap Q\cap R) \cup (P^c \cap Q \cap R) \cup Q^c \cup R^c$ is

  1. $Q^c \cup R^c$

  2. $P \cup Q^c \cup R^c$

  3. $P^c \cup Q^c \cup R^c$

  4. U


Correct Option: D
Explanation:

P, Q, R are subsets of the universal set U, then $(P\cap Q\cap R) \cup (P^c \cap Q \cap R) \cup Q^c \cup R^c$ is U

The most efficient algorithm for finding the number of connected components in an undirected graph on n vertices and m edges has time complexity

  1. $\Theta(n)$

  2. $\Theta(m)$

  3. $\Theta(m+n)$

  4. $\Theta(mn)$


Correct Option: C
Explanation:

Given f1, f3 and f in canonical sum of products form (in decimal) for the circuit.

$f_1 = \Sigma m(4, 5, 6, 7, 8)$ $f_3 = \Sigma m(1, 6, 15)$ $f = \Sigma m(1, 6, 8, 15)$

Then f2 is

  1. $\Sigma m(4, 6)$

  2. $\Sigma m(4, 8)$

  3. $\Sigma m(6, 8)$

  4. $\Sigma m(4, 6, 8)$


Correct Option: C
Explanation:

In the IEEE floating point representation, the hexadecimal value 0x00000000 corresponds to

  1. the normalized value 2-127

  2. the normalized value +0

  3. the normalized value 2-126

  4. the special value +0


Correct Option: D
Explanation:

Some code optimizations are carried out on the intermediate code because

  1. They enhance the portability of the compiler to other target processors

  2. Program analysis is more accurate on intermediate code than on machine code

  3. The information from dataflow analysis cannot otherwise be used for optimization

  4. The information from the front end cannot otherwise be used for optimization


Correct Option: B
Explanation:

Code optimization are carried out on intermediate code because program analysis is more accurate on immediate code than on machine code.

What is the maximum size of data that the application layer can pass on to the TCP layer below?

  1. Any size

  2. 216 bytes

  3. 216 bytes-size of TCP header

  4. 1500 bytes


Correct Option: B
Explanation:

Which of the following system calls results in the sending of SYN packets?

  1. socket

  2. bind

  3. listen

  4. connect


Correct Option: D
Explanation:

SYN packages are used for synchronization between sender & receiver these packets are sent by sender during connect system call synchronous connection.

Let $r$ denote number system radix. The only value(s) of $r$ that satisfy the equation $\sqrt{121_r}={11}_r$, is/are

  1. decimal 11

  2. any value >2

  3. decimal 10

  4. decimal 10 and 11


Correct Option: B
Explanation:

Which of the following describes a handle (as applicable to LR-parsing) appropriately?

  1. It is the position in a sentential form where the next shift or reduce operation will occur

  2. It is non-terminal whose production will be used for reduction in the next step

  3. It is a production that may be used for reduction in a future step along with a position in the sentential form where the next shift or reduce operation will occur

  4. It is the production p that will be used for reduction in the next step along with a position in the sentential form where the right hand side of the production may be found


Correct Option: D
Explanation:

Handles are the part of sentential form, & they are identified as the right side of any given production which will be used for reduction in the net step.

The Newton-Raphson iteration $x_{n+1} = \frac{1}{2}\left(x_n+\frac{R}{x_n}\right)$ can be used to compute the

  1. square of R

  2. reciprocal of R

  3. square root of R

  4. logarithm of R


Correct Option: C
Explanation:

$x_{n+1} = \frac{1}{2}\left(x_n+\frac{R}{x_n}\right)$ This expression can be used to compute square root of R.

The minimum number of equal length subintervals needed to approximate $\int_1^2 xe^x\,dx$ to an accuracy of at least $\frac{1}{3}\times10^{-6}$ using the trapezoidal rule is

  1. 1000e

  2. 1000

  3. 100e

  4. 100


Correct Option: A
Explanation:

Trapezodial rule is $\int_{x_0}^{x_0 + nh}dx =\dfrac{h}{2}[(y_0 + y_n) + 2(y_1 + y_2 + .... + y_{n-1})]$ $\int_{1}^{2}xe^xdx ]$ = 1000e

Which of the following statements is true for every planar graph on n vertices?

  1. The graph is connected

  2. The graph is Eulerian

  3. The graph has a vertex-cover of size at most 3n/4

  4. The graph has an independent set of size at least n/3


Correct Option: A
Explanation:

A planar Graph can be drawn on the plane in such a way that its edges may intersect only at their end points. Hence each plannar graph is connected on n vertices.

Let $P =\sum_{\substack{1≤i≤2k \\ i\;odd}} i$ and $Q = \sum_{\substack{1≤i≤2k \\ i\;even}} i$, where $k$ is a positive integer. Then

  1. P = Q - K

  2. P = Q + K

  3. P = Q

  4. P = Q + 2K


Correct Option: A
Explanation:

$P =\sum_{\substack{1≤i≤2k \\ i\;odd}} i$ and $Q = \sum_{\substack{1≤i≤2k \\ i\;even}} i$ Where k is positive integer, then P = Q - k

If $P, Q, R$ are Boolean variables, then

$(P + \bar{Q}) (P.\bar{Q} + P.R) (\bar{P}.\bar{R} + \bar{Q})$ simplifies to

  1. $P.\bar{Q}$

  2. $P.\bar{R}$

  3. $P.\bar{Q} + R$

  4. $P.\bar{R} + Q$


Correct Option: A
Explanation:

Aishwarya studies either computer science or mathematics everyday. If she studies computer science on a day, then the probability that the studies mathematics the next day is 0.6. If she studies mathematics on a day, then the probability that the studies computer science the next day is 0.4. Given that Aishwarya studies computer science on Monday, what is the probability that she studies computer science on Wednesday?

  1. 0.24

  2. 0.36

  3. 0.4

  4. 0.6


Correct Option: C
Explanation:

The required probability = 0.4 x 0.4 + 0.6 x 0.4 = 0.16 + 0.24 = 0.40

A point on a curve is said to be an extremum if it is a local minimum or a local maximum. What is the number of distinct extrema for the curve 3x4 − 16x3 + 24x2 + 37?

  1. 0

  2. 1

  3. 2

  4. 3


Correct Option: B
Explanation:

F(x) = 3x4 –16x3 + 24x2 + 37 f1 (x) = 12x3 – 48x2 + 48x Here, f1 (x) = 0 $\Rightarrow$ x3 – 4x2 + 4x = 0 $\Rightarrow$ x(x – 2)2 = 0 $\therefore$ x = 0, 2, 2 

How many of the following matrices have an eigenvalue 1? $\left[\begin{array}{cc}1 & 0 \\ 0 & 0 \end{array} \right]\left[\begin{array}{cc}0 & 1 \\ 0 & 0 \end{array} \right] \left[\begin{array}{cc}1 & -1 \\ 1 & 1 \end{array} \right]$ and $\left[\begin{array}{cc}-1 & 0 \\ 1 & -1 \end{array} \right]$

  1. one

  2. two

  3. three

  4. four


Correct Option: A
Explanation:

x : eigen value x2 - trace (A) + det (A) = 0, $\lambda$= 1 $\left[\begin{array}{cc}1 & 0 \\ 0 & 0 \end{array} \right]$: 1-2 + 1 = 0 $\left[\begin{array}{cc}0 & 1 \\ 0 & 0 \end{array} \right]: 1-0 + 0 \ne 0 $ $ \left[\begin{array}{cc}1 & -1 \\ 1 & 1 \end{array} \right]: 1-2 + 2 \ne 0$ $\left[\begin{array}{cc}-1 & 0 \\ 1 & -1 \end{array} \right]: 1+2 + 1\ne 0 $

$P$ and $Q$ are two propositions. Which of the following logical expressions are equivalent?

I. $P ∨ \neg Q$ ||. $\neg(\neg P ∧ Q)$ |||. $(P ∧ Q) ∨ (P ∧ \neg Q) ∨ (\neg P ∧ \neg Q)$ IV. $(P ∧ Q) ∨ (P ∧ \neg Q) ∨ (\neg P ∧ Q)$

  1. Only I and II

  2. Only I, II and III

  3. Only I, II and IV

  4. All of I, II III and IV


Correct Option: B
Explanation:

$(P ∧ Q) ∨ (P ∧ \neg Q) ∨ (\neg P ∧ \neg Q)$ = $ P ∨ (Q ∧ \neg Q) ∨ (\neg P ∧ \neg Q)$ = $ P ∨ (\neg P ∧ \neg Q)$ = $ ( P ∨ \neg Q) ∧ ( P ∨ \neg Q)$ = $ ( P ∧ Q)$

Let fsa and pda be two predicates such that fsa(x) means x is a finite state automaton, and pda(y) means that y is a pushdown automaton. Let equivalent be another predicate such that equivalent (a, b) means a and b are equivalent. Which of the following first order logic statements represents the following: Each finite state automaton has an equivalent pushdown automaton

  1. $\left(\forall x \text{ fsa}\left(x\right) \right) \implies \left( \exists y \text{ pda}\left(y\right) \wedge \text{equivalent}\left(x,y\right)\right)$

  2. $\neg \forall y \left(\exists x \text{ fsa}\left(x\right) \implies \text{pda}\left(y\right) \wedge \text{equivalent}\left(x,y\right)\right)$

  3. $\forall x \exists y \left(\text{fsa}\left(x\right) \wedge \text{pda}\left(y\right) \wedge \text{equivalent}\left(x,y\right)\right)$

  4. $\forall x \exists y \left(\text{fsa}\left(y\right) \wedge \text{pda}\left(x\right) \wedge \text{equivalent}\left(x,y\right)\right)$


Correct Option: C
Explanation:

$\left(\forall x \text{ fsa}\left(x\right) \right) \implies \left( \exists y \text{ pda}\left(y\right) \wedge \text{equivalent}\left(x,y\right)\right)$ and $\forall x \exists y \left(\text{fsa}\left(x\right) \wedge \text{pda}\left(y\right) \wedge \text{equivalent}\left(x,y\right)\right)$

The minimum number of comparisons required to determine if an integer appears more than $\frac{n}{2}$ times in a sorted array of $n$ integers is

  1. $\Theta(n)$

  2. $\Theta(\log n)$

  3. $\Theta(\log^*n)$

  4. $\Theta(1)$


Correct Option: B
Explanation:

A B-tree of order 4 is built from scratch by 10 successive insertions. What is the maximum number of node splitting operations that may take place?

  1. 3

  2. 4

  3. 5

  4. 6


Correct Option: A
Explanation:

G is a graph on n vertices and 2n-2 edges. The edges of G can be partitioned into two edge-disjoint spanning trees. Which of the following is NOT true for G?

  1. For every subset of k vertices, the induced subgraph has at most 2k-2 edges

  2. The minimum cut in G has at least two edges

  3. There are two edge-disjoint paths between every pair of vertices

  4. There are two vertex-disjoint paths between every pair of vertices


Correct Option: C
Explanation:

Dijkstra's single source shortest path algorithm when run from vertex a in the above graph, computes the correct shortest path distance to

  1. only vertex a

  2. only vertices a, e, f, g, h

  3. only vertices a, b, c, d

  4. all the vertices


Correct Option: D
Explanation:

Consider the following functions: f(n) = 2n g(n) = n! h(n) = nlogn Which of the following statements about the asymptotic behaviour of f(n), g(n), and h(n) is true?

  1. f(n) = O(g(n)); g(n) = O(h(n))

  2. f(n) = $\Omega$(g(n)); g(n) = O (h(n))

  3. g (n) = O(g(n)); h(n) = O(f(n))

  4. h(n) = O(f(n)); g(n) = $\Omega$(f(n))


Correct Option: D
Explanation:

The subset-sum problem is defined as follows: Given a set S of n positive integers and a positive integer W, determine whether there is a subset of S Whose elements sum to W. An algorithm Q solves this problem in O(nW) time. Which of the following statements is false?

  1. Q solves the subset-sum problem in polynomial time when the input is encoded in unary

  2. Q solves the subset-sum problem in polynomial time when the input is encoded in binary

  3. The subset sum problem belongs to the class NP

  4. The subset sum problem is NP-hard


Correct Option: B
Explanation:

The Breadth First Search algorithm has been implemented using the queue data structure. One possible order of visiting the nodes of the following graph is

  1. MNOPQR

  2. NQMPOR

  3. QMNPRO

  4. QMNPOR


Correct Option: C
Explanation:

Which of the following tuple relational calculus expression(s) is/are equivalent to $\forall t \in r \left(P\left(t\right)\right)$?

I. $\neg \exists t \in r \left(P\left(t\right)\right)$ II. $\exists t \notin r \left(P\left(t\right)\right)$ III. $\neg \exists t \in r \left(\neg P\left(t\right)\right)$ IV. $\exists t \notin r \left(\neg P\left(t\right)\right)$

  1. I only

  2. II only

  3. III only

  4. III and IV only


Correct Option: C

In the Karnaugh map shown below, X denotes a don't care term. What is the minimal form of the function represented by the Karnaugh map?

  1. $\bar{b}.\bar{d} + \bar{a}.\bar{d}$

  2. $\bar{a}.\bar{b} + \bar{b}.\bar{d} + \bar{a}.b.\bar{d}$

  3. $\bar{b}.\bar{d} + \bar{a}.b.\bar{d}$

  4. $\bar{a}.\bar{b} + \bar{b}.\bar{d} + \bar{a}.\bar{d}$


Correct Option: A
Explanation:

Consider the Quicksort algorithm. Suppose there is a procedure for finding a pivot element which splits the list into two sub-lists each of which contains at least one-fifth of the elements. Let T(n) be the number of comparisons required to sort n elements. Then

  1. $T(n) \leq 2T(n/5) + n$

  2. $T(n) \leq T(n/5) + T(4n/5) + n$

  3. $T(n) \leq 2T(4n/5) + n$

  4. $T(n) \leq 2T(n/2) + n$


Correct Option: B
Explanation:

You are given the postorder traversal, P, of a binary search tree on the n elements 1, 2,….,n. You have to determine the unique binary search tree that has P as its postorder traversal. What is the time complexity of the most efficient algorithm for doing this?

  1. $\Theta(\log n)$

  2. $\Theta(n)$

  3. $\Theta(n\log n)$

  4. None of the above, as the tree cannot be uniquely determined


Correct Option: B
Explanation:

We have a binary heap on n elements and wish to insert n more elements (not necessarily one after another) into this heap. The total time required for this is

  1. $\Theta(\log n)$

  2. $\Theta(n)$

  3. $\Theta(n\log n)$

  4. $\Theta(n^2)$


Correct Option: D
Explanation:

A client process P needs to make a TCP connection to a server process S. Consider the following situation: the server process S executes a socket (), a bind () and a listen () system call in that order, following which it is preempted. Subsequently, the client process P executes a socket () system call followed by connect () system call to connect to the server process S. The server process has not executed any accept () system call. Which one of the following events could take place?

  1. connect () system call returns successfully

  2. connect () system call blocks

  3. connect () system call returns an error

  4. connect () system call results in a core dump


Correct Option: C
Explanation:

If a class B network on the Internet has a subnet mask of 255.255.248.0, what is the maximum number of hosts per subnet?

  1. 1022

  2. 1023

  3. 2046

  4. 2047


Correct Option: C
Explanation:

An LALR(1) parser for a grammar G can have shift-reduce (S-R) conflicts if and only if

  1. The SLR(1) parser for G has S-R conflicts

  2. The LR(1) parser for G has S-R conflicts

  3. The LR(0) parser for G has S-R conflicts

  4. The LALR(1) parser for G has reduce-reduce conflicts


Correct Option: B
Explanation:

In the slow start phase of the TCP congestion control algorithm, the size of the congestion window

  1. does not increase

  2. increases linearly

  3. increases quadratically

  4. increases exponentially


Correct Option: D
Explanation:

A computer on a 10Mbps network is regulated by a token bucket. The token bucket is filled at a rate of 2Mbps. It is initially filled to capacity with 16Megabits. What is the maximum duration for which the computer can transmit at the full 10Mbps?

  1. 1.6 seconds

  2. 2 seconds

  3. 5 seconds

  4. 8 seconds


Correct Option: B
Explanation:

Which of the following are true? I. A programming language which does not permit global variables of any kind and has no nesting of procedures/functions, but permits recursion can be implemented with static storage allocation II. Multi-level access link (or display) arrangement is needed to arrange activation records only if the programming language being implemented has nesting of procedures/functions III. Recursion in programming languages cannot be implemented with dynamic storage allocation IV. Nesting procedures/functions and recursion require a dynamic heap allocation scheme and cannot be implemented with a stack-based allocation scheme for activation records V. Programming languages which permit a function to return a function as its result cannot be implemented with a stack-based storage allocation scheme for activation records

  1. II and V only

  2. I, III and IV only

  3. I, II and V only

  4. II, III and V only


Correct Option: A
Explanation:

Which of the following statements about synchronous and asynchronous I/O is NOT true?

  1. An ISR is invoked on completion of I/O in synchronous I/O but not in asynchronous I/O

  2. In both synchronous and asynchronous I/O, an ISR (Interrupt Service Routine) is invoked after completion of the I/O

  3. A process making a synchronous I/O call waits until I/O is complete, but a process making an asynchronous I/O call does not wait for completion of the I/O

  4. In the case of synchronous I/O, the process waiting for the completion of I/O is woken up by the ISR that is invoked after the completion of I/O


Correct Option: B
Explanation:

Which of the following is NOT true for deadlock prevention and deadlock avoidance schemes?

  1. In deadlock prevention, the request for resources is always granted if the resulting state is safe.

  2. In deadlock avoidance, the request for resources is always granted if the result state is safe.

  3. Deadlock avoidance is less restrictive than deadlock prevention.

  4. Deadlock avoidance requires knowledge of resources having a priority.


Correct Option: C
Explanation:

A process executes the following code for (i = 0; i < n; i++) for (); The total number of child processes created is

  1. n

  2. 2n −1

  3. 2n

  4. 2n+1 -1


Correct Option: B
Explanation:

The P and V operations on counting semaphores, where s is a counting semaphore, are defined as follows: P(s) : s = s - 1; ifs < 0 then wait; V(s) : s = s + 1; ifs <= 0 then wakeup a process waiting on s;

Assume that Pb and Vb the wait and signal operations on binary semaphores are provided. Two binary semaphores xb and yb are used to implement the semaphore operations P(s) and V(s) as follows: P(s) : Pb(Xb); s = s - 1; if (s < 0) { Vb(Xb) ; Pb(Yb) ; } else Vb(Xb);V(s) : Pb(Xb) ; s = s + 1; if (s <= 0) Vb(Yb) ; Vb(Xb) ;

The initial values of xb and yb are respectively

  1. 0 and 0

  2. 0 and 1

  3. 1 and 0

  4. 1 and 1


Correct Option: C
Explanation:

Consider the following C functions: int f1 (int n) { If(n == 0 | |n == 1) return n; else return(2*f1(n-1) + 3* f1(n-2)); } int f2 (int n) { int i; int X[N], Y[N], Z[N]; X[0] = Y[0] = Z[0] = 0; X[1] = 1; Y[1] = 2; Z[1] = 3; for(i = 2; i<=n; i++) { X[i] = Y[i-1] + Z [i-2]; Y[i] = 2*X [i]; Z[i] = 3*X[i]; } Return X[n]; }

f1 (8) and f2 (8) return the values

  1. 1661 and 1640

  2. 1640 and 1640

  3. 59 and 59

  4. 1640 and 1661


Correct Option: B
Explanation:

A processor uses 36 bit physical addresses and 32 bit virtual addresses, with a page frame size of 4 Kbytes. Each page table entry is of size 4 bytes. A three level page table is used for virtual to physical address translation, where the virtual address is used as follows:

Bits 30-31 are used to index into the first level page table Bits 21-29 are used to index into the second level page table Bits 12-20 are used to index into the third level page table, and Bits 0-11 are used as offset within the page

The number of bits required for addressing the next level page table (or page frame) in the page table entry of the first, second and third level page tables are respectively

  1. 20, 20 and 20

  2. 24, 24 and 24

  3. 24, 24 and 20

  4. 25, 25 and 24


Correct Option: B
Explanation:

Let xn denote the number of binary strings of length n that contain no consecutive 0s.

Which of the following recurrences does xn satisfy?

  1. xn = 2xn − 1

  2. xn = x[n/2] + 1

  3. xn = x[n/2] + n

  4. xn = xn - 1 + xn - 2


Correct Option: D

Consider the following C functions: int f1 (int n) { If(n == 0 | |n == 1) return n; else return(2*f1(n-1) + 3* f1(n-2)); } int f2 (int n) { int i; int X[N], Y[N], Z[N]; X[0] = Y[0] = Z[0] = 0; X[1] = 1; Y[1] = 2; Z[1] = 3; for(i = 2; i<=n; i++) { X[i] = Y[i-1] + Z [i-2]; Y[i] = 2*X [i]; Z[i] = 3*X[i]; } Return X[n]; }

The running time of f1 (n) and f2 (n) are

  1. $\odot$(n) and $\odot$(n)

  2. $\odot$(2n) and $\odot$(n)

  3. $\odot$(n) and $\odot$(2n)

  4. $\odot$(2n) and $\odot$ (2n)


Correct Option: B
Explanation:

The subset-sum problem is defined as follows. Given a set of n positive integers, S = {a1, a2, a3, …, an}, and positive integer W, is there a subset of S whose elements sum to W? A dynamic program for solving this problem uses a 2-dimensional Boolean array, X, with n rows and W+1 columns. X [i, j], 1$\le$i $\le$ n,0 $\le$j $\le$ W, is TRUE if and only if there is a subset of {a1, a2, …, a} whose elements sum to j.

Which entry of the array X, if TRUE, implies that there is a subset whose elements sum to W?

  1. X[1, W]

  2. X[n, 0]

  3. X[n, W]

  4. X[n - 1, n]


Correct Option: C
Explanation:

Let xn denote the number of binary strings of length n that contain no consecutive 0s.

The value of x5 is

  1. 5

  2. 7

  3. 8

  4. 16


Correct Option: D
Explanation:

xn = xn-1 + xn-2 x5 = x4 + x3 = 8 + 5 = 13

Consider the following C program that attempts to locate an element x in an array Y[ ] using binary search. The program is erroneous.

  1. f(int Y[10], int x) {
  2. int u, j, k;
  3. i = 0; j = 9;
  4. do {
  5. k = (i + j)/2;
  6. if (Y[k] ! = x) && (i < j);
  7. } while ((Y[k] ! = x) && (i < j));
  8. if (Y[k] == x) print f(“x is in the array”);
  9. else print f(“x is not in the array”);
  10. }

On which of the following contents of Y and x does the program fail?

  1. Y is [1 2 3 4 5 6 7 8 9 10] and x <10

  2. Y is [1 3 5 7 9 11 13 15 17 19] and x < 1

  3. Y is [2 2 2 2 2 2 2 2 2 2] and x > 2

  4. Y is [2 4 6 8 10 12 14 16 18 20] and 2 < x < 20 and x is even


Correct Option: C
Explanation:

Consider the following C program that attempts to locate an element x in an array Y[ ] using binary search. The program is erroneous.

  1. f(int Y[10], int x) {
  2. int u, j, k;
  3. i = 0; j = 9;
  4. do {
  5. k = (i + j)/2;
  6. if (Y[k] ! = x) && (i < j);
  7. } while ((Y[k] ! = x) && (i < j));
  8. if (Y[k] == x) print f(“x is in the array”);
  9. else print f(“x is not in the array”);
  10. }

The correction needed in the program to make it work properly is

  1. Change line 6 to : if Y[k] < x) i = k + 1; else j = k - 1;

  2. Change line 6 to : if Y[k] < x) i = k - 1; else j = k + 1;

  3. Change line 6 to : if Y[k] <= x) i = k; else j = k;

  4. Change line 7 to:} while ((Y[K] ==x) && (i < j));


Correct Option: A
Explanation:

The subset-sum problem is defined as follows. Given a set of n positive integers, S = {a1, a2, a3, …, an}, and positive integer W, is there a subset of S whose elements sum to W? A dynamic program for solving this problem uses a 2-dimensional Boolean array, X, with n rows and W+1 columns. X [i, j], 1$\le$i $\ge$ n,0 $\le$j $\le$ W, is TRUE if and only if there is a subset of {a1, a2, …, a} whose elements sum to j.

Which of the following is valid for 2 $\le$ i $\le$ n and ai $\le$ j $\le$ W?

  1. X[i, j] = X[i - 1, j] vX [i, j - ai]

  2. X[i, j] = X[i - 1, j] vX [i, 1, j - ai]

  3. X[i, j] = X[i - 1, j] $\land$X [i, j - ai]

  4. X[i, j] = X[i - 1, j] $\land$X [i-1, j - ai]


Correct Option: B
Explanation:

For a magnetic disk with concentric circular tracks, the seek latency is not linearly proportional to the seek distance due to

  1. non-uniform distribution of requests

  2. arm starting and stopping inertia

  3. higher capacity of tracks on the periphery of the platter

  4. use of unfair arm scheduling policies


Correct Option: C
Explanation:

The use of multiple register windows with overlap causes a reduction in the number of memory accesses for I. Function locals and parameters II. Register saves and restores III. Instruction fetches

  1. I only

  2. II only

  3. III only

  4. I, II and III


Correct Option: C
Explanation:

Multiple register windows with overlap causes a reduction in the number of memory accesses for instruction fetching .

Which of the following are NOT true in a pipelined processor? I. Bypassing can handle all RAW hazards II. Register renaming can eliminate all register carried WAR hazards III. Control hazard penalties can be eliminated by dynamic branch prediction

  1. I and II only

  2. I and III only

  3. II and III only

  4. I, II and III


Correct Option: D
Explanation:

Which of the following must be true for the RFE (Return From Exception) instruction on a general purpose processor? I. It must be a trap instruction II. It must be a privileged instruction III. An exception cannot be allowed to occur during execution of an RFE instruction

  1. I only

  2. II only

  3. I and II only

  4. I, II and III only


Correct Option: D
Explanation:

For inclusion to hold between two cache levels L1 and L2 in a multi-level cache hierarchy, which of the following are necessary? I. L1 must be a write-through cache II. L2 must be a write-through cache III. The associativity of L2 must be greater than that of L1 IV. The L2 cache must be at least as large as the L1 cache

  1. IV only

  2. I and IV only

  3. I, II and IV only

  4. I, II, III and IV


Correct Option: A
Explanation:

In an instruction execution pipeline, the earliest that the data TLB (Translation Look a side Buffer) can be accessed is

  1. Before effective address calculation has started

  2. During effective address calculation

  3. After effective address calculation has completed

  4. After data cache lookup has completed


Correct Option: B
Explanation:

TLB is used during effective address calculation in an instruction execution pipeline.

Which of the following is/are true of the auto-increment addressing mode? I. It is useful in creating self-relocating code II. If it is included in an Instruction Set Architecture, then an additional ALU is required for effective address calculation III. The amount of increment depends on the size of the data item accessed

  1. I only

  2. II only

  3. III only

  4. II and III only


Correct Option: C
Explanation:

Consider a machine with a 2-way set associative data cache of size 64Kbytes and block size 16bytes. The cache is managed using 32 bit virtual addresses and the page size is 4Kbyts. A program to be run on this machine begins as follows: double ARR[1024] [1024]; int i, j; /* Initialize array ARR to 0.0 */ for (i = 0; i < 1024; i++) for (j = 0; j < 1024; j++) ARR[i] [j] = 0.0; The size of double is 8Bytes. Array ARR is located in memory starting at the beginning of virtual page 0xFF000 and stored in row major order. The cache is initially empty and no pre-fetching is done. The only data memory references made by the program are those to array ARR

The total size of the tags in the cache directory is

  1. 32 K bits

  2. 34 K bits

  3. 64 K bits

  4. 68 K bits


Correct Option: B
Explanation:

Delayed branching can help in the handling of control hazards

For all delayed conditional branch instructions, irrespective of whether the condition evaluates to true or false

  1. The instruction following the conditional branch instruction in memory is executed

  2. The first instruction in the fall through path is executed

  3. The first instruction in the taken path is executed

  4. The branch takes longer to execute than any other instruction


Correct Option: B
Explanation:

Consider a machine with a 2-way set associative data cache of size 64Kbytes and block size 16bytes. The cache is managed using 32 bit virtual addresses and the page size is 4Kbyts. A program to be run on this machine begins as follows: double ARR[1024] [1024]; int i, j; /* Initialize array ARR to 0.0 */ for (i = 0; i < 1024; i++) for (j = 0; j < 1024; j++) ARR[i] [j] = 0.0; The size of double is 8Bytes. Array ARR is located in memory starting at the beginning of virtual page 0xFF000 and stored in row major order. The cache is initially empty and no pre-fetching is done. The only data memory references made by the program are those to array ARR

The cache hit ratio for this initialization loop is

  1. 0%

  2. 25%

  3. 50%

  4. 75%


Correct Option: C
Explanation:

Consider a machine with a 2-way set associative data cache of size 64Kbytes and block size 16bytes. The cache is managed using 32 bit virtual addresses and the page size is 4Kbyts. A program to be run on this machine begins as follows: double ARR[1024] [1024]; int i, j; /* Initialize array ARR to 0.0 */ for (i = 0; i < 1024; i++) for (j = 0; j < 1024; j++) ARR[i] [j] = 0.0; The size of double is 8Bytes. Array ARR is located in memory starting at the beginning of virtual page 0xFF000 and stored in row major order. The cache is initially empty and no pre-fetching is done. The only data memory references made by the program are those to array ARR

Which of the following array elements has the same cache index as ARR [0] [0]?

  1. ARR [0] [4]

  2. ARR [4] [0]

  3. ARR [0] [5]

  4. ARR [5] [0]


Correct Option: B
Explanation:

Delayed branching can help in the handling of control hazards

The following code is to run on a pipelined processor with one branch delay slot: 11 : ADD R2 $\leftarrow$ R7 + R8 12 : SUB R4 $\leftarrow$ R5 – R6 13 : ADD R1 $\leftarrow$ R2 + R3 14 : STORE Memory [R4] $\leftarrow$ R1 BRANCH to Label if R1 == 0 Which of the instructions 11, 12, 13 or 14 can legitimately occupy the delay slot without any other program modification?

  1. 11

  2. 12

  3. 13

  4. 14


Correct Option: B
Explanation:

Which combination of the integer variables x, y and z makes the variable a get the value 4 in the following expression? a = (x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z)

  1. x = 3, y = 4, z = 2

  2. x = 6, y = 5, z = 3

  3. x = 6, y = 3, z = 5

  4. x = 5, y = 4, z = 5


Correct Option: A
Explanation:

Choose the correct option to fill ?1 and ?2 so that the program below prints an input string in reverse order. Assume that the input string is terminated by a new line character.

void reverse(void)  {
    int c;
    if(?1) reverse();
    ?2
}
main()  {
    printf("Enter text"); ptintf("\n");
    reverse(); printf("\n");
}
  1. ?1 is (getchar() ! = '\n') ?2 is getchar(c);

  2. ?1 is (c = getchar()) ! = '\n') ? 2 is getchar (c);

  3. ?1 is (c! = '\n') ?2 is putchar(c);

  4. ?1 is ((c = getchar) )) ! = '\n') ?2 is putchar (c);


Correct Option: D
Explanation:

The following C function takes a single-linked list of integers as a parameter and rearranges the elements of the list. The function is called with the list containing the integers 1,2,3,4,5,6,7 in the given order. What will be the contents of the list after the function completes execution?

struct node {
  int value;
  struct node * next;
};
Void rearrange struct node * list {
  struct node * p, * q;
  int temp;
  if (!list || !!list - &gt; next) return;
  p = list; | q = list - &gt; next;
  while q {
    temp = p - &gt; value;
    p - &gt; value = q - &gt; value;
    q - &gt; value = temp;
    p = q - &gt; next;
    q = p ? p - &gt; next : 0;
  }
}
  1. 1,2,3, 4,5, 6, 7

  2. 2,1, 4,3, 6,5, 7

  3. 1,3, 2,5, 4, 7, 6

  4. 2, 3, 4,5, 6, 7,1


Correct Option: B
Explanation:

What is printed by the following C program?

int f(int x, int  py, int  **ppz) void main() {
 {
  Int y, z;
  int c, * b, * * a; * * ppz + = 1;
  z = * ppz c = 4;
  b = &amp;c;
  a = &amp;b; 
 *py + = 2;
  y = *py;
  printf(“ % d”, f(c, b, a));
  x + = 3;
 }
 return x + y + z;
}
  1. 18

  2. 19

  3. 21

  4. 22


Correct Option: B
Explanation:

A clustering index is defined on the fields which are of the type

  1. non-key and ordering

  2. key and ordering

  3. non-key and non-ordering

  4. key and non-ordering


Correct Option: A
Explanation:

Consider the following E-R diagram

The minimum number of tables needed to represent M, N, P, R1, R2 is

  1. 2

  2. 3

  3. 4

  4. 5


Correct Option: B
Explanation:

Consider a file of 16384 records. Each record is 32 bytes long and its key field is of size 6 bytes. The file is ordered on a non-key field and the file organisation is unspanned. The file is stored in a file system with block size 1024 bytes and the size of a block pointer is 10 bytes. If the secondary index is built on the key field of the file and a multi-level index scheme is used to store the secondary index, then the numbers of first-level and second-level blocks in the multi-level index are respectively

  1. 8 and 0

  2. 128 and 6

  3. 256 and 4

  4. 512 and 5


Correct Option: C
Explanation:

Let R and S be two relations with the following schema R (P, Q, R1, R2, R3) S(P, Q, S1, S2) Where {P, Q} is the key for both schemas. Which of the following queries are equivalent?

I. $\Pi_P \left(R \bowtie S\right)$ II. $\Pi_P \left(R\right) \bowtie \Pi_P\left(S\right)$ III. $\Pi_P \left(\Pi_{P, Q} \left(R\right) \cap \Pi_{P,Q} \left(S\right) \right)$ IV. $\Pi_P \left(\Pi_{P, Q} \left(R\right) - \left(\Pi_{P,Q} \left(R\right) - \Pi_{P,Q} \left(S\right)\right)\right)$

  1. Only I and II

  2. Only I and III

  3. Only I, II and III

  4. Only I, III and IV


Correct Option: C
Explanation:

Consider the following relational schemes for a library database: Book Title, Author, Catalog_ no, Publisher, Year, Pr ice Collection Title, Author, Catalog_ no within the functional dependencies: I. Title Author $\rightarrow$ Catalog_no II. Catalog_no $\rightarrow$ Title Author Publisher Year III. Publisher Title Year $\rightarrow$ Pr ice

Assume {Author, Title} is the key for both schemes. Which of the following statements is true?

  1. Both Book and Collection are in BCNF

  2. Both Book and Collection are in 3NF only

  3. Book is in 2NF and Collection is in 3NF

  4. Both Book and Collection are in 2NF only


Correct Option: C
Explanation:

Consider the following E-R diagram

Which of the following is a correct attribute set for one of the tables for the correct answer to the above question?

  1. {M1, M2, M3, P1}

  2. {M1, P1, N1, N2}

  3. {M1, P1, N1}

  4. {M1, P1}


Correct Option: A
Explanation:

Which of the following statements is false?

  1. Every NFA can be converted to an equivalent DFA

  2. Every non-deterministic Turing machine can be converted to an equivalent deterministic Turing machine

  3. Every regular language is also a context-free language

  4. Every subset of a recursively enumerable set is recursive


Correct Option: D
Explanation:

(1) true since NFA $\rightarrow$DFA conversion possible. (2) N.D turing M/C so true. (3) every rex is a CFL but reverse is not true. (4) false, since these may be proper subset of each other so not necessary

Which of the following is true for the language $\left\{ a^p \text{ | p is a prime} \right\} $?

  1. It is not accepted by a Turing Machine

  2. It is regular but not context-free

  3. It is context-free but not regular

  4. It is neither regular nor context-free, but accepted by a Turing machine


Correct Option: D
Explanation:

Which of the following are decidable? I. Whether the intersection of two regular languages is infinite II. Whether a given context-free language is regular III. Whether two push-down automata accept the same language IV. Whether a given grammar is context-free

  1. I and II

  2. I and IV

  3. II and III

  4. II and IV


Correct Option: B
Explanation:

If L and $\bar L$ are recursively enumerable then L is

  1. regular

  2. context-sensitive

  3. context-free

  4. recursive


Correct Option: D
Explanation:

            

Which of the following are regular sets?

I. $\left\{a^nb^{2m} \mid n \geq 0, m \geq 0 \right\}$ II. $\left\{a^nb^m \mid n =2m \right\}$ III. $\left\{a^nb^m \mid n \neq m \right\}$ IV. $ \left\{xcy \mid x, y, \in \left\{a, b\right\} ^* \right\} $

  1. I and IV only

  2. I and III only

  3. I only

  4. IV only


Correct Option: A
Explanation:

Which of the following statements are true?

I. Every left-recursive grammar can be converted to a right-recursive grammar and vice-versa II. All $\epsilon$ productions can be removed from any context-free grammar by suitable transformations III. The language generated by a context-free grammar all of whose productions are of the form X --> w or X --> wY (where, w is a string of terminals and Y is a non-terminal), is always regular IV. The derivation trees of strings generated by a context-free grammar in Chomsky Normal Form are always binary trees

  1. I, II, III and IV

  2. II, III and IV only

  3. I, III and IV only

  4. I, II and IV only


Correct Option: C
Explanation:

Match the following NFAs with the regular expressions they correspond to

NFA Diagram GATE 2008

  1. $\epsilon + 0\left(01^1+00\right)^*01^$
  2. $\epsilon + 0\left(10^*1+00\right)^*0$
  3. $\epsilon + 0\left(10^*1+10\right)^*1$
  4. $\epsilon + 0\left(10^1+10\right)^*10^$
  1. P −2, Q −1, R −3, S −4

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

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

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


Correct Option: C
Explanation:

Match the following:

E. Checking that identifiers are declared before their use P. $L : = : \left\{a^nb^mc^nd^m \mid n: \geq1, m \geq 1\right\}$
F. Number of formal parameters in the declaration of a function agrees with the number of actual parameters in a use of that function Q. $X: \rightarrow XbX \mid XcX \mid dXf \mid g$
G. Arithmetic expressions with matched pairs of parentheses R. $L: = \left\{wcw\mid w : \in \left(a\mid b\right)^* \right\}$
H. Palindromes S. $X : \rightarrow : bXb \mid :cXc : \mid \epsilon $
  1. E −P, F −R, G −Q, H −S

  2. E −R, F −P, G −S, H −Q

  3. E −R, F −P, G −Q, H −S

  4. E −P, F −R, G −S, H −Q


Correct Option: C
Explanation:

Given below are two finite state automata (→ indicates the start state and F indicates a final state)

Y: | | a | b | |-----------------|---|---| | $\rightarrow$ 1 | 1 | 2 | | 2(F) | 2 | 1 |

Z: | | a | b | |-----------------|---|---| | $\rightarrow$ 1 | 2 | 2 | | 2(F) | 1 | 1 |

Which of the following represents the product automaton Z × Y?

  1. a b
    $\rightarrow$ P S R
    Q R S
    R(F) Q P
    S Q P
  2. a b
    $\rightarrow$ P S Q
    Q R S
    R(F) Q P
    S P Q
  3. a b
    $\rightarrow$ P Q S
    Q R S
    R(F) Q P
    S Q P
  4. a b
    $\rightarrow$ P S Q
    Q S R
    R(F) Q P
    S Q P

Correct Option: A
Explanation:

The following system of equations $$x_1 + x_2 + 2x_3 = 1$$ $$x_1 + 2x_2 + 3x_3 = 2$$ $$x_1 + 4x_2 + αx_3 = 4$$ has a unique solution. The only possible value(s) for α is/are

  1. 0

  2. either 0 or 1

  3. one of 0, 1 or -1

  4. any real number


Correct Option: C
Explanation:

One of 0, 1 or -1, the system will have unique solution. If det A $\ne$0, where A = det A $\ne$ 0 $\Rightarrow$$\alpha$-5 $\ne$0 Since, $\alpha$-5 $\ne$5 Hence $\alpha$ could be any real number except 5.

Let $X$ be a random variable following normal distribution with mean $+1$ and variance $4$. Let $Y$ be another normal variable with mean $-1$ and variance unknown. If $P (X ≤ -1) = P (Y ≥ 2)$ , the standard deviation of $Y$ is

  1. 3

  2. 2

  3. $\sqrt{2}$

  4. 1


Correct Option: A
Explanation:

X (1,4),4(-1,$\sigma^2$) P(x $\le$-1) Z = $\dfrac{-1-1}{2}$ = -1 = P (Z $\le$ -1) = P (Z $\ge$1) = 0.5 - P (0<z<1) = 0.1587 If $\sigma$= 3 then P(Z $\ge$ 2), Z = $\dfrac{2+1}{3}$= 1 = P (Z $\ge$1) = 0.1587

The data blocks of a very large file in the Unix file system are allocated using

  1. contiguous allocation

  2. linked allocation

  3. indexed allocation

  4. an extension of indexed allocation


Correct Option: D
Explanation:

Generally a large file system for UNIX OS use indexed allocation but for very large systems an extension of indexed allocation i.e ext 2, ext . are used.

- Hide questions