CS and IT Gate 2019 Questions with Answer

Ques 14 Gate 2019


Consider the following C program:

#include<stdio.h>
int main() {
    float sum = 0.0, j = 1.0, i = 2.0;
    while (i / j > 0.0625) {
        j = j + j;
        printf("%f ", sum);
    };
    return 0;
}

The number of times variable sum will be printed When the above program is executed is _________ .


(a) is the correct answer.

Ques 15 Gate 2019


Consider the following C program:

#include<stdio.h>
int main(){
    int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 5}, *ip = arr + 4;
    printf("%dn", ip[1]);
   return 0;
}


The number that will be displayed on execution of the program is _________ .


(a) is the correct answer.

Ques 16 Gate 2019


Consider the following C program:

#include <stdio.h>
int jumble(int x, int y) {
    x = 2 * x + y;
    return x;
}
int main() {
    int x = 2, y = 5;
    y = jumble(y, x);
    x = jumble(y, x);
    printf("%d ", x);
    return 0;
}


The value printed by program is __________


(a) is the correct answer.

Ques 17 Gate 2019


Consider the following C program:

#include<stdio.h>
int r(){
    int static num=7;
    return num--;
}
int main() {
    for(r();r();r()) {
    printf("%d ",r());
};
    return 0;
}
Which one of the following values will be displayed on execution of the programs?

A

41

B

52

C

63

D

630


(b) is the correct answer.

Ques 18 Gate 2019


Consider the following C program:

void convert(int n) {
    if (n < 0)
    printf(“ % d”, n);
    else {
      convert(n / 2);
      printf(“ % d”, n % 2);
}
}
Which one of the following will happen when the function convert is called with any positive integer n as argument?

A

It will print the binary representation of n in the reverse order and terminate.

B

It will print the binary representation of n but will not terminate.

C

It will not print anything and will not terminate.

D

It will print the binary representation of n and terminate.


(c) is the correct answer.

Ques 19 Gate 2019


Consider Z = X →Y where X, Y and Z are all in sign-magnitude form. X and Y are each represented in n bits. To avoid overflow, the representation of Z would require a minimum of:

A

n bits

B

n-1 bits

C

n+1 bits

D

n+2 bits


(c) is the correct answer.

Ques 20 Gate 2019


A certain processor uses a fully associative cache of size 16 kB, The cache block size is 16 bytes. Assume that the main memory is byte addressable and uses a 32-bit address. How many bits are required for the Tag and the Index fields respectively in the addresses generated by the processor?

A

24 bits and 0 bits

B

28 bits and 4 bits

C

24 bits and 4 bits

D

28 bits and 0 bits


(d) is the correct answer.

Ques 21 Gate 2019


Which one of the following kinds of derivation is used by LR parsers?

A

Leftmost

B

Leftmost in reverse

C

Rightmost

D

Rightmost in reverse


(d) is the correct answer.

Ques 22 Gate 2019


Consider the augmented grammar given below:

S′ → S
S → ⏐id
L → L, S⏐S
Let I0= CLOSURE ({[S′ → S]}).

The number of items in the set GOTO (I0, <) is __________.


(5) is the correct answer.

Ques 23 Gate 2019


Consider that 15 machines need to be connected in a LAN using 8-port Ethernet switches. Assume that these switches do not have any separate up link ports. The minimum number of switches needed is ___________.


(3) is the correct answer.

Ques 24 Gate 2019


Consider three machines M, N and P with IP addresses 100.10.5.2, 100.10.5.5 and 100.10.5.6 respectively. The subnet mask is set to 255.255.255.252 for all the three machines. Which one of the following is true?

A

M, N and P all belong to the same subnet

B

Only N and P belong to the same subnet

C

M, N, and P belong to three different subnets

D

Only M and N belong to the same subnet


(b) is the correct answer.

Ques 25 Gate 2019


Which of the following protocol pairs can be used to send and retrieve e-mails (in that order)?

A

IMAP POP3

B

SMTP POP3

C

SMTP, MIME

D

IMAP SMTP


(Computer Network) is the correct answer.

Ques 26 Gate 2019


Let T be a full binary tree with 8 leaves. (A full binary tree has every level full.) Suppose two leaves a and b of T are chosen uniformly and independently at random. The expected value of the distance between a and b in T (i.e., the number of edges in the unique path between a and b) is (rounded off to 2 decimal places) ___________ .


(4.24 to 4.26) is the correct answer.

Unique Visitor Count

Total Unique Visitors

Loading......