CS and IT GATE 2016 Set-1 Questions with Answer

Ques 14 C Programming


The attributes of three arithmetic operators in some programming language are given below.

Operator Precedence Associativity Arity
+ High Left Binary
- Medium Right Binary
* Low Left Binary


The value of the expression 2 - 5 + 1 - 7 * 3 in this language is __________ ?


a is the correct answer.


Ques 15 C Programming


Consider the following C program

#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("%dn", a);
}


The output of the program _____________


a is the correct answer.


Ques 16 C Programming


Consider the following proposed solution for the critical section problem. There are n processes: P0 ...Pn−1. In the code, function pmax returns an integer not smaller than anyof its arguments. For all i, t[i] is initialized to zero.

Code for Pi
:
do {
    c[i]=1; t[i] = pmax(t[0],...,t[n-1])+1; c[i]=0;
    for every j 6= i in {0,...,n-1} {
        while (c[j]);
        while (t[j] != 0 && t[j]<=t[i]);
    }
    Critical Section;
    t[i]=0;
    Remainder Section;
    } while (true);



Which one of the following is TRUE about the above solution?

A

At most one process can be in the critical section at any time

B

The bounded wait condition is satisfied

C

The progress condition is satisfied

D

It cannot cause a deadlock



Ques 17 C Programming


What will be the output of the following pseudo-code when parameters are passed by reference and dynamic scoping is assumed?

a=3;
void n(x) {x = x * a; print(x);}
void m(y) {a = 1; a = y - a; n(a); print(a);}
void main() {m(a);}

A

6, 2

B

6, 6

C

4, 2

D

4, 4



Ques 18 C Programming


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

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

a != n

B

b != 0

C

b > (a + 1)

D

b != a



Ques 19 C Programming


Consider the following C program.

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?

A

f(s, *s)

B

i = f(i,s)

C

f(i,*s)

D

f(i,*p)



Ques 20 COA


The stage delays in a 4-stage pipeline are 800, 500, 400 and 300 picoseconds. The first stage (with delay 800 picoseconds) is replaced with a functionally equivalent design involving two stages with respective delays 600 and 350 picoseconds. The throughput increase of the pipeline is _______ percent.


a is the correct answer.


Ques 21 COA


The size of the data count register of a DMA controller is 16 bits. The processor needs to transfer a file of 29,154 kilobytes from disk to main memory. The memory is byte addressable. The minimum number of times the DMA controller needs to get the control of the system bus from the processor to transfer the file from the disk to main memory is _________


a is the correct answer.


Ques 22 COA


A processor can support a maximum memory of 4 GB, where the memory is word-addressable (a word consists of two bytes). The size of the address bus of the processor is at ____ least bits.


a is the correct answer.


Ques 23 Compiler Design


Consider the following code segment.

x = u - t;
y = x * v;
x = y + w;
y = t - z;
y = x * y;


The minimum number of total variables required to convert the above code segment to static single assignment form is ____


a is the correct answer.


Ques 24 Compiler Design


Consider the following Syntax Directed Translation Scheme (SDTS), with non-terminals {S, A} and terminals {a, b}.

S −→ aA { print 1 }
S −→ a { print 2 }
A −→ Sb { print 3 }


Using the above SDTS, the output printed by a bottom-up parser, for the input aab is:

A

1 3 2

B

2 2 3

C

2 3 1

D

Syntax Error



Ques 25 Computer Network


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.


a is the correct answer.


Ques 26 Computer Network


An IP datagram of size 1000 bytes arrives at a router. The router has to forward this packet on a link whose MTU (maximum transmission unit) is 100 bytes. Assume that the size of the IP header is 20 bytes. The number of fragments that the IP datagram will be divided into for transmission is________


a is the correct answer.


Unique Visitor Count

Total Unique Visitors

Loading......