Question 1 |

Which of the following is TRUE?P.f(x) is continuous for all real values of xQ.f(x) is differentiable for all real values of x

P is true and Q is false. | |

P is false and Qis true. | |

Both P and Q are true | |

Both P and Q are false. |

**Numerical Methods and Calculus**

**GATE-CS-2007**

**Discuss it**

But, the given function is not differentiable for x = 0 because for x < 0, the derivative is negative and for x > 0, the derivative is positive. So, the left hand derivative and right hand derivative do not match.

Hence, P is correct and Q is incorrect. Thus, A is the correct option.

Please comment below if you find anything wrong in the above post.

Question 2 |

n and n | |

n ^{2} and n | |

n ^{2} and 0 | |

n and 1 |

**Set Theory & Algebra**

**GATE-CS-2007**

**Discuss it**

Consider an example set, S = (1,2,3) Equivalence property follows, reflexive, symmetric and transitive Largest ordered set are s x s = { (1,1) (1,2) (1,3) (2,1) (2,2) (2,3) (3,1) (3,2) (3,3) } which are 9 which equal to 3^2 = n^2 Smallest ordered set are { (1,1) (2,2) ( 3,3)} which are 3 and equals to n. number of elements.

Question 3 |

n ^{2 } | |

2 ^{n} | |

2 ^{2n} | |

2 ^{n2} |

**Combinatorics**

**GATE-CS-2007**

**Discuss it**

No of inputs sequences possible for a n variable Boolean function = 2^{n}Each input sequence can give either T or F as output ( 2 possible values ) So, Total no of Boolean functions are - 2X2X2X2X2X2X.............X2X2X2X2X2X2 <-------------------- 2^{n}Times --------------> 2^{2n}

Question 4 |

9 edges and 5 vertices | |

9 edges and 6 vertices | |

10 edges and 5 vertices | |

10 edges and 6 vertices |

**Graph Theory**

**GATE-CS-2007**

**Discuss it**

**Alternate Explanation:**We know that K5K5 (which has 10 edges and 5 vertices) and K3,3K3,3 (which has 9 edges and 6 vertices) are non-planar graphs. Since we are asked about minimum number of edges, answer should be k3,3k3,3 i.e. option

**(B)**is correct. Source: http://www.cse.iitd.ac.in/~mittal/gate/gate_math_2007.html

Question 5 |

1 2 3 4 5 6 | |

1 3 2 4 5 6 | |

1 3 2 4 6 5 | |

3 2 4 1 6 5 |

**Graph Traversals**

**GATE-CS-2007**

**Discuss it**

**Parul sharma.**

Question 6 |

Membership problem for CFGs | |

Ambiguity problem for CFGs. | |

Finiteness problem for FSAs. | |

Equivalence problem for FSAs. |

**Undecidability**

**GATE-CS-2007**

**Discuss it**

A set is closed under an operation means when we operate an element of that set with that operator we get an element from that set.

Here, CFG generates a CFL and set of all CFLs is the set. But ambiguity is not an operation and hence we can never say that CFG is closed under such operation.

Only ambiguity problem for CFGs are undecidable.

Thus, option (B) is correct.

Please comment below if you find anything wrong in the above post.

Question 7 |

Every subset of a regular set is regular. | |

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

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

Infinite union of finite sets is regular. |

**Regular languages and finite automata**

**GATE-CS-2007**

**Discuss it**

- A set is always regular if it is finite.
- A set is always regular if a DFA/NFA can be drawn for it.

**Option A:**Every subset of a regular set is regular is False. For input alphabets a and b, a*b* is regular. A DFA can be drawn for a*b* but a n b n for n≥0 which is a subset of a*b* is not regular as we cannot define a DFA for it.

**Option B:**Every finite subset of a non-regular set is regular is True. Each and every set which is finite can have a well-defined DFA for it so whether it is a subset of a regular set or non-regular set it is always regular.

**Option C:**The union of two non-regular sets is not regular is False. For input alphabets a and b, a

^{n}b

^{n}for all n≥0 is non-regular as well as a

^{n}b

^{m}for n≠m is also non- regular but their union is a*b* which is regular.

**Option D:**TInfinite union of finite sets is regular is False. For input alphabets a and b sets {ab}, {aabb}, {aaabbb}…….. are regular but their union {ab} U {aabb} U {aaabbb} U …………………….. gives {a n b n for n>0} which is not regular.

This solution is contributed by

**Yashika Arora**.

Question 8 |

7 | |

8 | |

9 | |

10 |

**Digital Logic & Number representation**

**GATE-CS-2007**

**Discuss it**

Question 9 |

independent of one variables. | |

independent of two variables. | |

independent of three variables. | |

dependent on all the variables. |

**Digital Logic & Number representation**

**GATE-CS-2007**

**Discuss it**

Question 10 |

9,6,5 | |

7, 7, 6 | |

7, 5, 8 | |

9, 5, 6 |

**Computer Organization and Architecture**

**GATE-CS-2007**

**Discuss it**

Here the number of sets = 128/4 = 32 (as it is 4 say set associative) We have total 64 words then we need 6 bits to identify the word So the line offset is 5 bits and the word offset is 6 bits and the TAG = 20-(5+6) =9 bits so it should be 9,5,6

Question 11 |

256 Mbyte, 19 bits | |

256 Mbyte, 28 bits | |

512 Mbyte, 20 bits | |

64 Gbyte, 28 bit |

**Input Output Systems**

**GATE-CS-2007**

**Discuss it**

Question 12 |

2 ^{h}−1 | |

2 ^{h−1} -1 | |

2 ^{h+1}-1 | |

2 ^{h+1} |

**Binary Trees**

**GATE-CS-2007**

**Discuss it**

Question 13 |

1 | |

5 | |

4 | |

3 |

**GATE-CS-2007**

**Discuss it**

Question 14 |

Merge sort | |

Bubble Sort | |

Quick Sort | |

Selection Sort |

**GATE-CS-2007**

**Discuss it**

Question 15 |

int j, n; j = 1; while (j <= n) j = j*2;The number of comparisons made in the execution of the loop for any n > 0 is: Base of Log is 2 in all options.

CEIL(logn) + 2 | |

n | |

CEIL(logn) | |

FLOOR(logn) + 2 |

**Analysis of Algorithms**

**GATE-CS-2007**

**Discuss it**

We can see it by taking few examples like n = 1, n = 3, etc. For example, for n=5 we have the following (4) comparisons: ------------------------ 1 <= 5 (T) 2 <= 5 (T) 4 <= 5 (T) 8 <= 5 (F) ------------------------ CEIL(log_2 n)+2 = CEIL(log_2 5) + 2 = CEIL(2.3) + 2 = 3 + 2 = 5

Question 16 |

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

P – 3 Q – 2 R – 1 | |

P – 1 Q – 2 R – 3 | |

P – 2 Q – 3 R – 1 | |

P – 1 Q – 3 R – 2 |

**GATE-CS-2007**

**CPU Scheduling**

**Discuss it**

Question 17 |

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

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

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

Blocking one kernel level thread blocks all related threads. |

**Process Management**

**GATE-CS-2007**

**Discuss it**

**Nitika Bansal**

Question 18 |

Recursive descent parser. | |

Operator precedence parser. | |

An LR(k) parser. | |

An LALR(k) parser |

**Parsing and Syntax directed translation**

**GATE-CS-2007**

**Discuss it**

Question 19 |

Half the baud rate. | |

Twice the baud rate. | |

Same as the baud rate. | |

None of the above |

**Data Link Layer**

**GATE-CS-2007**

**Discuss it**

Question 20 |

HTTP | |

Telnet | |

DNS | |

SMTP |

**Transport Layer**

**GATE-CS-2007**

**Discuss it**

**Shashank Shanker khare**//.............// DNS uses UDP. HTTP, Telnet and SMTP uses TCP. Thus, C is the correct choice.

Please comment below if you find anything wrong in the above post.

Question 21 |

2 | |

3 | |

4 | |

5 |

**Set Theory & Algebra**

**GATE-CS-2007**

**Discuss it**

2 can be written as 2 power 2. Number of partitioning of 2 = no. of non isomorphic abelian groups 2 can be partitioned as {(2),(1,1)}

Question 22 |

A | |

B | |

C | |

D |

**Propositional and First Order Logic.**

**GATE-CS-2007**

**Discuss it**

Question 23 |

Any k-regular graph where kis an even number. | |

A complete graph on 90 vertices | |

The complement of a cycle on 25 vertices | |

None of the above |

**Graph Theory**

**GATE-CS-2007**

**Discuss it**

**A) Any k-regular graph where k is an even number**. is not Eulerian as a k regular graph may not be connected (property b is true, but a may not)

**B) A complete graph on 90 vertices**is not Eulerian because all vertices have degree as 89 (property b is false)

**C) The complement of a cycle on 25 vertices**is Eulerian. In a cycle of 25 vertices, all vertices have degree as 2. In complement graph, all vertices would have degree as 22 and graph would be connected.

Question 24 |

1/2 | |

1/10 | |

9!/10! | |

Node of the above |

**Probability**

**GATE-CS-2007**

**Discuss it**

Question 25 |

[A I] [I A]where I is the 4 x 4 identity matrix?

-5 | |

-7 | |

2 | |

1 |

**GATE-CS-2007**

**Discuss it**

We find the eigenvalues of given matrix by solving its characteristic equation :

|(A – x I)

^{2}– I

^{2}| = 0 |(A – (x – 1) I) * (A – (x + 1) I)| = 0 |(A – (x – 1) I)| * |(A – (x + 1) I)| = 0 So, |(A – (x – 1) I)| = 0 or |(A – (x + 1) I)| = 0

Let y be eigenvalues of A, then |(A – y I)| = 0 .

So, by comparing equations we get, either x – 1 = y or x + 1 = y

Therefore , x = y + 1 or x = y – 1

y = -5, -4, 1, 4 (given)

So, x = −4, −1, 2, 5, −6, −3, 0, 3

Thus, option (C) is the answer.

Please comment below if you find anything wrong in the above post.

Question 27 |

A | |

B | |

C | |

D |

**Set Theory & Algebra**

**GATE-CS-2007**

**Discuss it**

Question 28 |

_{n+1}= X

_{n}/2 + 9/(8 X

_{n}), X

_{0}= 0.5 obtained from the Newton-Raphson method. The series converges to

1.5 | |

sqrt(2) | |

1.6 | |

1.4 |

**Numerical Methods and Calculus**

**GATE-CS-2007**

**Discuss it**

As per Newton Rapson's Method, XSo clearly f(X) = 4X_{n+1}= X_{n}− f(X_{n})/f′(X_{n}) Here above equation is given in the below form X_{n+1}= X_{n}/2 + 9/(8 X_{n}) Let us try to convert in Newton Rapson's form by putting X_{n}as first part. X_{n+1}= X_{n}- X_{n}/2 + 9/(8 X_{n}) = X_{n}- (4*X_{n}^{2}- 9)/(8*X_{n}) So f(X) = (4*X_{n}^{2}- 9) and f'(X) = 8*X_{n}

^{2}− 9. We know its roots are ±3/2 = ±1.5, but if we start from X

^{0}= 0.5, according to equation, we cannot get negative value at any time, so answer is 1.5 i.e. option (A) is correct.

Question 29 |

15 states | |

11 states | |

10 states | |

9 states |

**Regular languages and finite automata**

**GATE-CS-2007**

**Discuss it**

Question 30 |

^{i}21

^{i}| i≥0 } over the alphabet {0,1, 2} is:

not recursive | |

is recursive and is a deterministic CFL. | |

is a regular language. | |

is not a deterministic CFL but a CFL. |

**Context free languages and Push-down automata**

**GATE-CS-2007**

**Discuss it**

**design a deterministic pushdown automata**for the given language.

- For each occurrence of ‘0’ , we PUSH X in the stack.
- When ‘2’ appears, no stack operation is performed. But, state of the automata is changed.
- For each occurrence of ‘1’ , we POP X from the stack.
- If at the end Z
_{0}is on the stack top then input string is accepted

**design a Turing machine**for the given language.

- When ‘0’ appears in the input string , we replace it with X .Then, traverse to the rightmost corner and replace ‘1’ with Y.
- We go back to the leftmost ‘0’ and repeat the above process.
- While traversing rightwards from the beginning of the input string, if after X, ‘2’ appears and after ‘2’, Y appears then we reach the HALT state.
**Thus, the given language is recursive. Every recursive language is a CFL.****Thus, option (B) is the answer.**Please comment below if you find anything wrong in the above post.

Question 31 |

A | |

B | |

C | |

D |

**Regular languages and finite automata**

**GATE-CS-2007**

**Discuss it**

(C) Strings which are the part of this language are either 0w0 or 1w1 where w is any string in {0, 1}* . Thus, language given in option (C) is regular.

All other languages accept strings which have a palindrome as their substring.

(A) Strings intersect with 0*110* .

(B) Strings intersect with 0*110*1 .

(D) Strings intersect with 10*110* .

According to pumping lemma, languages given option (A), (B) and (D) are irregular.

Thus, option (C) is the answer.

Please comment below if you find anything wrong in the above post.

Question 32 |

x'y'z' + w'xy' + wy'z + xz | |

w'y'z' + wx'y' + xz | |

w'y'z' + wx'y' + xyz + xy'z | |

x'y'z' + wx'y' + w'y |

**Digital Logic & Number representation**

**GATE-CS-2007**

**Discuss it**

Question 33 |

Consider the following expressions P, Q and R. P: X = Y⋆Z Q: Y = X⋆Z R: X⋆Y⋆Z=1Which of the following is TRUE?

Only P and Q are valid | |

Only Q and R are valid. | |

Only P and R are valid. | |

All P, Q, R are valid. |

**Digital Logic & Number representation**

**GATE-CS-2007**

**Discuss it**

**P:**

X= Y * Z =(Y XOR Z)’ =YZ + Y’Z’ =Y(XY + X’Y’)+Y’(XY+X’Y’)’ =XY+Y’((Y XOR X)’)’ =XY+Y’(Y XOR X) =XY+Y’(Y’X+X’Y) =XY+Y’X =X(Y+Y’) =X

**Q:**

Y=X*Z =(X XOR Z)’ =X(XY + X’Y’) + X’(XY + X’Y’)’ =XY+X’(X’Y+XY’) =XY+X’Y =Y

**R:**

X * Y *Z WE HAVE SEEN FROM P Y*Z =X SO X * X

- NOT(X XOR X)=X’X’+XX
- 1

Question 34 |

2 ^{n} line to 1 line | |

2 ^{n+1} line to 1 line | |

2 ^{n-1} line to 1 line | |

2 ^{n-2} line to 1 line |

**Digital Logic & Number representation**

**GATE-CS-2007**

**Discuss it**

Question 35 |

_{i}and the carry propagate function P

_{i}for inputs A

_{i}and B

_{i}are given by:

PThe expressions for the sum bit S_{i}= A_{i}⨁ B_{i}and G_{i}= A_{i}B_{i}

_{i}and the carry bit C

_{i+1}of the look-ahead carry adder are given by:

SConsider a two-level logic implementation of the look-ahead carry generator. Assume that all P_{i}= P_{i}⨁ C_{i}and C_{i+1}= G_{i}+ P_{i}C_{i}, where C_{0}is the input carry.

_{i}and G

_{i}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 S3, S2, S1, S0 and C4 as its outputs are respectively:

6, 3 | |

10, 4 | |

6, 4 | |

10, 5 |

**Digital Logic & Number representation**

**GATE-CS-2007**

**Discuss it**

c1 = g0 + p0c0 = 1 AND, 1 OR c2 = g1 + p1g0 + p1p0c0 = 2 AND, 1 OR c3 = g2 + p2g1 + p2p1go + p2p1p0c0 = 3 AND, 1 OR c4 = g3 + p3g2 + p3p2g1 + p3p2p1g0 + p3p2p1p0c0 = 4 AND, 1 ORSo, total AND gates = 1+2+3+4 = 10 , OR gates = 1+1+1+1 = 4 So as a general formula we can observe that we need a total of " n(n+1)/2 " AND gates and "n" OR gates for a n-bit carry look ahead circuit used for addition of two binary numbers.

Question 36 |

0, 3, 4 | |

0, 3, 4, 5 | |

0, 1, 2, 3, 4 | |

0, 1, 2, 3, 4, 5 |

**Digital Logic & Number representation**

**GATE-CS-2007**

**Discuss it**

**A1 and A3=1**)[ clear condition satisfied] ->0000(init.) so it goes through 0->1->2->3->4 Ans is ( C) part.

Question 37 |

IF: Instruction Fetch ID: Instruction Decode and Operand Fetch EX: Execute WB: Write BackThe IF, ID and WB stages take one clock cycle each to complete the operation. The number of clock cycles for the EX stage dependson 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 <- R0 + R1 MUL R4, R3, R2 R4 <- R3 * R2 SUB R6, R5, R4 R6 <- R5 - R4

7 | |

8 | |

10 | |

14 |

**Computer Organization and Architecture**

**GATE-CS-2007**

**Discuss it**

**Explanation:**Order of instruction cycle phases IF” ID” EX” WB” We have 3 instructions. which represents wait in pipeline due to result dependently.

1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |

R2!R1!R0 | IF | ID | EX | WB | ||||

R4!R3!R2 | IF | ID | EX | EX | EX | WB | ||

R6!R5!R4 | IF | ID | - | - | EX | WB |

**So (B) is correct option.**

Question 38 |

8 2 3 ^ / 2 3 * + 5 1 * -Note that ^ is the exponentiation operator. The top two elements of the stack after the first * is evaluated are:

6, 1 | |

5, 7 | |

3, 2 | |

1, 5 |

**GATE-CS-2007**

**Discuss it**

Question 39 |

d e b f g c a | |

e d b g f c a | |

e d b f g c a | |

d e f g b c a |

**GATE-CS-2007**

**Discuss it**

Question 40 |

8, _, _, _, _, _, 10 | |

1, 8, 10, _, _, _, 3 | |

1, _, _, _, _, _,3 | |

1, 10, 8, _, _, _, 3 |

**GATE-CS-2007**

**Discuss it**

Question 41 |

Dijkstra’s algorithm starting from S. | |

Warshall’s algorithm | |

Performing a DFS starting from S. | |

Performing a BFS starting from S. |

**GATE-CS-2007**

**Discuss it**

Question 42 |

#include <stdio.h> int f(int n) { static int r = 0; if (n <= 0) return 1; if (n > 3) { r = n; return f(n-2)+2; } return f(n-1)+r; } int main() { printf("%d", f(5)); }

5 | |

7 | |

9 | |

18 |

**Storage Classes and Type Qualifiers**

**GATE-CS-2007**

**Discuss it**

f(5) = f(3)+2 The line "r = n" changes value of r to 5. Since r is static, its value is shared be all subsequence calls. Also, all subsequent calls don't change r because the statement "r = n" is in a if condition with n > 3. f(3) = f(2)+5 f(2) = f(1)+5 f(1) = f(0)+5 f(0) = 1 So f(5) = 1+5+5+5+2 = 18

Question 43 |

3 | |

4 | |

5 | |

6 |

**GATE-CS-2007**

**Discuss it**

Question 44 |

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?**(A) (logn)? (B) (n) (C) (loglogn) (D) (sqrt(n))

A | |

B | |

C | |

D |

**GATE-CS-2007**

**Discuss it**

Question 45 |

int DoSomething (int n) { if (n <= 2) return 1; else return (DoSomething (floor(sqrt(n))) + n); }(A) (n) (B) (nlogn) (C) (logn) (D) (loglogn)

A | |

B | |

C | |

D |

**GATE-CS-2007**

**Discuss it**

Question 46 |

struct CellNode { struct CellNOde *leftChild; int element; struct CellNode *rightChild; }; int GetValue(struct CellNode *ptr) { int value = 0; if (ptr != NULL) { if ((ptr->leftChild == NULL) && (ptr->rightChild == NULL)) value = 1; else value = value + GetValue(ptr->leftChild) + GetValue(ptr->rightChild); } return(value); }The value returned by GetValue() when a pointer to the root of a binary tree is passed as its argument is:

the number of nodes in the tree | |

the number of internal nodes in the tree | |

the number of leaf nodes in the tree | |

the height of the tree |

**GATE-CS-2007**

**Discuss it**

Question 47 |

A | |

B | |

C | |

D |

**GATE-CS-2007**

**Discuss it**

Question 48 |

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

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

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

None of the above |

**Propositional and First Order Logic.**

**GATE-CS-2007**

**Discuss it**

*We can easily prove that for any formula, there is a truth assignment for which at least half the clauses evaluate to true .*

**Proof :**Consider an arbitrary truth assignment. For each of its clause ‘j’ , introduce a random variable. X

_{j}= 1 if clause ‘j’ is satisfied X

_{j}= 0 otherwise Then, X = summation of (j * X

_{j}) is the number of satisfied clauses. Given any clause ’c’ , it is unsatisfied only if all of its ‘k’ constituent literals evaluates to false as they are joined by OR operator. Now, because each literal within a clause has a 1/2 chance of evaluating to true independently of any of the truth value of any of the other literals, the probability that they are all false is (1 / 2)

^{k}. Thus, the probability that ‘c’ is satisfied = 1 − (1 / 2)

^{k}So, E(X

_{j}) = 1 * (1 / 2)

^{k}= (1 / 2)

^{k}Therefore, E(X

_{j}) >= 1/2 Summation on both sides to get E(X). Therefore, we have E(X) = summation of (j * X

_{j}) >= m/2 where ‘m’ is the number of clauses. E(X) represents expected number of satisfied clauses. Thus, there must exist an assignment that satisfies at least half of the clauses. Please comment below if you find anything wrong in the above post.

Question 49 |

There is a minimum spanning tree containing e. | |

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. | |

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

e is present in every minimum spanning tree. |

**GATE-CS-2007**

**Discuss it**

Question 50 |

At least 2n - c comparisons, for some constant c, are needed. | |

At most 1.5n - 2 comparisons are needed. | |

At least nLog2n comparisons are needed. | |

None of the above. |

**GATE-CS-2007**

**Discuss it**

Question 51 |

int IsPrime(n) { int i,n; for(i=2;i<=sqrt(n);i++) if(n%i == 0) {printf(“Not Prime\n”); return 0;} return 1; }

**Let T(n) denotes the number of times the for loop is executed by the program on input n. Which of the following is TRUE?**(A) T(n) = O(sqrt(n)) and T(n) = (sqrt(n)) (B) T(n) = O(sqrt(n)) and T(n) = (1) (C) T(n) = O(n) and T(n) = (sqrt(n)) (D) None of the above

A | |

B | |

C | |

D |

**GATE-CS-2007**

**Discuss it**

Question 52 |

S --> iCtSSThe grammar is NOT LL(1) because:_{1}|a S_{1}--> eS|ϵ C --> b

it is left recursive | |

it is right recursive | |

it is ambiguous | |

It is not context-free. |

**Parsing and Syntax directed translation**

**GATE-CS-2007**

**Discuss it**

A LL(1) grammar doesn't give to multiple entries in a single cell of its parsing table. It has only single entry in a single cell, hence it should be unambiguous.

**Option A is wrong.** Grammar is not left recursive. For a grammar to be left recursive a production should be of form A->Ab, where A is a single Non-Terminal and b is any string of grammar symbols.

**Option B is wrong**. Because a right recursive grammar has nothing to do with LL(1).

**Option D is wrong**. Because the given grammar is clearly a Context Free Grammar. A grammar is CFG if it has productions of the form A->(V∪ T)* , where A is a single non-terminal and V is a set of Non-terminals and T is a set of Terminals.

Hence Option C should be the correct one. i.e. the grammar is ambiguous.

But let's see how the grammar is ambiguous.

If the grammar is ambiguous then it should give multiple entry in a cell while making its parsing table. And Parse table is made with the aid of two functions : FIRST and FOLLOW.

A parsing table of a grammar will**not**have multiple entries in a cell( i.e. will be a LL(1) grammar)

**if and only if**the following conditions hold for each production of the form A->α|β 1) FIRST(α) ∩ FIRST(β) = Φ 2) if FIRST(α) contains ' ε ' then FIRST(α) ∩ FOLLOW (A) = Φ and vice-versa.

Now,

- For the production , S->iCtSS1|a, rule 1 is satisfied, because FIRST(iCtSS1) ∩ FIRST(a) = {i} ∩ {a} = Φ
- For the production, S1->eS|ε, rule 1 is satisfied, as FIRST(eS) ∩ FIRST(ε) = {e} ∩ {ε} = Φ . But here due to 'ε' in FIRST, we have to check for rule 2. FIRST(eS) ∩ FOLLOW(S1) = {e} ∩ {e, $} ≠ Φ . Hence rule 2 fails in this production rule. Therefore there will be multiple entries in the parsing table, hence the grammar is ambiguous and not LL(1).

Question 53 |

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

Both P and Q are true | |

P is true and Q is false | |

P is false and Q is true | |

Both P and Q are false |

**Parsing and Syntax directed translation**

**GATE-CS-2007**

**Discuss it**

A regular grammar can also be ambiguous also For example, consider the following grammar, S → aA/a A → aA/ε In above grammar, string 'a' has two leftmost derivations. (1) S → aA (2) S → a S->a (using A->ε) And LL(1) parses only unambiguous grammar, so statement P is False. Statement Q is true is for every regular set, we can have a regular grammar which is unambiguous so it can be parse by LR parser. So option C is correct choice

Question 54 |

2 | |

3 | |

5 | |

6 |

**Code Generation and Optimization**

**GATE-CS-2007**

**Discuss it**

Question 55 |

Process Execution time Arrival time P1 20 0 P2 25 15 P3 10 30 P4 15 45What is the total waiting time for process P2?

5 | |

15 | |

40 | |

55 |

**GATE-CS-2007**

**CPU Scheduling**

**Discuss it**

**Nitika Bansal**

Question 56 |

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?

Both P and Q are true, and Q is the reason for P | |

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

P is false, but Q is true | |

Both P and Q are false |

**Memory Management**

**GATE-CS-2007**

**Discuss it**

**Statement P:**Increasing the number of page frames allocated to a process sometimes increases the page fault rate. Correct, as FIFO page replacement algorithm suffers from belady’s anomaly which states above statement.

**Statement Q:**Some programs do not exhibit locality of reference. Correct, Locality often occurs because code contains loops that tend to reference arrays or other data structures by indices. So we can write a program does not contain loop and do not exhibit locality of reference. So, both statement P and Q are correct but Q is not the reason for P as Belady’s Anomaly occurs for some specific patterns of page references. See Question 1 of http://www.geeksforgeeks.org/operating-systems-set-13/ Reference : http://quiz.geeksforgeeks.org/operating-system-page-replacement-algorithm/ This solution is contributed by

**Nitika Bansal**

Question 57 |

alloc request X Y Z X Y Z P0 1 2 1 1 0 3 P1 2 0 1 0 1 2 P2 2 2 1 1 2 0

P0 | |

P! | |

P2 | |

None of the above, since the system is in a deadlock |

**GATE-CS-2007**

**Discuss it**

**Nitika Bansal**

Question 58 |

/* P1 */ while (true) { wants1 = true; while (wants2 == true); /* Critical Section */ wants1=false; } /* Remainder section */ /* P2 */ while (true) { wants2 = true; while (wants1==true); /* Critical Section */ wants2 = false; } /* Remainder section */

It does not ensure mutual exclusion. | |

It does not ensure bounded waiting. | |

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

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

**Process Management**

**GATE-CS-2007**

**Discuss it**

**Solution:**Two processes, P1 and P2, need to access a critical section of code. Here, wants1 and wants2 are shared variables, which are initialized to false. Now, when both wants1 and wants2 become true, both process p1 and p2 enter in while loop and waiting for each other to finish. This while loop run indefinitely which leads to deadlock. Now, Assume P1 is in critical section (it means wants1=true, wants2 can be anything, true or false). So this ensures that p2 won’t enter in critical section and vice versa. This satisfies the property of mutual exclusion. Here bounded waiting condition is also satisfied as there is a bound on the number of process which gets access to critical section after a process request access to it. See question 3 of http://www.geeksforgeeks.org/operating-systems-set-13/ This solution is contributed by

**Nitika Bansal**

Question 59 |

*studinfo(studId, name, sex)*. The relation

*enroll(studId, courseId)*gives which student has enrolled for (or taken) that 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?

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

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

Courses in which only male students are enrolled. | |

None of the above |

**ER and Relational Models**

**GATE-CS-2007**

**Discuss it**

Question 60 |

Names of employees with a male supervisor. | |

Names of employees with no immediate male subordinates. | |

Names of employees with no immediate female subordinates. | |

Names of employees with a female supervisor. |

**ER and Relational Models**

**GATE-CS-2007**

**Discuss it**

Question 61 |

Q1 : Select e.empId From employee e Where not exists (Select * From employee s where s.department = “5” and s.salary >=e.salary) Q2 : Select e.empId From employee e Where e.salary > Any (Select distinct salary From employee s Where s.department = “5”)

Q1 is the correct query | |

Q2 is the correct query | |

Both Q1 and Q2 produce the same answer. | |

Neither Q1 nor Q2 is the correct query |

**SQL**

**GATE-CS-2007**

**Discuss it**

e1 ------- A-------- 1---------10000 e2 -------B ------- 5 ---------5000 e3 -------C ------- 5----------7000 e4 -------D ------- 2----------2000 e5 -------E ------- 3----------6000Now the actual result should contain empId : e1 , e3 and e5 ( because they have salary greater than anyone employee in the department '5') -------------------------------------------------------- Now Q1 : Note : EXISTS(empty set) gives FALSE, and NOT EXISTS(empty set) gives TRUE.

Select e.empId From employee e Where not exists (Select * From employee s where s.department = “5” and s.salary >=e.salary)Q1 will result only empId e1. --------------------------------------------------------- whereas Q2 :

Select e.empId From employee e Where e.salary > Any (Select distinct salary From employee s Where s.department = “5”)Q2 will result empId e1, e3 and e5. -------------------------------------------------------- Hence Q2 is the correct query.

Question 62 |

Any relation with two attributes is in BCNF | |

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

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

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

**GATE-CS-2007**

**Discuss it**

If a relational schema is in BCNF then all redundancy based on functional dependency has been removed, although other types of redundancy may still exist.

A relational schema R is in BCNF form if and only if for every one of its dependencies X → Y, at least one of the following conditions hold : 1. X → Y is a trivial functional dependency i.e. Y is a subset of X . 2. X is a super key for schema R

So, we check transitive dependency for only non-prime attributes in case of BCNF.

Thus, the statement 'A prime attribute can be transitively dependent on a key in a BCNF relation' is false.

Thus, option (D) is the answer.

Please comment below if you find anything wrong in the above post.

Question 63 |

63 | |

64 | |

67 | |

68 |

**B and B+ Trees**

**GATE-CS-2007**

**Discuss it**

Disk Block size = 1024 bytes Data Record Pointer size, r = 7 bytes Value size, V = 9 bytes Disk Block ptr, P = 6 bytesLet order of leaf be m. A leaf node in B+ tree contains at most m record pointers, at most m values, and one disk block pointer. r*m + V*m + p <= 1024 16m <= 1018 m =< 63

Question 64 |

Both S1 and S2 are conflict serializable. | |

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

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

Both S1 and S2 are not conflict serializable. |

**GATE-CS-2007**

**Discuss it**

S1 is not conflict serializable, but S2 is conflict serializableSchedule S1T1 T2 --------------------- r1(X) r1(Y) r2(X) r2(Y) w2(Y) w1(X) The schedule is neither conflict equivalent to T1T2, nor T2T1.Schedule S2T1 T2 --------------------- r1(X) r2(X) r2(Y) w2(Y) r1(Y) w1(X) The schedule is conflict equivalent to T2T1.

Question 65 |

(1-p) ^{(n-1)} | |

np(1-p) ^{(n-1)} | |

p(1-p) ^{(n-1)} | |

1-(1-p) ^{(n-1)} |

**Data Link Layer**

**GATE-CS-2007**

**Discuss it**

P(X) = Probability that station X attempts to transmit = P P (-X) = Probability that station X does not transmit = 1-P Required is: Probability that only one station transmits = y

Y = (A1, -A2, -A3...... -An) + (-A1, A2, A3......-An) + (-A1, -A2, A3.....-An) + ........... + (-A1, -A2, -A3......An) = (p*(1-p)*(1-p)*...... (1-p) + (1-p)*p*(1-p)........(1-p) + ............. = p*(1-p)^(n-1) + p*(1-p)^n-1 + .................................................... + p*(1-p)^(n-1) = n*p*(1-p)^(n-1)

This solution is contributed **Anil Saikrishna Devarasetty** .

Question 66 |

500 metres of cable. | |

200 metres of cable. | |

20 metres of cable. | |

50 metres of cable. |

**Data Link Layer**

**GATE-CS-2007**

**Discuss it**

Question 67 |

62 subnets and 262142 hosts. | |

64 subnets and 262142 hosts. | |

62 subnets and 1022 hosts. | |

64 subnets and 1024 hosts. |

**GATE-CS-2007**

**IP Addressing**

**Discuss it**

Question 68 |

11001001000 | |

11001001011 | |

11001010 | |

110010010011 |

**Data Link Layer**

**GATE-CS-2007**

**Discuss it**

Question 69 |

A | |

B | |

C | |

D |

**Data Link Layer**

**GATE-CS-2007**

**Discuss it**

Question 70 |

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

P – 2 Q – 1 R – 3 S – 5 | |

P – 1 Q – 4 R – 2 S – 3 | |

P – 1 Q – 4 R – 2 S – 5 | |

P – 2 Q – 4 R – 1 S – 3 |

**Misc Topics in Computer Networks**

**GATE-CS-2007**

**Discuss it**

Question 71 |

10 | |

11 | |

20 | |

21 |

**Computer Organization and Architecture**

**GATE-CS-2007**

**Discuss it**

**Explanation:**Ist memory reference R1←M[3000] and then in the loop which runs for 10 times, because the content of memory location 3000 is 10 given in question and loop will run 10 times as R2← M[R3] M[R3] ←R2 There are two memory reference every iteration 10*2=20

**Total=20+1=21**

**So (D) is correct option.**

Question 72 |

100 | |

101 | |

102 | |

110 |

**Computer Organization and Architecture**

**GATE-CS-2007**

**Discuss it**

**Explanation:**Program stores results from 2000 to 2010. It stores 110,109,108…..100 at 2010 location. So at 2010 it stores 100 Because DEC R1 is instruction which decrements register value by 1. So (A) is correct option.

Question 73 |

1005 | |

1020 | |

1024 | |

1040 |

**Computer Organization and Architecture**

**GATE-CS-2007**

**Discuss it**

**Explanation:**If memory is byte addressable so for each instruction it requires 1 word that is equal to 4 bytes which require 4 addresses

Instruction | Word | location |

MOV R1,3000 | 2 | 1000-1007 |

MOV R2,R1 | 1 | 1008-1011 |

ADD R2,R1 | 1 | 1012-1015 |

MOV(R3),R2 | 1 | 1016-1019 |

INC R3 | 1 | 1020-1023 |

DEC R1 | 1 | 1024-1027 |

**So (C) is correct option.**

Question 74 |

A | |

B | |

C | |

D |

**Regular languages and finite automata**

**GATE-CS-2007**

**Discuss it**

Thus, the string accepted by the FSA is b* a (a + b)*.

Thus, C is the correct choice.

Please comment below if you find anything wrong in the above post.

Question 75 |

1 | |

2 | |

3 | |

4 |

**Regular languages and finite automata**

**GATE-CS-2007**

**Discuss it**

Question 76 |

0, 10, 110, 1110, 11110, 11111 | |

11, 10, 011, 010, 001, 000 | |

11, 10, 01, 001, 0001, 0000 | |

110, 100, 010, 000, 001, 111 |

**Greedy Algorithms**

**GATE-CS-2007**

**Discuss it**

The letters a, b, c, d, e, f have probabilities 1/2, 1/4, 1/8, 1/16, 1/32, 1/32 respectively. 1 / \ / \ 1/2 a(1/2) / \ / \ 1/4 b(1/4) / \ / \ 1/8 c(1/8) / \ / \ 1/16 d(1/16) / \ e f

Question 77 |

3 | |

2.1875 | |

2.25 | |

1.9375 |

**Greedy Algorithms**

**GATE-CS-2007**

**Discuss it**

The letters a, b, c, d, e, f have probabilities 1/2, 1/4, 1/8, 1/16, 1/32, 1/32 respectively. 1 / \ / \ 1/2 a(1/2) / \ / \ 1/4 b(1/4) / \ / \ 1/8 c(1/8) / \ / \ 1/16 d(1/16) / \ e f The average length = (1*1/2 + 2*1/4 + 3*1/8 + 4*1/16 + 5*1/32 + 5*1/32) = 1.9375

Question 78 |

S --> aB S --> bA B --> b A --> a B --> bS A --> aS B --> aBB A --> bAAWhich of the following strings is generated by the grammar?

aaaabb | |

aabbbb | |

aabbab | |

abbbba |

**Context free languages and Push-down automata**

**GATE-CS-2007**

**Discuss it**

S --> aB S --> bA B --> b A --> a B --> bS A --> aS B --> aBB A --> bAAWe can derive

**aabbab**using below sequence

S -> aB [Using S --> aB] -> aaBB [Using B --> aBB] -> aabB [Using B --> b] -> aabbS [Using B --> bS] -> aabbaB [Using S --> aB] -> aabbab [Using B --> b]

Question 79 |

1 | |

2 | |

3 | |

4 |

**Context free languages and Push-down automata**

**GATE-CS-2007**

**Discuss it**

**LMD-1**S -> aB [Using S --> aB] -> aaBB [Using B --> aBB] -> aabB [Using B --> b] -> aabbS [Using B --> bS] -> aabbaB [Using S --> aB] -> aabbab [Using B --> b]

**LMD-2**S -> aB [Using S --> aB] -> aaBB [Using B --> aBB] -> aabSB [Using B --> bS] -> aabbAB [Using S --> bA] -> aabbaB [Using A --> a] -> aabbab [Using B --> b] The Derivation tress are shown below :

Question 80 |

^{16}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?

40 | |

50 | |

56 | |

59 |

**Computer Organization and Architecture**

**GATE-CS-2007**

**Discuss it**

^{16 }bytes Size of cache=32*64 Bytes =2

^{11 }Bytes Size of array=2500 Bytes Array is stored in main memory but cache will be empty Size of cache=2048 Bytes So number of page faults=2500-2048=452 Complete array will be access twice So for second access no. of total page faults=452*2=904 So total page faults=452+904=1356

**So data cache misses will be 56**

**So (C) is correct option**

Question 81 |

line 4 to line 11 | |

line 4 to line 12 | |

line 0 to line 7 | |

line 0 to line 8 |

**Computer Organization and Architecture**

**GATE-CS-2007**

**Discuss it**

**Mohit Gupta.**

Question 82 |

7 | |

8 | |

9 | |

10 |

**Memory Management**

**GATE-CS-2007**

**Discuss it**

**So Answer is A**

Question 83 |

0 | |

1 | |

2 | |

3 |

**Memory Management**

**GATE-CS-2007**

**Discuss it**

**Therefore 2 more page faults**

**Answer is C**

Question 84 |

A | |

B | |

C | |

D |

**Combinatorics**

**GATE-CS-2007**

**Discuss it**

^{20}C

_{10}ways. So option (A) is correct. Source: http://www.cse.iitd.ac.in/~mittal/gate/gate_math_2007.html

Question 85 |

A | |

B | |

C | |

D |

**Combinatorics**

**GATE-CS-2007**

**Discuss it**

From (0,0) to (4,4), number of paths =So option (D) is correct. Source: http://www.cse.iitd.ac.in/~mittal/gate/gate_math_2007.html^{8}C_{4}[found in same way as in previous question]. From (5,4) to (10,10), number of paths =^{11}C_{5}. So total number of paths required :^{20}C_{10}−^{8}C_{4}∗^{11}C_{5}.