Javatpoint Logo
Javatpoint Logo

GATE 2017 CS Set 2

41) Let L(R) be the language represented by regular expression R. Let L(G) be the language generated by a context free grammar G. Let L(M) be the language accepted by a Turing machine M. Which of the following decision problems are undecidable?

I. Given a regular expression R and a string w, is w∈L(R)?
II. Given a context-free grammar G, is L(G)=Ø
III. Given a context-free grammar G, is L(G)=Σ∗ for some alphabet &Sigma?
IV. Given a Turing machine M and a string w, is w ∈ L(M)?

  1. I and IV only
  2. II and III only
  3. II, III and IV only
  4. III and IV only

Answer: D

Explanation:

Given,
L ( R ) is the language represented by the regular expression
L (G) is the language generated by a context-free grammar
L (M) is the language accepted by Turing Machine
Option (I) is a membership problem which is decidable for Finite state machine and Regular expression.
Option (II) is an Emptiness problem which is decidable by checking the usefulness of start symbol.
Option (III) is a problem of CFL which is undecidable.
Option (IV) is a membership problem of regular expression language which is undecidable.

Therefore option (D) is the right answer.


42) The next state table of a 2-bit saturating up-counter is given below.

Q1 Q0 Q1+ Q0+
0 0 0 1
0 1 1 0
1 0 1 1
1 1 1 1

The counter is built as synchronous sequential circuit using T flip-flops. The value for T1 and T0 are

  1. T1 = Q0Q1       T0 = Q'0Q'1
  2. T1 = Q'1Q0       T0 = Q'1 + Q'0
  3. T1 = Q1 + Q0       T0 = Q'1 + Q'0
  4. T1 = Q'1Q0       T0 = Q1 + Q0

Answer: B

Explanation:

Q1 Q0 Q1+ Q0+ T0 T1
0 0 0 1 0 1
0 1 1 0 1 1
1 0 1 1 0 1
1 1 1 1 0 0

By using above Excitation table, we get

T1 = Q'1Q0       T0 = Q'1 + Q'0

Therefore option (B) is the right answer.


43) Consider the following snippet of a C program. Assume that swap(&x, &y) exchanges the contents of x and y.

The output of the program is _____.

  1. 1
  2. 2
  3. 3
  4. 4

Answer: C

Explanation:

Initially while loop starts execution with (while == 0)
After the execution of the for loop in first time, the content of array will be as follows: 5 3 4 6 2 1
After the execution of the for loop in Second time, the content of array will be as follows: 6 5 4 3 2 1
After the execution of the for loop in Third time, the content of array will be as follows: 6 5 4 3 2 1
Now, when while loop executes again, done = 1 and first and second for loop if condition will not be satisfied. So the final content of an array is 6, 5, 4, 3, 2, 1...The output of the program is = = 3.
Therefore option (C) is the right answer.


44) Two transactions T1 and T2 are given as:

T1: r1(X)w1(X)r1(Y)w1(Y)
T2: r2(Y)w2(Y)r2(Z)w2(Z)

where ri(V) denotes a read operation by transaction Ti on a variable V and wi(V) denotes a write operation by transaction Ti on a variable V. The total number of conflict serializable schedules that can be formed by T1 and T2 is ______

  1. 54
  2. 56
  3. 57
  4. 58

Answer: A

Explanation:

Total number of schedules = Non conflict serializable schedules + Conflict serializable schedules

According to question, Total number of schedules: 8! / 4!*4! <=> 1*2*3*4*5*6*7*8 / 4*3*2*1* 4*3*2*1 = 70

Non conflict serializable schedules: A1_2_3(BCD4) + _1A2_3(BCD4) + _1_2A3(BCD4) + _1_2_3A(BCD4) = 4*(3+2?1) = 16

So total number of conflict serializable schedules are = 70 -16 = 54.

Therefore option (A) is the right answer.


45) The read access times and the hit ratios for different caches in a memory hierarchy are as given below:

Cache Read access time (in nanoseconds) Hit ratio
I-cache 2 0.8
D-cache 2 0.9
L2-cache 8 0.9

The read access time of main memory in 90 nanoseconds. Assume that the caches use the referred-word-first read policy and the writeback policy. Assume that all the caches are direct mapped caches. Assume that the dirty bit is always 0 for all the blocks in the caches. In execution of a program, 60% of memory reads are for instruction fetch and 40% are for memory operand fetch. The average read access time in nanoseconds (up to 2 decimal places) is _________.

  1. 2.74
  2. 4.72
  3. 3.10
  4. 2.67

Answer: B

Explanation:

Given,
      Instruction Fetch = 0.6
      Operand fetch = 0.4
      Average read time = ?

According to the question, L2 cache is shared between Instruction and Data. So,

Average read time = Fraction of Instruction Fetch * Average Instruction fetch time + Fraction of Data/Operand Fetch * Average Data/Operand Fetch Time

Now,

Average Instruction fetch Time = L1 access time + L1 miss rate * L2 access time + L1 miss rate * L2 miss rate * Memory access time = 2 + 0.2 * 8 + 0.2 * 0.1 * 90 = 5.4 ns

Average Data fetch Time = L1 access time + L1 miss rate * L2 access time + L1 miss rate * L2 miss rate * Memory access time = 2 + 0.1 * 8 + 0.1 * 0.1 * 90 = 3.7 ns

Thus, Average memory access time = 0.6 * 5.4 + 0.4 * 3.7 = 4.72 ns

Therefore option (B) is the right answer.


46) Consider the following database table named top_scorer.

Player Country Goals
Klose Germany 16
Ronaldo Brazil 15
G Miiller Germany 14
Fontaine France 13
Pele Brazil 12
Klinsmann Germany 11
Kocsis Hungary 11
Batistuta Argentina 10
Cubillas Peru 10
Lato Poland 10
Lineker England 10
T Miiller Germany 10
Rahn Germany 10

Consider the following SQL query:

The number of tuples returned by the above SQL query is ____.

  1. 6
  2. 7
  3. 8
  4. 9

Answer: B

Explanation:

The first where condition select players which have goals greater than ALL players of Spain. Since Spain is not in the database, so this condition always returns TRUE.

The second where condition selects all those players who have higher than 10 Goals because we can see in the table that every German player have minimum 10 goals. Thus the first 7 rows of the table will be returned.

Player Country Goals
Klose Germany 16
Ronaldo Brazil 15
G Miiller Germany 14
Fontaine France 13
Pele Brazil 12
Klinsmann Germany 11
Kocsis Hungary 11

Therefore option (B) will be the right answer.


47) If the ordinary generating function of a sequence is:

Gate 2017 CS set 2

then a3 - a0 is equal to:

  1. 8
  2. 10
  3. 15
  4. 20

Answer: C

Explanation:

Given ordinary generating function = (1+z) (1-z)-3
Now, (1-z)-3 = 1.z0 + (3C1).z1 + (4C2).z2 + (5C3).z3 + .....+ ∞
So, (1+z) (1-z)-3 = (1+z) . ( 1.z0 + (3C1).z1 + (4C2).z2 + (5C3).z3 + .....+ ∞ )
Thus, Coefficient of a0 = 1
Coefficient of a3 = 4C2 + 5C3 = 4*3 / 2*1 + 5*4*3/ 3*2*1 = 6+10 = 16
then a3 - a0 is = 16 - 1 = 15
Therefore option (C) is the right answer.


48) If a random variable X has a Poisson distribution with mean 5, then the expression E[(X+2)2] equals _____.

  1. 53
  2. 54
  3. 55
  4. 56

Answer: B

Explanation:

As we know that in Poisson distribution, mean and variance are same. In the given question mean is 5. So variance should also be 5.
Also, In Poisson distribution: variance = E[X2] - (E[X])2
5 = E[X2] - 25
E[X2] = 25 + 5 = 30
By using Linearity of Expectation, we can write,
E[(X+2)2] = E[X2 + 4X + 4]
     = E(X2) + 4E(X) + 4
      = 30 + 4*5 + 4 = 54
Therefore option (B) is the right answer.


GATE 2017 CS Set 2-1
GATE 2017 CS Set 2-2
GATE 2017 CS Set 2-3
GATE 2017 CS Set 2-4
GATE 2017 CS Set 2-5
GATE 2017 CS Set 2-7
GATE 2017 CS Set 2-8






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA