GATE-CS-2015 (Set 3)

Last Updated :
Discuss
Comments

Question 1

Two processes X and Y need to access a critical section. Consider the following synchronization construct used by both the processes.

Q20

Here, varP and varQ are shared variables and both are initialized to false. Which one of the following statements is true?

  • The proposed solution prevents deadlock but fails to guarantee mutual exclusion

  • The proposed solution guarantees mutual exclusion but fails to prevent deadlock

  • The proposed solution guarantees mutual exclusion and prevents deadlock

  • The proposed solution fails to prevent deadlock and fails to guarantee mutual exclusion

Question 2

Consider a CSMA/CD network that transmits data at a rate of 100 Mbps (108 bits per second) over a 1 km (kilometre) cable with no repeaters. If the minimum frame size required for this network is 1250 bytes, what is the signal speed (km/sec) in the cable?

  • 8000

  • 10000

  • 16000

  • 20000

Question 3

The result evaluating the postfix expression 10 5 + 60 6 / * 8 – is

  • 284

  • 213

  • 142

  • 71

Question 4

Q13

The equality above remains correct if X is replace by

  • Only I

  • Only II

  • I or III or IV but not II

  • II or III or IV but not I

Question 5

Assume that a mergesort algorithm in the worst case takes 30 seconds for an input of size 64. Which of the following most closely approximates the maximum input size of a problem that can be solved in 6 minutes?

  • 256

  • 512

  • 1024

  • 2048

Question 6

Consider the following C program segment. 
 

C
# include <stdio.h>
int main( )
{
    char s1[7] = "1234", *p;
    p = s1 + 2;
    *p = '0' ;
    printf ("%s", s1);
}

What will be printed by the program?
 

  • 12 

  • 120400

  • 1204

  • 1034

Question 7

Consider the following C program:

C
# include <stdio.h>
int main( )
{
   int i, j, k = 0;
   j = 2 * 3 / 4 + 2.0 / 5 + 8 / 5;
   k  -= --j;
   for (i = 0; i < 5; i++)
   {
      switch(i + k)
      {
         case 1:
         case 2: printf("\n%d", i + k);
         case 3: printf("\n%d", i + k);
         default: printf("\n%d", i + k);
      }
   }
   return 0;
}

The number of times printf statement is executed is __________.

  • 8

  • 9

  • 10

  • 11

Question 8

Suppose c = 〈c[0], ... , c[k – 1]〉 is an array of length k, where all the entries are from the set {0, 1}. For any positive integers a and n, consider the following pseudocode.

DOSOMETHING (c, a, n)
z ← 1
for i ← 0 to k – 1
do z ← z2 mod n
if c[i] = 1
then z ← (z × a) mod n
return z

If k = 4, c = 〈1, 0, 1, 1〉, a = 2 and n = 8, then the output of DOSOMETHING(c, a, n) is ____________.

  • 0

  • 1

  • 2

  • 3

Question 9

Language L1 is polynomial time reducible to language L2. Language L3 is polynomial time reducible to L2, which in turn is polynomial time reducible to language L4. Which of the following is/are True?

I. If L4 ∈ P, L2 ∈ P
II. If L1 ∈ P or L3 ∈ P, then L2 ∈ P
III. L1 ∈ P, if and only if L3 ∈ P
IV. If L4 ∈ P, then L1 ∈ P and L3 ∈ P
  • II only

  • III only

  • I and IV only

  • I only

Question 10

Let f(n) = n and g(n) = n(1+sin n), where n is a positive integer. Which of the following statements is/are correct?

I.  f(n) = O(g(n))
II. f(n) = Ω(g(n))
  • Only I

  • Only II

  • Both I and II

  • Neither I nor II

Tags:

There are 65 questions to complete.

Take a part in the ongoing discussion