GATE-CS-2016 (Set 1)

Question 1
Out of the following four sentences, select the most suitable sentence with respect to grammar and usage.
A
I will not leave the place until the minister does not meet me.
B
I will not leave the place until the minister doesn’t meet me.
C
I will not leave the place until the minister meet me.
D
I will not leave the place until the minister meets me
GATE-CS-2016 (Set 1)    
Discuss it


Question 1 Explanation: 
Not is already embedded in until. So, A and B are incorrect.   Also, the minister is a single person, and with a singular subject, singular verb follows(ending in 's'). Thus, C is incorrect and D is the right answer.
Question 2
A rewording of something written or spoken is a ______________.
A
paraphrase
B
paradox
C
paradigm
D
paraffin
English    GATE-CS-2016 (Set 1)    
Discuss it


Question 2 Explanation: 
Paraphrase - To express something in different words so that it becomes easy for the listener to understand.   Paradox - A statement which sounds logical, but proves to be illogical when investigated.   Paradigm - A way of looking or thinking (perception) about something.   Paraffin - A flammable substance used in candles, polishes, etc.   So, A is the correct choice.
Question 3
Archimedes said, “Give me a lever long enough and a fulcrum on which to place it, and I will move the world.” The sentence above is an example of a ___________ statement.
A
figurative
B
collateral
C
literal
D
figurine
English    GATE-CS-2016 (Set 1)    
Discuss it


Question 3 Explanation: 
 

Here, we are talking about figure of speech So, figurative is figure of speech meaning : Use of metamorphic meaning of words to explain your thoughts instead of literal use of them.

This solution is contributed by Mohit Gupta.

Question 4
If ‘relftaga’ means carefree, ‘otaga’ means careful and ‘fertaga’ means careless, which of the following could mean ‘aftercare’?
A
zentaga
B
tagafer
C
tagazen
D
relffer
General Aptitude    GATE-CS-2016 (Set 1)    
Discuss it


Question 4 Explanation: 
'taga' and 'care' are a matching pair in every combination. So, 'taga' surely represents 'care'.   Also, note here that the second half of the word in encoded value refers to the first half of the word in the decoded value. So, 'fer' represents 'less', 'relf' represents 'free' and 'o' represents 'full'.   Going by the same logic, the answer would be tagazen, i.e., C.
Question 5
A cube is built using 64 cubic blocks of side one unit. After it is built, one cubic block is removed from every corner of the cube. The resulting surface area of the body (in square units) after the removal is __________.
A
56
B
64
C
72
D
96
General Aptitude    GATE-CS-2016 (Set 1)    
Discuss it


Question 5 Explanation: 
The surface area of the body will remain unchanged as when a cube is removed, it exposes three faces, which makes the number of exposed faces same as before removal.   So, surface area of the body before removal = surface area of the body after removal = 6 * side * side = 6 * 4 * 4 = 96.   Thus, D is the correct choice.
Question 6
A shaving set company sells 4 different types of razors, Elegance, Smooth, Soft and Executive. Elegance sells at Rs. 48, Smooth at Rs. 63, Soft at Rs. 78 and Executive at Rs. 173 per piece. The table below shows the numbers of each razor sold in each quarter of a year.   GATECS161   Which product contributes the greatest fraction to the revenue of the company in that year?
A
Elegance
B
Executive
C
Smooth
D
Soft
General Aptitude    GATE-CS-2016 (Set 1)    
Discuss it


Question 6 Explanation: 
Revenue from Elegance = (27300+25222+28976+21012) * Rs. 48 = Rs. 4920480 Revenue from Smooth = (20009+19392+22429+18229) * Rs. 63 = Rs. 5043717 Revenue from Soft = (17602+18445+19544+16595) * Rs. 78 = Rs. 5630508 Revenue from Executive = (9999+8942+10234+10109) * Rs. 173 = Rs. 6796132 Total Revenue = Rs. 22390837   Fraction of Revenue for Elegance = 0.219 Fraction of Revenue for Smooth = 0.225 Fraction of Revenue for Soft = 0.251 Fraction of Revenue for Executive = 0.303   Thus, B (Executive) is the correct answer.
Question 7
Indian currency notes show the denomination indicated in at least seventeen languages. If this is not an indication of the nation’s diversity, nothing else is. Which of the following can be logically inferred from the above sentences?
A
India is a country of exactly seventeen languages.
B
Linguistic pluralism is the only indicator of a nation’s diversity.
C
Indian currency notes have sufficient space for all the Indian languages.
D
Linguistic pluralism is strong evidence of India’s diversity.
General Aptitude    GATE-CS-2016 (Set 1)    
Discuss it


Question 7 Explanation: 
A is incorrect as it cannot be inferred that exactly 17 languages are there, because the statement says that there are atleast 17 languages on the currency note.   B is incorrect because of the word 'only' in the option, which is too strong to be inferred.   C is incorrect as it says 'space for all Indian languages', but the number of languages in India is not mentioned in the question.   D is correct as it can be easily inferred from the statement.
Question 8
Consider the following statements relating to the level of poker play of four players P, Q, R, and S.
I    P always beats Q
II.  R always beats S
III. S loses to P only sometimes
IV.  R always loses to Q 
Which of the following can be logically inferred from the above statements?
(i) P is likely to beat all the three other players
(ii) S is the absolute worst player in the set 
A
(i) only
B
(ii) only
C
(i) and (ii)
D
neither (i) nor (ii)
General Aptitude    GATE-CS-2016 (Set 1)    
Discuss it


Question 8 Explanation: 
All three can Beat S, but S loses to P only sometimes. So, (ii) can not be inferred from the given statements. Defeating in Poker is not transitive. P beats Q. Q beats R and R beats S. Yet S loses to P only sometimes, meaning that S mostly wins against P. So we can not logically infer that P is likely to beat R.
Question 9
If f(x) = 2x7 + 3x - 5 Which of the following is a factor of f(x)?
A
(x3 + 8)
B
(x - 1)
C
(2x - 5)
D
(x + 1)
General Aptitude    GATE-CS-2016 (Set 1)    
Discuss it


Question 9 Explanation: 
f(x) = 2x7 + 3x - 5
     = 2x7 - 2x + 5x - 5
Putting x = 1, we get f(x) = 0. So, x-1 is a factor of f(x).   Thus, B is the correct choice.
Question 10
In a process, the number of cycles to failure decreases exponentially with an increase in load. At a load of 80 units, it takes 100 cycles for failure. When the load is halved, it takes 10000 cycles for failure. The load for which the failure will happen in 5000 cycles is ________.
A
40.00
B
46.02
C
60.01
D
92.02
General Aptitude    GATE-CS-2016 (Set 1)    
Discuss it


Question 10 Explanation: 
For exponential dependence we must have functions of form
f(x) = a.(k power x) : a,k are constants and f(0)=a

Let us assume: C = cycles for failure ; L = Load; a, k = constants
according to question C is an exponential function of L
Hence we can say,

1) C = a x (k^L) ---- > in case C is increasing exponentially
2) C = a / (k^L) ---- > in case C is decreasing exponentially

we take 2nd equation and apply log to both side we get:

log C + L x (log k) = log a ...... by logarithmic property

given (C=100 for L=80) and (C=10000 for L=40)
apply these to values to above equation, this gives us 2 equations
and 2 variables:

log a = log 100 + (80 x log k)...............(1)
log a = log 10000 + (40 x log k)...........(2)

we have 2 variables and 2 equations hence we find
log a = 6
log k= 1/20

now find, [ L = (log a - log C) / (log k) ] for C=5000 cycles

=> L = (6 - log 5000)*20 = 46.0206 ~ 46.02 => [ANS]
Question 11
Let p, q, r, s represent the following propositions.
p: {8, 9, 10, 11, 12}
q: x is a composite number
r: x is a perfect square
s: x is a prime number
gatecs20162   Note : This question was asked as Numerical Answer Type.
A
8
B
9
C
11
D
12
GATE-CS-2016 (Set 1)    
Discuss it


Question 11 Explanation: 
(p ⇒ q) will give {8, 9, 10, 12} ¬r will give {8, 10, 11, 12} ¬s will give {8, 9, 10, 12} (¬r ∨ ¬s) will give {8, 9, 10, 11, 12} (p ⇒ q) ∧ (¬r ∨ ¬s) will give {8, 9, 10, 12} ¬((p ⇒ q) ∧ (¬r ∨ ¬s)) will give 11. Thus, C is the correct option.
Question 12
Let an be the number of n-bit strings that do NOT contain two consecutive 1s. Which one of the following is the recurrence relation for an gatecs20163
A
A
B
B
C
C
D
D
GATE-CS-2016 (Set 1)    
Discuss it


Question 12 Explanation: 
The least value of 'n' for the recursion would be 3. For n = 1, number of strings = 2 (0, 1) For n = 2, number of strings = 3 (00, 01, 10) For n = 3, number of strings = 5 (000, 001, 010, 100, 101) For n = 4, number of strings = 8 (0000, 0001, 0010, 0100, 1000, 0101, 1010, 1001) ...   This seems to follow Fibonacci series and the recurrence relation for it is an = an−1 + an−2. Thus, B is the correct choice.   http://www.geeksforgeeks.org/count-number-binary-strings-without-consecutive-1s/
Question 13
gatecs20164   Note : This question was asked as Numerical Answer Type.
A
0
B
1
C
2
D
3
Numerical Methods and Calculus    GATE-CS-2016 (Set 1)    
Discuss it


Question 13 Explanation: 
Put y = x - 4. So, the problem becomes limy->0 (sin y) / y = 1. (Property of Limits on sin)   Thus, B is the correct choice.
Question 14
A probability density function on the interval [a, 1] is given by 1 / x2 and outside this interval the value of the function is zero. The value of a is :   Note : This question was asked as Numerical Answer Type.
A
-1
B
0
C
1
D
0.5
Probability    GATE-CS-2016 (Set 1)    
Discuss it


Question 14 Explanation: 
[Tex] \int_{a}^{1} (\frac{1}{x^{2}}) = \left [ \frac{-1}{x} \right ]_{a}^{1} = \left [ -1 + \frac{1}{a} \right ] [/Tex] But, this is equal to 1. So, (-1) + (1/a) = 1 Therefore, a = 0.5 Thus, D is the correct option.
Question 15
Two eigenvalues of a 3 x 3 real matrix P are (2 + √ -1) and 3. The determinant of P is _____   Note : This question was asked as Numerical Answer Type.
A
0
B
1
C
15
D
-1
Linear Algebra    GATE-CS-2016 (Set 1)    
Discuss it


Question 15 Explanation: 
The determinant of a real matrix can never be imaginary. So, if one eigen value is complex, the other eigen value has to be its conjugate.   So, the eigen values of the matrix will be 2+i, 2-i and 3.   Also, determinant is the product of all eigen values. So, the required answer is (2+i)*(2-i)*(3) = (4-i2)*(3) = (5)*(3) = 15.   Thus, C is the required answer.
Question 16
Consider the Boolean operator # with the following properties: x#0 = x, x#1 = x', x#x = 0 and x#x' = 1 Then x#y is equivalent to
A
x'y + xy'
B
xy' + (xy)
C
x'y + xy
D
xy + (xy)'
GATE-CS-2016 (Set 1)    
Discuss it


Question 16 Explanation: 
The function # basically represents XOR. Following are true with XOR. 1) XOR of x with 0 is x itself. 2) XOR of x with 1 is complement of x. 3) XOR of x with x is 0. 4) XOR of x with x' is 1. XOR is represented as x'y + y'x.
Question 17
The 16-bit 2’s complement representation of an integer is 1111 1111 1111 0101; its decimal representation is   Note : This question was asked as Numerical Answer Type.
A
10
B
11
C
-10
D
-11
Number Representation    GATE-CS-2016 (Set 1)    
Discuss it


Question 18
We want to design a synchronous counter that counts the sequence 0-1-0-2-0-3 and then repeats. The minimum number of J-K flip-flops required to implement this counter is   Note : This question was asked as Numerical Answer Type.
A
1
B
2
C
4
D
5
Digital Logic & Number representation    GATE-CS-2016 (Set 1)    
Discuss it


Question 18 Explanation: 
Total 4. 2 J-K flip- flops for synchronous counter + 2 J-K flip-flop to make 2 bit counter. Actually, when we are repeating again then after 3 we don't know that our Synchronous counter will go to which zero. To make it work right, we need to move it to 1st zero after 3 2nd zero after 1 3rd zero after 2 i.e. 0 -> 1 -> 0 -> 2 -> 0 -> 3 (from here it again go to 1st zero). In order to decide which zero to move on we use counter from 1 to 3, I have attached truth table of normal 2 bit synchronous counter using JK flip flop. bit-counter // This Explanation has been contributed by Mohit Gupta
Question 19
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.   Note : This question was asked as Numerical Answer Type.
A
16
B
31
C
32
D
None
Computer Organization and Architecture    GATE-CS-2016 (Set 1)    
Discuss it


Question 19 Explanation: 
Maximum Memory = 4GB = 232 bytes Size of a word = 2 bytes Therefore, Number of words = 232 / 2 = 231 So, we require 31 bits for the address bus of the processor.   Thus, B is the correct choice.
Question 20
A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is CORRECT (n refers to the number of items in the queue)?
A
Both operations can be performed in O(1) time
B
At most one operation can be performed in O(1) time but the worst case time for the other operation will be Ω(n)
C
The worst case time complexity for both operations will be Ω(n)
D
Worst case time complexity for both operations will be Ω(log n)
Queue    GATE-CS-2016 (Set 1)    
Discuss it


Question 20 Explanation: 
We can use circular array to implement both in O(1) time. See below article for details.    
Question 21
Consider the following directed graph. GATECS20167 The number of different topological orderings of the vertices of the graph is   Note : This question was asked as Numerical Answer Type.
A
1
B
2
C
4
D
6
Graph Traversals    GATE-CS-2016 (Set 1)    
Discuss it


Question 21 Explanation: 
Following are different 6 Topological Sortings
a-b-c-d-e-f
a-d-e-b-c-f
a-b-d-c-e-f
a-d-b-c-e-f
a-b-d-e-c-f
a-d-b-e-c-f
Question 22
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)
Functions    GATE-CS-2016 (Set 1)    
Discuss it


Question 22 Explanation: 
i is integer and *p is value of a pointer to short. 1) Option 1 is wrong because we are passing "*S" as second argument check that S is not a pointer variable .So error 2) Second option is we are trying to store the value of f(i,s) into i but look at the function definition outside main it has no return type. It is simply void so that assignment is wrong. So error 3) Option 3 is wrong because of the same reason why option 1 is wrong 4) So option d is correct.
Question 23
The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are:
A
Θ(n log n), Θ(n log n) and Θ(n2)
B
Θ(n2), Θ(n2) and Θ(n Log n)
C
Θ(n2), Θ(n log n) and Θ(n log n)
D
Θ(n2), Θ(n log n) and Θ(n2)
Analysis of Algorithms    Sorting    GATE-CS-2016 (Set 1)    
Discuss it


Question 23 Explanation: 
  • Insertion Sort takes Θ(n2) in worst case as we need to run two loops. The outer loop is needed to one by one pick an element to be inserted at right position. Inner loop is used for two things, to find position of the element to be inserted and moving all sorted greater elements one position ahead. Therefore the worst case recursive formula is T(n) = T(n-1) + Θ(n).
  • Merge Sort takes Θ(n Log n) time in all cases. We always divide array in two halves, sort the two halves and merge them. The recursive formula is T(n) = 2T(n/2) + Θ(n).
  • QuickSort takes Θ(n2) in worst case. In QuickSort, we take an element as pivot and partition the array around it. In worst case, the picked element is always a corner element and recursive formula becomes T(n) = T(n-1) + Θ(n). An example scenario when worst case happens is, arrays is sorted and our code always picks a corner element as pivot.
   
Question 24
Let G be a weighted connected undirected graph with distinct positive edge weights. If every edge weight is increased by the same value, then which of the following statements is/are TRUE?
P: Minimum spanning tree of G does not change
Q: Shortest path between any pair of vertices does not change
A
P only
B
Q only
C
Neither P nor Q
D
Both P and Q
Graph Minimum Spanning Tree    GATE-CS-2016 (Set 1)    
Discuss it


Question 24 Explanation: 
The shortest path may change. The reason is, there may be different number of edges in different paths from s to t. For example, let shortest path be of weight 15 and has 5 edges. Let there be another path with 2 edges and total weight 25. The weight of the shortest path is increased by 5*10 and becomes 15 + 50. Weight of the other path is increased by 2*10 and becomes 25 + 20. So the shortest path changes to the other path with weight as 45. The Minimum Spanning Tree doesn't change. Remember the Kruskal's algorithm where we sort the edges first. IF we increase all weights, then order of edges won't change.
Question 25
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("%d\n", a);
}
The output of the program _____________   Note : This question was asked as Numerical Answer Type.
A
2016
B
0
C
4
D
8
Pointer Basics    GATE-CS-2016 (Set 1)    
Discuss it


Question 25 Explanation: 
Note that a and d are not swapped as the function mystery() doesn't change values, but pointers which are local to the function.
Question 26
Which of the following languages is generated by the given grammar?
S -> aS|bS|ε 
GATECS20168
A
A
B
B
C
C
D
D
Regular languages and finite automata    GATE-CS-2016 (Set 1)    
Discuss it


Question 26 Explanation: 
We can generate ε, a, ab, abb, b, aaa, .....
Question 27
Which of the following decision problems are undecidable GATECS20169
A
I and IV only
B
II and III only
C
III and IV only
D
II and IV only
Undecidability    GATE-CS-2016 (Set 1)    
Discuss it


Question 27 Explanation: 
A problem is undecidable if there is no algorithm to find the solution for it. Problem give in III and IV have no solutions, so these are undecidable.
Question 28
Which one of the following regular expressions represents the language: the set of all binary strings having two consecutive 0s and two consecutive 1s? gatecs201611
A
A
B
B
C
C
D
D
Regular languages and finite automata    GATE-CS-2016 (Set 1)    
Discuss it


Question 28 Explanation: 
Option A represents those strings which either have 0011 or 1100 as substring. Option C represents those strings which either have 00 or 11 as substring. Option D represents those strings which start with 11 and end with 00 or start with 00 and end with 11.
Question 29
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   Note : This question was asked as Numerical Answer Type.
A
6
B
8
C
9
D
10
Code Generation and Optimization    GATE-CS-2016 (Set 1)    
Discuss it


Question 29 Explanation: 
Static Single Assignment is used for intermediate code in compiler design. In Static Single Assignment form(SSA) each assignment to a variable should be specified with distinct names. We use subscripts to distinguish each definition of variables. In the given code segment, there are two assignments of the variable x
x = u - t;
x = y + w;
and three assignments of the variable y.
y = x * v;
y = t - z;
y = x * y 
So we use two variables x1, x2 for specifying distinct assignments of x and y1, y2 and y3 each assignment of y. So, total number of variables is 10 (x1, x2, y1, y2, y3, t, u, v, w, z). Static Single Assignment form(SSA) of the given code segment is:
x1 = u - t;
y1 = x1 * v;
x2 = y1 + w;
y2 = t - z;
y3 = x2 * y2;
Please refer below link for details https://www.cs.cmu.edu/~fp/courses/15411-f08/lectures/09-ssa.pdf
Question 30
Consider an arbitrary set of CPU-bound processes with unequal CPU burst lengths submitted at the same time to a computer system. Which one of the following process scheduling algorithms would minimize the average waiting time in the ready queue?
A
Shortest remaining time first
B
Round-robin with time quantum less than the shortest CPU burst
C
Uniform random
D
Highest priority first with priority proportional to CPU burst length
CPU Scheduling    GATE-CS-2016 (Set 1)    
Discuss it


Question 30 Explanation: 
Turnaround time is the total time taken by the process between starting and the completion and waiting time is the time for which process is ready to run but not executed by CPU scheduler. As we know, in all CPU Scheduling algorithms, shortest job first is optimal i.ie. it gives minimum turn round time, minimum average waiting time and high throughput and the most important thing is that shortest remaining time first is the pre-emptive version of shortest job first. shortest remaining time first scheduling algorithm may lead to starvation because If the short processes are added to the cpu scheduler continuously then the currently running process will never be able to execute as they will get pre-empted but here all the processes are arrived at same time so there will be no issue such as starvation. So, the answer is Shortest remaining time first, which is answer (A). Reference: https://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/5_CPU_Scheduling.html http://geeksquiz.com/gate-notes-operating-system-process-scheduling/ This solution is contributed by Nitika Bansal
Question 31
Which of the following is NOT a superkey in a relational schema with attributes V, W, X, Y, Z and primary key V Y ?
A
V X Y Z
B
V W X Z
C
V W X Y
D
V W X Y Z
Database Design(Normal Forms)    GATE-CS-2016 (Set 1)    
Discuss it


Question 31 Explanation: 
Super key = Candidate Key + other attributes. But option B does not include Y which is a part of PK or candidate key.
Question 32
Which one of the following is NOT a part of the ACID properties of database transactions?
A
Atomicity
B
Consistency
C
Isolation
D
Deadlock-freedom
Transactions and concurrency control    GATE-CS-2016 (Set 1)    
Discuss it


Question 32 Explanation: 
D refers to Durability.
Question 33
A database of research articles in a journal uses the following schema.
(VOLUME, NUMBER, STARTPGE, ENDPAGE, TITLE, YEAR, PRICE) 
The primary key is (VOLUME, NUMBER, STARTPAGE, ENDPAGE) and the following functional dependencies exist in the schema.
(VOLUME, NUMBER, STARTPAGE, ENDPAGE) -> TITLE
(VOLUME, NUMBER)                     -> YEAR
(VOLUME, NUMBER, STARTPAGE, ENDPAGE) -> PRICE 
The database is redesigned to use the following schemas.
(VOLUME, NUMBER, STARTPAGE, ENDPAGE, TITLE, PRICE)
(VOLUME, NUMBER, YEAR) 
Which is the weakest normal form that the new database satisfies, but the old one does not?
A
1NF
B
2NF
C
3NF
D
BCNF
ER and Relational Models    GATE-CS-2016 (Set 1)    
Discuss it


Question 33 Explanation: 
Volume, Number -> Year is partial dependency. So it does not follow 2NF. But decomposed relation follows.
Question 34
Which one of the following protocols is NOT used to resolve one form of address to another one?
A
DNS
B
ARP
C
DHCP
D
RARP
Misc Topics in Computer Networks    GATE-CS-2016 (Set 1)    
Discuss it


Question 34 Explanation: 
DHCP is used to assign IP dynamically. All others are used to convert one address to other.
Question 35
Which of the following is/are example(s) of stateful application layer protocols?
(i)  HTTP
(ii) FTP
(iii) TCP
(iv) POP3 
A
(i) and (ii) only
B
(ii) and (iii) only
C
(ii) and (iv) only
D
(iv) only
Application Layer    GATE-CS-2016 (Set 1)    
Discuss it


Question 35 Explanation: 
In computing, a stateless protocol is a communications protocol that treats each request as an independent transaction that is unrelated to any previous request so that the communication consists of independent pairs of request and response. Examples of stateless protocols (IP) and (HTTP) Source: https://en.wikipedia.org/wiki/Stateless_protocol TCP is stateful as it maintains connection information across multiple transfers, but TCP is not an application layer protocol. Of the given protocols, only FTP and POP3 are stateful application layer protocols.  
Question 36
The coefficient of x12 in (x3 + x4 + x5 + x6 + ...)3 is. [This Question was originally a Fill-in-the-Blanks question]
A
1
B
2
C
4
D
10
General Aptitude    GATE-CS-2016 (Set 1)    
Discuss it


Question 36 Explanation: 
The expression can be re-written as: (x3 (1+ x + x2 + x3 + ...))3=x9(1+(x+x2+x3))3 Expanding (1+(x+x2+x3))3 using binomial expansion (1+(x+x2+x3))3 = 1+3(x+x2+x3)+3*2/2((x+x2+x3)2+3*2*1/6(x+x2+x3)3….. The coefficient of x3 will be 10, it is multiplied by x9 outside, so coefficient of x12 is 10.
Question 37
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.
A
190
B
296
C
198
D
200
Analysis of Algorithms (Recurrences)    GATE-CS-2016 (Set 1)    
Discuss it


Question 37 Explanation: 
a1 = 8 an = 6n2 + 2n + an-1   an = 6[n2 + (n-1)2] + 2[n + (n-1)] + an-2   Continuing the same way till n=2, we get an = 6[n2 + (n-1)2 + (n-2)2 + ... + (2)2] + 2[n + (n-1) + (n-2) + ... + (2)] + a1   an = 6[n2 + (n-1)2 + (n-2)2 + ... + (2)2] + 2[n + (n-1) + (n-2) + ... + (2)] + 8   an = 6[n2 + (n-1)2 + (n-2)2 + ... + (2)2] + 2[n + (n-1) + (n-2) + ... + (2)] + 6 + 2   an = 6[n2 + (n-1)2 + (n-2)2 + ... + (2)2 + 1] + 2[n + (n-1) + (n-2) + ... + (2) + 1]   an = (n)*(n+1)*(2n+1) + (n)(n+1) = (n)*(n+1)*(2n+2)   an = 2*(n)*(n+1)*(n+1) = 2*(n)*(n+1)2   Now, put n=99. a99 = 2*(99)*(100)2 = 1980000 = K * 104 Therefore, K = 198.   Thus, C is the correct choice.
Question 38
GATECS201612 [This Question was originally a Fill-in-the-Blanks question]
A
1
B
2
C
3
D
4
Set Theory & Algebra    GATE-CS-2016 (Set 1)    
Discuss it


Question 38 Explanation: 
Let us assume: f(1) = x. Then,
 f(2) = f(2/2) = f(1) = x
 f(3) = f(3+5) = f(8) = f(8/2) = f(4/2) = f(2/1) = f(1) = x
Similarly, f(4) = x
  f(5) = f(5+5) = f(10/2) = f(5) = y.
So it will have two values. All multiples of 5 will have value y and others will have value x. It will have 2 different values.
Question 39
Consider the following experiment.
Step 1. Flip a fair coin twice.
Step 2. If the outcomes are (TAILS, HEADS) then output Y and stop.
Step 3. If the outcomes are either (HEADS, HEAD) or (HEADS, TAILS), 
        then output N and stop.
Step 4. If the outcomes are (TAILS, TAILS), then go to Step 1.
The probability that the output of the experiment is Y is (up to two decimal places). [This Question was originally a Fill-in-the-Blanks question]
A
0.33
B
0.25
C
0.5
D
0.27
Probability    GATE-CS-2016 (Set 1)    
Discuss it


Question 39 Explanation: 
  A fair coin is flipped twice => {(HH),(HT),(TH),(TT)} four outcomes. Given, if (TH) comes, output ‘Y’. If (HH),or (HT) comes, output ‘N’. If (TT) comes, again flip coin twice. Let, P = probability of getting (TH) or output ‘Y’=1/4. Let, Q= probability of getting (TT) or again flipping coin twice =1/4. Then, probability of getting output ‘Y’= probability of event ‘P’ occurring 1st time (OR) probability of event ‘P’ occurring 2nd time (OR) probability of event ‘P’ occurring 3rd time+……… =P+QP+QQP+QQQP+QQQQP……. =(1/4)+(1/4*1/4)+ (1/4*1/4*1/4)+( 1/4*1/4*1/4*1/4)+…….. It is and infinite GP where, ‘a’=1/4 and ‘r’= 1/4. So, answer= sum= (1/4)/(1-(1/4))=1/3=0.33   This solution is contributed by Sandeep pandey.
Question 40
Consider the two cascaded 2-to-1 multiplexers as shown in the figure. GT20161 The minimal sum of products form of the output X is gt162
A
A
B
B
C
C
D
D
Digital Logic & Number representation    GATE-CS-2016 (Set 1)    
Discuss it


Question 40 Explanation: 
Assume P=0 and Q=0 The output should be R' Only option D satisfies this case.   Hence, D is the correct choice.
Question 41
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 _________   Note : This question was asked as Numerical Answer Type.
A
3644
B
3645
C
456
D
1823
Computer Organization and Architecture    GATE-CS-2016 (Set 1)    
Discuss it


Question 41 Explanation: 
Size of data count register of the DMA controller = 16 bits Data that can be transferred in one go = 216 bytes = 64 kilobytes File size to be transferred = 29154 kilobytes So, 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 = ceil(29154/64) = 456   Thus, C is the correct answer.
Question 42
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. [This Question was originally a Fill-in-the-Blanks question]
A
33 or 34
B
30 or 31
C
38 or 39
D
100
Computer Organization and Architecture    GATE-CS-2016 (Set 1)    
Discuss it


Question 42 Explanation: 
Throughput of 1st case T1: 1/max delay =1/800
Throughput of 2nd case T2: 1/max delay= 1/600
%age increase in throughput: (T2-T1)/T2
            = ( (1/600) - (1/800) ) / (1/800)
            = 33.33%
Question 43
Consider a carry lookahead adder for adding two n-bit integers, built using gates of fan-in at most two. The time to perform addition using this adder is
A
Θ(1)
B
Θ(Log (n))
C
Θ(√ n)
D
Θ(n)
Digital Logic & Number representation    GATE-CS-2016 (Set 1)    
Discuss it


Question 43 Explanation: 
Look ahead carry generator gives output in constant time if fan-in = number of inputs. For Example:
It will take O(1) to calculate 
c4 = g3 + p3g2 + p3p2g1 + p3p2p1g0 + p3p2p1p0c0c4 
   = g3 + p3g2 + p3p2g1 + p3p2p1g0 + p3p2p1p0c0, 
              if OR gate with 5 inputs is present.
And, if fan-in != number of inputs then we will have delay in each level, as given below. If we have 8 inputs, and OR gate with 2 inputs, to build an OR gate with 8 inputs, we will need 4 gates in level-1, 2 in level-2 and 1 in level-3. Hence 3 gate delays, for each level. Similarly an n-input gate constructed with 2-input gates, total delay will be O(log n). // This Explanation has been provided by Saksham Raj Seth.
Question 44
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
Arrays    GATE-CS-2016 (Set 1)    
Discuss it


Question 44 Explanation: 
#include<iostream>
int max(int *p, int n)
{
    int a=0, b=n-1;
    while (a!=b)
    {
        if (p[a] <= p[b])
        {
            a = a+1;
        }
        else
        {
            b = b-1;
        }
    }
    return p[a];
}

int main()
{
   int arr[] = {10, 5, 1, 40, 30};
   int n = sizeof(arr)/sizeof(arr[0]);
   std::cout << max(arr, 5);
}


Question 45
What will be the output of the following C program?
void count(int n)
{
    static int d = 1;
    printf("%d ", n);
    printf("%d ", d);
    d++;
    if(n > 1) count(n-1);
    printf("%d ", d);
}
int main()
{
    count(3);
}
A
3 1 2 2 1 3 4 4 4
B
3 1 2 1 1 1 2 2 2
C
3 1 2 2 1 3 4
D
3 1 2 1 1 1 2
Recursion    GATE-CS-2016 (Set 1)    
Discuss it


Question 45 Explanation: 
count(3) will print value of n and d. So 3 1 will be printed 
and d will become 2. 

Then count(2) will be called. It will print value of n and d. 
So 2 2 will be printed and d will become 3. 

Then count(1) will be called. It will print value of n and d.
So 1 3 will be printed and d will become 4. 

Now count(1) will print value of d which is 4. count(1) will 
finish its execution. 

Then count(2) will print value of d which is 4. 

Similarly, count(3) will print value of d which is 4. 
So series will be A.
Question 46
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
Principles of Programming Languages    GATE-CS-2016 (Set 1)    
Discuss it


Question 46 Explanation: 
a = 3;

void main() 
{  
   // Calls m with 'a' being passed by reference
   // Since there is no local 'a', global 'a' is passed. 
   m(a);
} 


// y refers to global 'a' as main calls "m(a)"
void m(y) 
{
   // A local 'a' is created with value 1.
   a = 1; 

   // a = 3 - 1 = 2
   a = y - a; 

   // Local 'a' with value 2 is passed by 
   // reference to n()
   n(a); 

   // Modified local 'a' is printed
   print(a);
}

// Local 'a' of m is passed here
void n(x) 
{
  // x = 2 * 2 [Note : again local 'a' is referred
  //                   because of dynamic scoping]  
  x = x * a; 

  // 4 is printed and local 'a' of m() is also
  // changed to 4.
  print(x);
}
Question 47
An operator delete(i) for a binary heap data structure is to be designed to delete the item in the i-th node. Assume that the heap is implemented in an array and i refers to the i-th index of the array. If the heap tree has depth d (number of edges on the path from the root to the farthest leaf), then what is the time complexity to re-fix the heap efficiently after the removal of the element?
A
O(1)
B
O(d) but not O(1)
C
O(2d) but not O(d)
D
O(d2d) but not O(2d)
Heap    GATE-CS-2016 (Set 1)    
Discuss it


Question 47 Explanation: 
  For this question, we have to slightly tweak the delete_min() operation of the heap data structure to implement the delete(i) operation. The idea is to empty the spot in the array at the index i (the position at which element is to be deleted) and replace it with the last leaf in the heap (remember heap is implemented as complete binary tree so you know the location of the last leaf), decrement the heap size and now starting from the current position i (position that held the item we deleted), shift it up in case newly replaced item is greater than the parent of old item  (considering max-heap).  If it’s not greater than the parent, then percolate it down by comparing with the child’s value. The newly added item can percolate up/down a maximum of d times which is the depth of the heap data structure. Thus we can say that complexity of delete(i) would be O(d) but not O(1). http://geeksquiz.com/binary-heap/   This solution is contributed by Pranjul Ahuja.
Question 48
Consider the weighted undirected graph with 4 vertices, where the weight of edge {i, j} g is given by the entry Wij in the matrix W gt164 The largest possible integer value of x, for which at least one shortest path between some pair of vertices will contain the edge with weight x is ________   Note : This question was asked as Numerical Answer Type.
A
8
B
12
C
10
D
11
Graph Shortest Paths    GATE-CS-2016 (Set 1)    
Discuss it


Question 48 Explanation: 
Let vertices be 0, 1, 2 and 3. x directly connects 2 to 3. The shortest path (excluding x) from 2 to 3 is of weight 12 (2-1-0-3).
Question 49
Let G be a complete undirected graph on 4 vertices, having 6 edges with weights being 1, 2, 3, 4, 5, and 6. The maximum possible weight that a minimum weight spanning tree of G can have is. [This Question was originally a Fill-in-the-Blanks question]
A
6
B
7
C
8
D
9
Graph Minimum Spanning Tree    GATE-CS-2016 (Set 1)    
Discuss it


Question 49 Explanation: 
One graph that has maximum possible weight of spanning tree gatesol
Question 50
G = (V, E) is an undirected simple graph in which each edge has a distinct weight, and e is a particular edge of G. Which of the following statements about the minimum spanning trees (MSTs) of G is/are TRUE
I.  If e is the lightest edge of some cycle in G, 
    then every MST of G includes e
II. If e is the heaviest edge of some cycle in G, 
    then every MST of G excludes e
A
I only
B
II only
C
both I and II
D
neither I nor II
Graph Minimum Spanning Tree    GATE-CS-2016 (Set 1)    
Discuss it


Question 50 Explanation: 
I is NOT true. Let G=(V, E) be a rectangular graph where V = {a, b, c, d} and E = {ab, bc, cd, da, ac}. Let the edges have weights: ab = 1, bc = 2, cd = 4, da = 5, ac = 3. Then, clearly, ac is the lightest edge of the cycle cdac, however, the MST abcd with cost 7 (= ab + bc + cd) does not include it. Let the edges have weights: ab = 6, bc - 7, cd = 4, da = 5, ac = 3. Then, again, ac is the lightest edge of the cycle cdac, and, the MST bacd with cost 13 (= ba + ac + cd) includes it. So, the MSTs of G may or may not include the lightest edge. II is true Let the heavies edge be e. Suppose the minimum spanning tree which contains e. If we add one more edge to the spanning tree we will create a cycle. Suppose we add edge e' to the spanning tree which generated cycle C. We can reduce the cost of the minimum spanning tree if we choose an edge other than e from C for removal which implies that e must not be in minimum spanning tree and we get a contradiction. Source: http://www.ece.northwestern.edu/~dda902/336/hw5-sol.pdf
Question 51
Let Q denote a queue containing sixteen numbers and S be an empty stack. Head(Q) returns the element at the head of the queue Q without removing it from Q. Similarly Top(S) returns the element at the top of S without removing it from S. Consider the algorithm given below. gtcs7 The maximum possible number of iterations of the while loop in the algorithm is______ [This Question was originally a Fill-in-the-Blanks question]
A
16
B
32
C
256
D
64
Queue    GATE-CS-2016 (Set 1)    
Discuss it


Question 51 Explanation: 
The worst case happens when the queue is sorted in decreasing order. In worst case, loop runs n*n times.
Queue: 4 3 2 1
Stack: Empty

3 2 1
4

3 2 1 4
Empty

2 1 4
3

2 1 4 3
Empty

1 4 3
2

1 4 3 2
Empty

4 3 2
1

3 2
1 4

3 2 4
1

2 4
1 3

2 4 3
1

4 3
1 2

3 
1 2 4

3 4 
1 2

4
1 2 3

Empty
1 2 3 4
Question 52
Consider the following context-free grammars: gt8 Which one of the following pairs of languages is generated by G1 and G2, respectively gt9
A
A
B
B
C
C
D
D
Context free languages and Push-down automata    GATE-CS-2016 (Set 1)    
Discuss it


Question 52 Explanation: 
In G1, there will be atleast 1 b becase S->B and B->b. But no of A’s can be 0 as well and no of A and B are independent. In G2, either we can take S->aA or S->bB. So it must have atleast 1 a or 1 b. So option D is correct.
Question 53
Consider the transition diagram of a PDA given below with input alphabet &Sum; = {a, b}and stack alphabet &Gamma; = {X, Z}. Z is the initial stack symbol. Let L denote the language accepted by the PDA.
gt11
A
A
B
B
C
C
D
D
GATE-CS-2016 (Set 1)    
Discuss it


Question 53 Explanation: 
 

In the given PDA we can number the states as q1, q2 and q3 from left to right.

The transitions of the PDA are as follows:

  1. (q1, a, Z) ->(q1, XZ )

  2. (q1, a, X) ->(q1, XX )

  3. (q1, b, X) ->(q2, € )

  4. (q2, b, X) ->(q2, € )

  5. (q2, €, Z) ->(q3, Z)

As initial state is the final state hence null string is always accepted by the PDA. The first two transitions show that state remains q1 (final state) on ‘a’ input alphabet and with every ‘a’ we push X onto the stack. Hence an is always accepted for n≥0. Transitions 3 and 4 shows that for input alphabet ‘b’ and stack symbol X (i.e. ‘a’ occurred in the string) we can pop X from the stack. Transition 5 shows that we can move to the final state (q3) only when the string is empty and stack symbol is Z. This is possible when we have popped all X from the stack i.e. ‘b’ occurred exactly the same times as ‘a’. Hence anbn is always accepted for n≥0. The language accepted by the PDA is { an | n≥0 } U { anbn | n≥0 } and is a Deterministic CFL. (anbn | n≥0 is not regular but is accepted by a PDA). Hence option (D).

This solution is contributed by Yashika Arora.
Question 54
Let X be a recursive language and Y be a recursively enumerable but not recursive language. Let W and Z be two languages such that Y' reduces to W, and Z reduces to X' (reduction means the standard many-one reduction). Which one of the following statements is TRUE
A
W can be recursively enumerable and Z is recursive.
B
W an be recursive and Z is recursively enumerable.
C
W is not recursively enumerable and Z is recursive.
D
W is not recursively enumerable and Z is not recursive
Recursively enumerable sets and Turing machines    GATE-CS-2016 (Set 1)    
Discuss it


Question 54 Explanation: 
Since X is recursive and recursive language is closed under complement. So X’ is also recursive. Since  Z X’ is recursive. (Rule : if Z is reducible to X’ , and X’ is recursive, then Z is recursive.) Option (B) and (D) is eliminated. And Y is recursive enumerable but not recursive, so Y’ cannot be recursively enumerable. Since Y’ reduces to W. And we know complement of recursive enumerable is not recursive enumerable and therefore, W is not recursively enumerable. So Correct option is (C). Here Y’ is complement of Y and X’ is complement of X.   This solution is contributed by Abhishek Agrawal.
Question 55
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 __________ ?   Note : This question was asked as Numerical Answer Type.
A
1
B
2
C
3
D
9
Principles of Programming Languages    GATE-CS-2016 (Set 1)    
Discuss it


Question 55 Explanation: 
= 2 - 5 + 1 - 7 * 3 = 2 - 6 - 7 * 3 = 2 - (-1) * 3 = 3 * 3 = 9
Question 56
Consider the following Syntax Directed Translation Scheme (SDTS), with non-terminals {S, A} and terminals {a, b}}. gt46 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
Parsing and Syntax directed translation    GATE-CS-2016 (Set 1)    
Discuss it


Question 56 Explanation: 
Bottom up parser builds the parse tree from bottom to up, i.e from the given string to the starting symbol. The given string is aab and starting symbol is S. so the process is to start from aab and reach S. =>aab ( given string) =>aSb (after reduction by S->a, and hence print 2) =>aA (after reduction by A->Sb, and hence print 3) =>S (after reduction by S->aA, and hence print 1) As we reach the starting symbol from the string, the string belongs to the language of the grammar. Another way to do the same thing is :- bottom up parser does the parsing by RMD in reverse. RMD is as follows: =>S => aA (hence, print 1) => aSb (hence, print 3) => aab (hence, print 2) If we take in Reverse it will print : 231
Question 57
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.
A
384
B
48
C
192
D
96
Memory Management    GATE-CS-2016 (Set 1)    
Discuss it


Question 57 Explanation: 
Size of memory = 240 Page size = 16KB = 214   No of pages= size of Memory/ page size = 240 / 214 = 226 Size of page table = 226 * 48/8 bytes = 26*6 MB =384 MB   Thus, A is the correct choice.
Question 58
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.
A
346
B
165
C
154
D
173
Input Output Systems    GATE-CS-2016 (Set 1)    
Discuss it


Question 58 Explanation: 
The head movement would be :
63 => 87 24 movements
87 => 92 5 movements
92 => 121 29 movements
121 => 191 70 movements
191 --> 10 0 movement
10 => 11 1 movement
11 => 38 27 movements
38 => 47 9 movements
Total head movements = 165  
Question 59
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]
A
0
B
1
C
2
D
3
Memory Management    GATE-CS-2016 (Set 1)    
Discuss it


Question 59 Explanation: 
LIFO stands for last in, first out a1 to a10 will result in page faults, So 10 page faults from a1 to a10. Then a11 will replace a10(last in is a10), a12 will replace a11 and so on till a20, so 10 page faults from a11 to a20 and a20 will be top of stack and a9…a1 are remained as such. Then a1 to a9 are already there. So 0 page faults from a1 to a9. a10 will replace a20, a11 will replace a10 and so on. So 11 page faults from a10 to a20. So total faults will be 10+10+11 = 31. Optimal a1 to a10 will result in page faults, So 10 page faults from a1 to a10. Then a11 will replace a10 because among a1 to a10, a10 will be used later, a12 will replace a11 and so on. So 10 page faults from a11 to a20 and a20 will be top of stack and a9…a1 are remained as such. Then a1 to a9 are already there. So 0 page faults from a1 to a9. a10 will replace a1 because it will not be used afterwards and so on, a10 to a19 will have 10 page faults. a20 is already there, so no page fault for a20. Total faults 10+10+10 = 30. Difference = 1
Question 60
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 any of its arguments. For all i, t[i] is initialized to zero. deadlock 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
Deadlock    GATE-CS-2016 (Set 1)    
Discuss it


Question 60 Explanation: 
Mutual exclusion  is satisfied:
All other processes j started before i must have value (i.e. t[j]) 
less than the value of process i (i.e. t[i])  as function pMax() 
return a integer not smaller  than any of its arguments. So if anyone 
out of the processes j have positive value will be executing in its 
critical section as long as the condition t[j] > 0 && t[j] <= t[i] within 
while will persist. And when  this j process comes out of its critical 
section, it sets t[j] = 0;  and next process will be selected in for loop.
So when i process reaches to its critical section none of the  processes j 
which started earlier before process i  is in its critical section. This 
ensure that only one process is executing its critical section at a time. 
Deadlock and progress are  not satisfied:  
while (t[j] != 0 && t[j] <=t[i]); because of this condition deadlock is 
possible when value of j process becomes equals to the value of process i 
(i.e t[j] == t[i]).  because of the deadlock progess is also not possible 
(i.e. Progess == no deadlock) as no one process is able to make progress  
by stoping other process. 
Bounded waiting is also not satisfied: 
In this case both deadlock and bounded waiting to be arising from the same 
reason as if t[j] == t[i] is possible then starvation is possible means 
infinite waiting.
This explanation has been contributed by Dheerendra Singh.
Question 61
Consider the following two phase locking protocol. Suppose a transaction T accesses (for read or write operations), a certain set of objects {O1,...,Ok}. This is done in the following manner: Step 1. T acquires exclusive locks to O1, . . . , Ok in increasing order of their addresses. Step 2. The required operations are performed. Step 3. All locks are released. This protocol will
A
guarantee serializability and deadlock-freedom
B
guarantee neither serializability nor deadlock-freedom
C
guarantee serializability but not deadlock-freedom
D
guarantee deadlock-freedom but not serializability
Transactions and concurrency control    GATE-CS-2016 (Set 1)    
Discuss it


Question 61 Explanation: 
The above scenario is Conservative 2PL( or Static 2PL). In Conservative 2PL protocol, a transaction has to lock all the items it access before the transaction begins execution. It is used to avoid deadlocks. Also, 2PL is  conflict serializable, therefore it guarantees serializability. Therefore option A Advantages of Conservative 2PL :
  • No possibility of deadlock.
  • Ensure serializability.
Drawbacks of Conservative 2PL :
  • Less throughput and resource utilisation because it holds the resources before the transaction begins execution.
  • Starvation is possible since no restriction on unlock operation.
  • 2pl is a deadlock free protocol but it is difficult to use in practice.
Question 62
Consider that B wants to send a message m that is digitally signed to A. Let the pair of private and public keys for A and B be denoted gt20 represent the operation of encrypting m with a key Kx and H(m) represent the message digest. Which one of the following indicates the CORRECT way of sending the message m along with the digital signature to A? gt18
A
A
B
B
C
C
D
D
Network Security    GATE-CS-2016 (Set 1)    
Discuss it


Question 62 Explanation: 
Digital signature are electronic signatures which ensures the integrity ,non repudiation and authenticity of message.Message digest is a hash value generated by applying a function on it. Message digest is encrypted using private key of sender ,so it can only be decrypted by public key of sender.This ensures that the message was sent by the known sender. Message digest is sent with the original message to the receiving end,where hash function is used on the original message and the value generated by that is matched with the message digest.This ensures the integrity and thus,that the message was not altered. Digital signature uses private key of the sender to sign digest. So option B is correct as it is encrypting digest of message H(m) using its private key K-B. sh_62 Image source This solution is contributed by Shashank Shanker khare.
Question 63
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 :   Note : This question was asked as Numerical Answer Type.
A
10
B
50
C
12
D
13
Network Layer    GATE-CS-2016 (Set 1)    
Discuss it


Question 63 Explanation: 
MTU = 100 bytes Size of IP header = 20 bytes So, size of data that can be transmitted in one fragment = 100 - 20 = 80 bytes Size of data to be transmitted = Size of datagram - size of header = 1000 - 20 = 980 bytes   Now, we have a datagram of size 1000 bytes. So, we need ceil(980/80) = 13 fragments.   Thus, there will be 13 fragments of the datagram. So, D is the correct choice.
Question 64
For a host machine that uses the token bucket algorithm for congestion control, the token bucket has a capacity of 1 megabyte and the maximum output rate is 20 megabytes per second. Tokens arrive at a rate to sustain output at a rate of 10 megabytes per second. The token bucket is currently full and the machine needs to send 12 megabytes of data. The minimum time required to transmit the data is _________________ seconds.
A
1.1
B
0.1
C
2.1
D
2.0
Transport Layer    GATE-CS-2016 (Set 1)    
Discuss it


Question 64 Explanation: 
Token bucket is a congestion control algorithm for data transfer. It takes tokens to synchronize between the rate of incoming and outgoing data.
According to the token bucket algorithm, the minimum time required 
to send 1 MB of data or the maximum rate of data transmission is 
given by:

   S = C / (M - P)

Where, 
M = Maximum burst rate,
P = Rate of arrival of a token,
C = capacity of the bucket

token-bucket-resize
Using the above formula for the given question we can say that:
M = 20 MB
P = 10 MB
C = 1 MB
S = 1 / (20- 10) = 0.1 sec 
Since, the bucket is initially full, it already has 1 MB to transmit so it will be transmitted instantly. So, we are left with only (12 - 1), i.e. 11 MB of data to be transmitted. Time required to send the 11 MB will be 11 * 0.1 = 1.1 sec The above image is adopted from here. This explanation is contributed by Namita Singh.
Question 65
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
2500
B
2000
C
1500
D
500
Data Link Layer    GATE-CS-2016 (Set 1)    
Discuss it


Question 65 Explanation: 
Total time = Transmission-Time + 2* Propagation-Delay + Ack-Time.
Trans. time = (1000*8)/80*1000 = 0.1 sec
2*Prop-Delay = 2*100ms = 0.2 sec
Ack time = 100*8/8*1000 = 0.1 sec.
Total Time = 0.1 + 0.2 + 0.1 = 0.4 sec.
Throughput = ((L/B)/Total time) * B, 
L = data packet to be sent and
B = BW of sender.

Throughput = L/Total Time
           = 1000/0.4
           = 2500 bytes/sec.
There are 65 questions to complete.

GATE-CS-2016 (Set 2)


GATE CS Corner


See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.