Computer Science Study Materials for Competitive Exams

Sample Questions, Previous Year Solved Papers, Study Materials For Competitive Examinations Like UGC NET, SET And GATE Computer Science.

Wednesday, 1 March 2017

GATE Computer Science Solved Paper 2017 Session I - Part 2

11.       Consider the C struct defined below:
struct data {
int marks [100];
char grade;
int cnumber;
struct data student;
The base address of student is available in register R1. The field student.grade can be
accessed efficiently using
(A) Post-increment addressing mode, (R1)+
(B) Pre-decrement addressing mode, -(R1)
(C) Register direct addressing mode, R1
(D) Index addressing mode, X(R1), where X is an offset represented in 2’s complement 16-bit representation.
Answer: D
12.       Consider the following intermediate program in three address code
Which one of the following corresponds to a static single assignment form of the above code?
(A) p1 = a-b
q1 = p1*c
p1 = u*v
q1 = p1+q1
(B) p3 = a-b
q4 = p3*c
p4 = u*v
q5 = p4+q4
(C) p1 = a-b
q1 = p2*c
p3 = u*v
q2 = p4+q3
(D) p1 = a-b
q1 = p*c
p2 = u*v
q2 = p+q
Answer: B
13.       Consider the following C code:
#include <stdio.h>
int *assignval(int *x, int val) {
*x = val;
return x;

void main () {
int *x = malloc(sizeof(int));
if (NULL == x) return;
x = assignval(x,0);
if(x) {
x = (int *)malloc(sizeof(int));
if (NULL == x) return;
x = assignval(x,10);
printf(“%d\n”, *x);
free (x);
The code suffers from which one of the following problems:
(A) compiler error as the return of malloc is not typecast appropriately
(B) compiler error because the comparison should be made as x == NULL and not as shown
(C) compiles successfully but execution may result in dangling pointer
(D) compiles successfully but execution may result in memory leak
Answer: D
14.       Consider a TCP client and a TCP server running on two different machines. After completing data transfer, the TCP client calls close to terminate the connection and a FIN segment is sent to the TCP server. Server-side TCP responds by sending an ACK, which is received by the client-side TCP. As per the TCP connection state diagram (RFC 793), in which state does the client-side TCP connection wait for the FIN from the server-side TCP?
Answer: D
15.       A sender S sends a message m to receiver R. which is digitally signed by S with its private key. In this scenario, one or more of the following security violations can take place.
(I) S can launch a birthday attack to replace m with a fraudulent message.
(II) A third party attacker can launch a birthday attack to replace m with a fraudulent message.
(III) R can launch a birthday attack to replace m with a fraudulent message.
Which of the following are possible security violations?
(A) (I) and (II) only
(B) (I) only
(C) (II) only
(D) (II) and (III) only
Answer: B

16.       The following functional dependencies hold true for the relational schema R{V,W,X,Y,Z}:
Which of the following is irreducible equivalent for this set of functional dependencies?
(A) V→W
(B) V→W
(C) V→W
(D) V→W
Answer: A
17.       Consider the following grammar:
Q→yz | z
R→w | ε
What is FOLLOW(Q)?
(A) {R}
(B) {w}
(C) {w, y}
(D) {w, $)
Answer: C
18.       Threads of a process share
(A) global variables but not heap.
(B) heap but not global variables.
(C) neither global variables nor heap.
(D) both heap and global variables.
Answer: D
19.       Let X be a Gaussian random variable with mean 0 and variance σ2. Let Y = max(X, 0) where max(a, b) is the maximum of a and b. The median of Y is ..................
Answer: 0
20.    Let T be a tree with 10 vertices. The sum of the degrees of all the vertices in T is ......................
Answer: 18.0

Pages   2   3   4   5 

No comments:

Post a Comment