GATE-CS-2016 (Set 1)

Last Updated :
Discuss
Comments

Question 1

A sender uses the Stop-and-Wait ARQ protocol for reliable transmission of frames. Frames are of size 1000 bytes and the transmission rate at the sender is 80 Kbps (1Kbps = 1000 bits/second). Size of an acknowledgement is 100 bytes and the transmission rate at the receiver is 8 Kbps. The one-way propagation delay is 100 milliseconds.

Assuming no frame is lost, the sender throughput is __________ bytes/second.

  • 2500

  • 2000

  • 1500

  • 500

Question 2

The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are:

  • Θ(n log n), Θ(n log n) and Θ(n2)

  • Θ(n2), Θ(n2) and Θ(n Log n)

  • Θ(n2), Θ(n log n) and Θ(n log n)

  • Θ(n2), Θ(n log n) and Θ(n2)

Question 3

The following function computes the maximum value contained in an integer array p[] of size n (n >= 1) 
 

C
int max(int *p, int n)
{
    int a=0, b=n-1;
    while (__________)
    {
        if (p[a] <= p[b])
        {
            a = a+1;
        }
        else
        {
            b = b-1;
        }
    }
    return p[a];
}

The missing loop condition is
 

  • a != n

  • b != 0

  • b > (a + 1)

  • b != a

Question 4

Consider the following C program. 

C
#include<stdio.h>
void mystery(int *ptra, int *ptrb) 
{
   int *temp;
   temp = ptrb;
   ptrb = ptra;
   ptra = temp;
}
int main() 
{
    int a=2016, b=0, c=4, d=42;
    mystery(&a, &b);
    if (a < c)
       mystery(&c, &a);
    mystery(&a, &d);
    printf("%d", a);
}

The output of the program _____________   Note : This question was asked as Numerical Answer Type.

  • 2016

  • 0

  • 4

  • 8

Question 5

Consider a computer system with ten physical page frames. The system is provided with an access sequence a1, a2, ..., a20, a1, a2, ..., a20), where each ai number. The difference in the number of page faults between the last-in-first-out page replacement policy and the optimal page replacement policy is __________ [Note that this question was originally Fill-in-the-Blanks question]

  • 0

  • 1

  • 2

  • 3

Question 6

Consider a computer system with 40-bit virtual addressing and page size of sixteen kilobytes. If the computer system has a one-level page table per process and each page table entry requires 48 bits, then the size of the per-process page table is _________megabytes.   Note : This question was asked as Numerical Answer Type.

  • 384

  • 48

  • 192

  • 96

Question 7

Consider the following C program.

C
void f(int, short);
void main()
{
  int i = 100;
  short s = 12;
  short *p = &s;
  __________ ;   // call to f()
}

Which one of the following expressions, when placed in the blank above, will NOT result in a type checking error?

  • f(s, *s)

  • i = f(i,s)

  • f(i,*s)

  • f(i,*p)

Question 8

Consider a disk queue with requests for I/O to blocks on cylinders 47, 38, 121, 191, 87, 11, 92, 10. The C-LOOK scheduling algorithm is used. The head is initially at cylinder number 63, moving towards larger cylinder numbers on its servicing pass. The cylinders are numbered from 0 to 199. The total head movement (in number of cylinders) incurred while servicing these requests is:   Note : This question was asked as Numerical Answer Type.

  • 346

  • 165

  • 154

  • 173

Question 9

Consider the recurrence relation a1 = 8, an = 6n2 + 2n + an-1. Let a99 = k x 104. The value of K is _____

 
Note : This question was asked as Numerical Answer Type.

  • 190

  • 296

  • 198

  • 200

Question 10

What will be the output of the following JAVA program? 

C++
#include <iostream>
using namespace std;

static int d = 1;

void count(int n) {
    cout << n << " ";
    cout << d << " ";
    d++;
    if(n > 1) count(n - 1);
    cout << d << " ";
}

int main() {
    count(3);
    return 0;
}
C
#include <stdio.h>

static int d = 1;

void count(int n) {
    printf("%d ", n);
    printf("%d ", d);
    d++;
    if(n > 1) count(n - 1);
    printf("%d ", d);
}

int main() {
    count(3);
    return 0;
}
Java
class GFG
{
   static int d=1;
   static void count(int n)
    {
    System.out.print(n+" ");
    System.out.print(d+" ");
    d++;
    if(n > 1) count(n-1);
    System.out.print(d+" ");
  }

 public static void main(String args[])
    {
       count(3);
    }
}
Python
d = 1

def count(n):
    global d
    print(n, end=' ')
    print(d, end=' ')
    d += 1
    if n > 1:
        count(n - 1)
    print(d, end=' ')

count(3)
JavaScript
let d = 1;

function count(n) {
    process.stdout.write(n + ' ');
    process.stdout.write(d + ' ');
    d++;
    if (n > 1) count(n - 1);
    process.stdout.write(d + ' ');
}

count(3);
  • 3 1 2 2 1 3 4 4 4

  • 3 1 2 1 1 1 2 2 2

  • 3 1 2 2 1 3 4

  • 3 1 2 1 1 1 2

Tags:

There are 65 questions to complete.

Take a part in the ongoing discussion