This document contains a 25 question multiple choice test on computer science topics. The questions cover areas like algorithms, data structures, complexity analysis, computer architecture, operating systems, databases, networks, and formal languages. The test asks the examinee to choose the best answer from among 4 options for each question. It also provides 2 mark questions in the later part testing more comprehensive understanding.
Ec2203 digital electronics questions anna university by www.annaunivedu.organnaunivedu
EC2203 Digital Electronics Anna University Important Questions for 3rd Semester ECE , EC2203 Digital Electronics Important Questions, 3rd Sem Question papers,
http://www.annaunivedu.org/digital-electronics-ec-2203-previous-year-question-paper-for-3rd-sem-ece-anna-univ-question/
Ec2203 digital electronics questions anna university by www.annaunivedu.organnaunivedu
EC2203 Digital Electronics Anna University Important Questions for 3rd Semester ECE , EC2203 Digital Electronics Important Questions, 3rd Sem Question papers,
http://www.annaunivedu.org/digital-electronics-ec-2203-previous-year-question-paper-for-3rd-sem-ece-anna-univ-question/
Welcome to Issue 10 of Heartfulness Magazine
Not so long ago, the use of electricity seemed nothing short of a miracle. Today it has
become part of life. The human race is waking up to another source of energy, much more
subtle and refined. In fact, it cannot really be called energy as it is beyond that. What is it?
Find out in this issue.
Also, a renowned speaker explores the heart’s wonders, a student shares how she achieves
her sporting goals, and a parent learns the beauty of his son’s autism. There are so many
inspiring stories when we listen to each other. We would love to hear your stories also, so
please send your letters and articles to contributions@heartfulnessmagazine.com.
Manjakani Kanza - Jual Obat Manjakani Kanza Aceh OriginalManjakani Kanza
Manjakani Kanza - Hubungi kami di 085721499521 / 546609A8 / Email : CS@ManjakaniKanza.org
Ramuan ini memiliki manfaat dalam membantu para wanita untuk mengatasi segala keluhan kewanitaan seperti keputihan, kista, miom, membantu program hamil.
Welcome to Issue 5 of Heartfulness Magazine, which honors the transmission of wisdom through the ages from our elders. Enjoy articles that speak to the potency of inner beauty, conscious parenting, vibrational compatibility and the gratitude of a garden harvest. The children’s section encourages youngsters to learn about star constellations and listen to an original story about a little girl who befriends a star. We invite you to cross this Wisdom Bridge with us to learn from our past to build a brighter future.
Subscriptions: subscriptions@heartfulnessmagazine.com
General enquiries: info@heartfulnessmagazine.com
Comprehensive program for Agricultural Finance, the Automotive Sector, and Empowerment . We will define the full scope and provide a detailed two-week plan for identifying strategic partners in each area within Limpopo, including target areas.:
1. Agricultural : Supporting Primary and Secondary Agriculture
• Scope: Provide support solutions to enhance agricultural productivity and sustainability.
• Target Areas: Polokwane, Tzaneen, Thohoyandou, Makhado, and Giyani.
2. Automotive Sector: Partnerships with Mechanics and Panel Beater Shops
• Scope: Develop collaborations with automotive service providers to improve service quality and business operations.
• Target Areas: Polokwane, Lephalale, Mokopane, Phalaborwa, and Bela-Bela.
3. Empowerment : Focusing on Women Empowerment
• Scope: Provide business support support and training to women-owned businesses, promoting economic inclusion.
• Target Areas: Polokwane, Thohoyandou, Musina, Burgersfort, and Louis Trichardt.
We will also prioritize Industrial Economic Zone areas and their priorities.
Sign up on https://profilesmes.online/welcome/
To be eligible:
1. You must have a registered business and operate in Limpopo
2. Generate revenue
3. Sectors : Agriculture ( primary and secondary) and Automative
Women and Youth are encouraged to apply even if you don't fall in those sectors.
What Does the Active Steering Malfunction Warning Mean for Your BMWTanner Motors
Discover the reasons why your BMW’s Active Steering malfunction warning might come on. From electrical glitches to mechanical failures and software anomalies, addressing these promptly with professional inspection and maintenance ensures continued safety and performance on the road, maintaining the integrity of your driving experience.
5 Warning Signs Your BMW's Intelligent Battery Sensor Needs AttentionBertini's German Motors
IBS monitors and manages your BMW’s battery performance. If it malfunctions, you will have to deal with an array of electrical issues in your vehicle. Recognize warning signs like dimming headlights, frequent battery replacements, and electrical malfunctions to address potential IBS issues promptly.
𝘼𝙣𝙩𝙞𝙦𝙪𝙚 𝙋𝙡𝙖𝙨𝙩𝙞𝙘 𝙏𝙧𝙖𝙙𝙚𝙧𝙨 𝙞𝙨 𝙫𝙚𝙧𝙮 𝙛𝙖𝙢𝙤𝙪𝙨 𝙛𝙤𝙧 𝙢𝙖𝙣𝙪𝙛𝙖𝙘𝙩𝙪𝙧𝙞𝙣𝙜 𝙩𝙝𝙚𝙞𝙧 𝙥𝙧𝙤𝙙𝙪𝙘𝙩𝙨. 𝙒𝙚 𝙝𝙖𝙫𝙚 𝙖𝙡𝙡 𝙩𝙝𝙚 𝙥𝙡𝙖𝙨𝙩𝙞𝙘 𝙜𝙧𝙖𝙣𝙪𝙡𝙚𝙨 𝙪𝙨𝙚𝙙 𝙞𝙣 𝙖𝙪𝙩𝙤𝙢𝙤𝙩𝙞𝙫𝙚 𝙖𝙣𝙙 𝙖𝙪𝙩𝙤 𝙥𝙖𝙧𝙩𝙨 𝙖𝙣𝙙 𝙖𝙡𝙡 𝙩𝙝𝙚 𝙛𝙖𝙢𝙤𝙪𝙨 𝙘𝙤𝙢𝙥𝙖𝙣𝙞𝙚𝙨 𝙗𝙪𝙮 𝙩𝙝𝙚 𝙜𝙧𝙖𝙣𝙪𝙡𝙚𝙨 𝙛𝙧𝙤𝙢 𝙪𝙨.
Over the 10 years, we have gained a strong foothold in the market due to our range's high quality, competitive prices, and time-lined delivery schedules.
Why Is Your BMW X3 Hood Not Responding To Release CommandsDart Auto
Experiencing difficulty opening your BMW X3's hood? This guide explores potential issues like mechanical obstruction, hood release mechanism failure, electrical problems, and emergency release malfunctions. Troubleshooting tips include basic checks, clearing obstructions, applying pressure, and using the emergency release.
Symptoms like intermittent starting and key recognition errors signal potential problems with your Mercedes’ EIS. Use diagnostic steps like error code checks and spare key tests. Professional diagnosis and solutions like EIS replacement ensure safe driving. Consult a qualified technician for accurate diagnosis and repair.
Core technology of Hyundai Motor Group's EV platform 'E-GMP'Hyundai Motor Group
What’s the force behind Hyundai Motor Group's EV performance and quality?
Maximized driving performance and quick charging time through high-density battery pack and fast charging technology and applicable to various vehicle types!
Discover more about Hyundai Motor Group’s EV platform ‘E-GMP’!
"Trans Failsafe Prog" on your BMW X5 indicates potential transmission issues requiring immediate action. This safety feature activates in response to abnormalities like low fluid levels, leaks, faulty sensors, electrical or mechanical failures, and overheating.
In this presentation, we have discussed a very important feature of BMW X5 cars… the Comfort Access. Things that can significantly limit its functionality. And things that you can try to restore the functionality of such a convenient feature of your vehicle.
What Exactly Is The Common Rail Direct Injection System & How Does It WorkMotor Cars International
Learn about Common Rail Direct Injection (CRDi) - the revolutionary technology that has made diesel engines more efficient. Explore its workings, advantages like enhanced fuel efficiency and increased power output, along with drawbacks such as complexity and higher initial cost. Compare CRDi with traditional diesel engines and discover why it's the preferred choice for modern engines.
What Does the PARKTRONIC Inoperative, See Owner's Manual Message Mean for You...Autohaus Service and Sales
Learn what "PARKTRONIC Inoperative, See Owner's Manual" means for your Mercedes-Benz. This message indicates a malfunction in the parking assistance system, potentially due to sensor issues or electrical faults. Prompt attention is crucial to ensure safety and functionality. Follow steps outlined for diagnosis and repair in the owner's manual.
Things to remember while upgrading the brakes of your carjennifermiller8137
Upgrading the brakes of your car? Keep these things in mind before doing so. Additionally, start using an OBD 2 GPS tracker so that you never miss a vehicle maintenance appointment. On top of this, a car GPS tracker will also let you master good driving habits that will let you increase the operational life of your car’s brakes.
Things to remember while upgrading the brakes of your car
2015 16combinepdf
1. GATE 2015 SET-1 COMPUTER SCIENCE - CS
CS-1 1/11
Q. 1 – Q. 25 carry one mark each.
Q.1
If ( ) 1g x x= − and ( )
1
x
h x
x
=
−
, then
( ( ))
( ( ))
g h x
h g x
is:
(A)
( )
( )
h x
g x
(B)
1
x
−
(C)
( )
( )
g x
h x
(D) 2
(1 )
x
x−
Q.2 lim𝑥𝑥→∞ 𝑥𝑥1/𝑥𝑥
is
(A) ∞ (B) 0 (C) 1 (D) Not defined
Q.3 Match the following:
(P) Prim’s algorithm for minimum spanning tree (i) Backtracking
(Q) Floyd-Warshall algorithm for all pairs shortest paths (ii) Greedy method
(R) Mergesort (iii) Dynamic programming
(S) Hamiltonian circuit (iv) Divide and conquer
(A) P-iii, Q-ii, R-iv, S-i (B) P-i, Q-ii, R-iv, S-iii
(C) P-ii, Q-iii, R-iv, S-i (D) P-ii, Q-i, R-iii, S-iv
Q.4 Which one of the following is the recurrence equation for the worst case time complexity of the
Quicksort algorithm for sorting 𝑛𝑛 ( ≥ 2) numbers? In the recurrence equations given in the options
below, 𝑐𝑐 is a constant.
(A) 𝑇𝑇(𝑛𝑛) = 2 𝑇𝑇(𝑛𝑛/2) + 𝑐𝑐𝑐𝑐
(B) 𝑇𝑇(𝑛𝑛) = 𝑇𝑇(𝑛𝑛 − 1) + 𝑇𝑇(1) + 𝑐𝑐𝑐𝑐
(C) 𝑇𝑇(𝑛𝑛) = 2𝑇𝑇(𝑛𝑛 − 1) + 𝑐𝑐𝑐𝑐
(D) 𝑇𝑇(𝑛𝑛) = 𝑇𝑇(𝑛𝑛/2) + 𝑐𝑐𝑐𝑐
Q.5 The height of a tree is the length of the longest root-to-leaf path in it. The maximum and minimum
number of nodes in a binary tree of height 5 are
(A) 63 and 6, respectively (B) 64 and 5, respectively
(C) 32 and 6, respectively (D) 31 and 5, respectively
Q.6 Match the following:
(P) Condition coverage (i) Black-box testing
(Q) Equivalence class partitioning (ii) System testing
(R) Volume testing (iii) White-box testing
(S) Alpha testing (iv) Performance testing
(A) P-ii, Q-iii, R-i, S-iv (B) P-iii, Q-iv, R-ii, S- i
(C) P-iii, Q-i, R-iv, S-ii (D) P-iii, Q-i, R-ii, S-iv
2. GATE 2015 SET-1 COMPUTER SCIENCE - CS
CS-1 2/11
Q.7 Which of the following is/are correct inorder traversal sequence(s) of binary search tree(s)?
I. 3, 5, 7, 8, 15, 19, 25
II. 5, 8, 9, 12, 10, 15, 25
III. 2, 7, 10, 8, 14, 16, 20
IV. 4, 6, 7, 9 18, 20, 25
(A) I and IV only (B) II and III only (C) II and IV only (D) II only
Q.8 Which one of the following is TRUE at any valid state in shift-reduce parsing?
(A) Viable prefixes appear only at the bottom of the stack and not inside
(B) Viable prefixes appear only at the top of the stack and not inside
(C) The stack contains only a set of viable prefixes
(D) The stack never contains viable prefixes
Q.9 Which one of the following is NOT equivalent to p ↔ q?
(A) (┐p ˅ q) ˄ (p ˅ ┐q) (B) (┐p ˅ q) ˄ (q → p)
(C) (┐p ˄ q) ˅ (p ˄ ┐q) (D) (┐p ˄ ┐q) ˅ (p ˄ q)
Q.10 For a set 𝐴𝐴, the power set of 𝐴𝐴 is denoted by 2𝐴𝐴
. If 𝐴𝐴 = {5, {6}, {7}}, which of the following options
are TRUE?
I. ∅ ∈ 2𝐴𝐴
II. ∅ ⊆ 2𝐴𝐴
III. {5, {6}} ∈ 2𝐴𝐴
IV. {5, {6}} ⊆ 2𝐴𝐴
(A) I and III only (B) II and III only
(C) I, II and III only (D) I, II and IV only
Q.11 Consider a 4-bit Johnson counter with an initial value of 0000. The counting sequence of this
counter is
(A) 0, 1, 3, 7, 15, 14, 12, 8, 0 (B) 0, 1, 3, 5, 7, 9, 11, 13, 15, 0
(C) 0, 2, 4, 6, 8, 10, 12, 14, 0 (D) 0, 8, 12, 14, 15, 7, 3, 1, 0
Q.12 For computers based on three-address instruction formats, each address field can be used to specify
which of the following:
(S1) A memory operand
(S2) A processor register
(S3) An implied accumulator register
(A) Either S1 or S2
(B) Either S2 or S3
(C) Only S2 and S3
(D) All of S1, S2 and S3
3. GATE 2015 SET-1 COMPUTER SCIENCE - CS
CS-1 3/11
Q.13 Suppose two hosts use a TCP connection to transfer a large file. Which of the following statements
is/are FALSE with respect to the TCP connection?
I. If the sequence number of a segment is m, then the sequence number of the subsequent
segment is always m+1.
II. If the estimated round trip time at any given point of time is t sec, the value of the
retransmission timeout is always set to greater than or equal to t sec.
III. The size of the advertised window never changes during the course of the TCP connection.
IV. The number of unacknowledged bytes at the sender is always less than or equal to the
advertised window.
(A) III only (B) I and III only (C) I and IV only (D) II and IV only
Q.14 Suppose that everyone in a group of N people wants to communicate secretly with the N-1 others
using symmetric key cryptographic system. The communication between any two persons should
not be decodable by the others in the group. The number of keys required in the system as a whole
to satisfy the confidentiality requirement is
(A) 2N (B) N(N-1) (C) N(N-1)/2 (D) (N-1)2
Q.15 Which of the following statements is/are FALSE?
I. XML overcomes the limitations in HTML to support a structured way of organizing
content.
II. XML specification is not case sensitive while HTML specification is case sensitive.
III. XML supports user defined tags while HTML uses pre-defined tags.
IV. XML tags need not be closed while HTML tags must be closed.
(A) II only (B) I only (C) II and IV only (D) III and IV only
Q.16 Which one of the following fields of an IP header is NOT modified by a typical IP router?
(A) Checksum (B) Source address
(C) Time to Live (TTL) (D) Length
Q.17 In one of the pairs of protocols given below, both the protocols can use multiple TCP connections
between the same client and the server. Which one is that?
(A) HTTP, FTP (B) HTTP, TELNET (C) FTP, SMTP (D) HTTP, SMTP
Q.18 For any two languages L1 and L2 such that L1 is context-free and L2 is recursively enumerable but
not recursive, which of the following is/are necessarily true?
I. 𝐿𝐿�1 (complement of L1) is recursive
II. 𝐿𝐿�2 (complement of L2) is recursive
III. 𝐿𝐿�1 is context-free
IV. 𝐿𝐿�1 ∪ L2 is recursively enumerable
(A) I only (B) III only (C) III and IV only (D) I and IV only
Q.19 Consider a system with byte-addressable memory, 32-bit logical addresses, 4 kilobyte page size and
page table entries of 4 bytes each. The size of the page table in the system in megabytes is
________ .
4. GATE 2015 SET-1 COMPUTER SCIENCE - CS
CS-1 4/11
Q.20 The following two functions P1 and P2 that share a variable B with an initial value of 2 execute
concurrently.
P1( ) { P2( ) {
C = B – 1; D = 2 * B;
B = 2 * C; B = D - 1;
} }
The number of distinct values that B can possibly take after the execution is______________.
Q.21 SELECT operation in SQL is equivalent to
(A) the selection operation in relational algebra
(B) the selection operation in relational algebra, except that SELECT in SQL retains duplicates
(C) the projection operation in relational algebra
(D) the projection operation in relational algebra, except that SELECT in SQL retains duplicates
Q.22 A file is organized so that the ordering of data records is the same as or close to the ordering of data
entries in some index. Then that index is called
(A) Dense (B) Sparse (C) Clustered (D) Unclustered
Q.23
In the LU decomposition of the matrix
2 2
4 9
, if the diagonal elements of U are both 1, then the
lower diagonal entry 22l of L is________.
Q.24 The output of the following C program is__________.
void f1(int a, int b) {
int c;
c=a; a=b; b=c;
}
void f2(int *a, int *b) {
int c;
c=*a; *a=*b; *b=c;
}
int main(){
int a=4, b=5, c=6;
f1(a,b);
f2(&b, &c);
printf(“%d”,c-a-b);
}
Q.25 What are the worst-case complexities of insertion and deletion of a key in a binary search tree?
(A) (log )nθ for both insertion and deletion
(B) ( )nθ for both insertion and deletion
(C) ( )nθ for insertion and (log )nθ for deletion
(D) (log )nθ for insertion and ( )nθ for deletion
5. GATE 2015 SET-1 COMPUTER SCIENCE - CS
CS-1 5/11
Q. 26 – Q. 55 carry two marks each.
Q.26 Suppose that the stop-and-wait protocol is used on a link with a bit rate of 64 kilobits per second
and 20 milliseconds propagation delay. Assume that the transmission time for the
acknowledgement and the processing time at nodes are negligible. Then the minimum frame size in
bytes to achieve a link utilization of at least 50% is______________.
Q.27 Consider a max heap, represented by the array: 40, 30, 20, 10, 15, 16, 17, 8, 4.
Array Index 1 2 3 4 5 6 7 8 9
Value 40 30 20 10 15 16 17 8 4
Now consider that a value 35 is inserted into this heap. After insertion, the new heap is
(A) 40, 30, 20, 10, 15, 16, 17, 8, 4, 35 (B) 40, 35, 20, 10, 30, 16, 17, 8, 4, 15
(C) 40, 30, 20, 10, 35, 16, 17, 8, 4, 15 (D) 40, 35, 20, 10, 15, 16, 17, 8, 4, 30
Q.28 Consider the following C program segment.
while(first <= last)
{
if (array[middle] < search)
first = middle + 1;
else if (array[middle] == search)
found = TRUE;
else last = middle - 1;
middle = (first + last)/2;
}
if (first > last) notPresent = TRUE;
The cyclomatic complexity of the program segment is ________.
Q.29 Consider a LAN with four nodes 𝑆𝑆1, 𝑆𝑆2, 𝑆𝑆3 and 𝑆𝑆4. Time is divided into fixed-size slots, and a node
can begin its transmission only at the beginning of a slot. A collision is said to have occurred if
more than one node transmit in the same slot. The probabilities of generation of a frame in a time
slot by 𝑆𝑆1, 𝑆𝑆2, 𝑆𝑆3 and 𝑆𝑆4 are 0.1, 0.2, 0.3 and 0.4, respectively. The probability of sending a frame in
the first slot without any collision by any of these four stations is _____________.
Q.30 The binary operator ≠ is defined by the following truth table.
p q p ≠ q
0 0 0
0 1 1
1 0 1
1 1 0
Which one of the following is true about the binary operator ≠?
(A) Both commutative and associative (B) Commutative but not associative
(C) Not commutative but associative (D) Neither commutative nor associative
6. GATE 2015 SET-1 COMPUTER SCIENCE - CS
CS-1 6/11
Q.31 99
1
1
( 1)x x x= +
∑ = ____________.
Q.32 Suppose ℒ = {𝑝𝑝, 𝑞𝑞, 𝑟𝑟, 𝑠𝑠, 𝑡𝑡} is a lattice represented by the following Hasse diagram:
For any 𝑥𝑥, 𝑦𝑦 ∈ ℒ, not necessarily distinct, 𝑥𝑥 ∨ 𝑦𝑦 and 𝑥𝑥 ∧ 𝑦𝑦 are join and meet of 𝑥𝑥, 𝑦𝑦, respectively.
Let ℒ3
= {(𝑥𝑥, 𝑦𝑦, 𝑧𝑧): 𝑥𝑥, 𝑦𝑦 , 𝑧𝑧 ∈ ℒ} be the set of all ordered triplets of the elements of ℒ. Let 𝑝𝑝𝑟𝑟 be the
probability that an element (𝑥𝑥, 𝑦𝑦, 𝑧𝑧) ∈ ℒ3
chosen equiprobably satisfies 𝑥𝑥 ∨ (𝑦𝑦 ∧ 𝑧𝑧) = (𝑥𝑥 ∨ 𝑦𝑦) ∧
(𝑥𝑥 ∨ 𝑧𝑧). Then
(A) 𝑝𝑝𝑟𝑟 = 0
(B) 𝑝𝑝𝑟𝑟 = 1
(C) 0 < 𝑝𝑝𝑟𝑟 ≤
1
5
(D)
1
5
< 𝑝𝑝𝑟𝑟 < 1
Q.33 Consider the operations
𝑓𝑓(𝑋𝑋, 𝑌𝑌, 𝑍𝑍) = 𝑋𝑋′
𝑌𝑌𝑌𝑌 + 𝑋𝑋𝑌𝑌′
+ 𝑌𝑌′𝑍𝑍′ and 𝑔𝑔(𝑋𝑋, 𝑌𝑌, 𝑍𝑍) = 𝑋𝑋′
𝑌𝑌𝑌𝑌 + 𝑋𝑋′
𝑌𝑌𝑍𝑍′
+ 𝑋𝑋𝑋𝑋.
Which one of the following is correct?
(A) Both {𝑓𝑓} and {𝑔𝑔} are functionally complete
(B) Only {𝑓𝑓} is functionally complete
(C) Only {𝑔𝑔} is functionally complete
(D) Neither {𝑓𝑓} nor {𝑔𝑔} is functionally complete
Q.34 Let G be a connected planar graph with 10 vertices. If the number of edges on each face is three,
then the number of edges in G is ___________.
Q.35 Let na represent the number of bit strings of length n containing two consecutive 1s. What is the
recurrence relation for na ?
(A) 2
2 1 2n
n na a −
− −+ + (B) 2
2 12 2n
n na a −
− −+ +
(C) 2
2 12 2n
n na a −
− −+ + (D) 2
2 12 2 2n
n na a −
− −+ +
𝑝𝑝
𝑞𝑞
𝑡𝑡
𝑟𝑟 𝑠𝑠
7. GATE 2015 SET-1 COMPUTER SCIENCE - CS
CS-1 7/11
Q.36 A variable x is said to be live at a statement Si in a program if the following three conditions hold
simultaneously:
i. There exists a statement Sj that uses x
ii. There is a path from Si to Sj in the flow graph corresponding to the program
iii. The path has no intervening assignment to x including at Si and Sj
The variables which are live both at the statement in basic block 2 and at the statement in basic
block 3 of the above control flow graph are
(A) p, s, u (B) r, s, u (C) r, u (D) q, v
Q.37 The least number of temporary variables required to create a three-address code in static single
assignment form for the expression q + r / 3 + s – t * 5 + u * v /w is _______________.
Q.38 Consider an Entity-Relationship (ER) model in which entity sets E1 and E2 are connected by an
m : n relationship R12. E1 and E3 are connected by a 1 : n (1 on the side of E1 and n on the side of
E3) relationship R13.
E1 has two single-valued attributes a11 and a12 of which a11 is the key attribute. E2 has two single-
valued attributes a21 and a22 of which a21 is the key attribute. E3 has two single-valued attributes a31
and a32 of which a31 is the key attribute. The relationships do not have any attributes.
If a relational model is derived from the above ER model, then the minimum number of relations
that would be generated if all the relations are in 3NF is _______.
Q.39
Consider the DFAs M and N given above. The number of states in a minimal DFA that accepts the
language L(M) ∩ L(N) is____________________
p = q + r
s = p + q
u = s * v
v = r + u q = s * u
q = v + r
1
2 3
4
ba
b
a
N:
ab
a
b
M:
8. GATE 2015 SET-1 COMPUTER SCIENCE - CS
CS-1 8/11
Q.40 Consider the NPDA 〈Q = {𝑞𝑞𝑜𝑜, 𝑞𝑞1, 𝑞𝑞2}, ∑ = {0,1}, Γ = {0,1, ⊥}, 𝛿𝛿, 𝑞𝑞0 , ⊥, F = {𝑞𝑞2}〉, where (as
per usual convention) Q is the set of states, ∑ is the input alphabet, Γ is the stack alphabet, 𝛿𝛿 is the
state transition function, q0 is the initial state, ⊥ is the initial stack symbol, and F is the set of
accepting states. The state transition is as follows:
Which one of the following sequences must follow the string 101100 so that the overall string is
accepted by the automaton?
(A) 10110 (B) 10010 (C) 01010 (D) 01001
Q.41 Let G = (V, E) be a simple undirected graph, and s be a particular vertex in it called the source.
For x V∈ , let ( )d x denote the shortest distance in G from s to x . A breadth first search (BFS) is
performed starting at s . Let T be the resultant BFS tree. If (u,v) is an edge of G that is not in T ,
then which one of the following CANNOT be the value of ( ) ( )d u d v− ?
(A) -1 (B) 0 (C) 1 (D) 2
Q.42 Consider a uniprocessor system executing three tasks T1, T2 and T3, each of which is composed of
an infinite sequence of jobs (or instances) which arrive periodically at intervals of 3, 7 and 20
milliseconds, respectively. The priority of each task is the inverse of its period, and the available
tasks are scheduled in order of priority, with the highest priority task scheduled first. Each instance
of T1, T2 and T3 requires an execution time of 1, 2 and 4 milliseconds, respectively. Given that all
tasks initially arrive at the beginning of the 1st
millisecond and task preemptions are allowed, the
first instance of T3 completes its execution at the end of _____________ milliseconds.
Q.43 A positive edge-triggered D flip-flop is connected to a positive edge-triggered JK flip-flop as
follows. The Q output of the D flip-flop is connected to both the J and K inputs of the JK flip-flop,
while the Q output of the JK flip-flop is connected to the input of the D flip-flop. Initially, the
output of the D flip-flop is set to logic one and the output of the JK flip-flop is cleared. Which one
of the following is the bit sequence (including the initial state) generated at the Q output of the JK
flip-flop when the flip-flops are connected to a free-running common clock? Assume that J = K = 1
is the toggle mode and J = K = 0 is the state-holding mode of the JK flip-flop. Both the flip-flops
have non-zero propagation delays.
(A) 0110110… (B) 0100100…
(C) 011101110… (D) 011001100…
Q.44 Consider a disk pack with a seek time of 4 milliseconds and rotational speed of 10000 rotations per
minute (RPM). It has 600 sectors per track and each sector can store 512 bytes of data. Consider a
file stored in the disk. The file contains 2000 sectors. Assume that every sector access necessitates a
seek, and the average rotational latency for accessing each sector is half of the time for one
complete rotation. The total time (in milliseconds) needed to read the entire file is ____________.
9. GATE 2015 SET-1 COMPUTER SCIENCE - CS
CS-1 9/11
Q.45 Consider a non-pipelined processor with a clock rate of 2.5 gigahertz and average cycles per
instruction of four. The same processor is upgraded to a pipelined processor with five stages; but
due to the internal pipeline delay, the clock speed is reduced to 2 gigahertz. Assume that there are
no stalls in the pipeline. The speed up achieved in this pipelined processor is_________.
Q.46 Suppose the following disk request sequence (track numbers) for a disk with 100 tracks is given:
45, 20, 90, 10, 50, 60, 80, 25, 70. Assume that the initial position of the R/W head is on track 50.
The additional distance that will be traversed by the R/W head when the Shortest Seek Time First
(SSTF) algorithm is used compared to the SCAN (Elevator) algorithm (assuming that SCAN
algorithm moves towards 100 when it starts execution) is____________ tracks.
Q.47 Consider a main memory with five page frames and the following sequence of page references: 3,
8, 2, 3, 9, 1, 6, 3, 8, 9, 3, 6, 2, 1, 3. Which one of the following is true with respect to page
replacement policies First In First Out (FIFO) and Least Recently Used (LRU)?
(A) Both incur the same number of page faults
(B) FIFO incurs 2 more page faults than LRU
(C) LRU incurs 2 more page faults than FIFO
(D) FIFO incurs 1 more page faults than LRU
Q.48 2/
2
1/
cos(1/ )x
dx
x
π
π
∫ =__________________.
Q.49 Consider the following 2 × 2 matrix A where two elements are unknown and are marked by a and
b. The eigenvalues of this matrix are -1 and 7. What are the values of a and b?
=
ab
A
41
.
(A) a = 6, b = 4
(B) a = 4, b = 6
(C) a = 3, b = 5
(D) a = 5, b =3
Q.50 An algorithm performs ( )1/2
log N find operations, N insert operations, ( )1/2
log N delete
operations, and ( )1/2
log N decrease-key operations on a set of data items with keys drawn from a
linearly ordered set. For a delete operation, a pointer is provided to the record that must be deleted.
For the decrease-key operation, a pointer is provided to the record that has its key decreased. Which
one of the following data structures is the most suited for the algorithm to use, if the goal is to
achieve the best total asymptotic complexity considering all the operations?
(A) Unsorted array (B) Min-heap
(C) Sorted array (D) Sorted doubly linked list
10. GATE 2015 SET-1 COMPUTER SCIENCE - CS
CS-1 10/11
Q.51 Consider the following relations:
Student Performance
Roll_No Student_Name
1 Raj
2 Rohit
3 Raj
Roll_No Course Marks
1 Math 80
1 English 70
2 Math 75
3 English 80
2 Physics 65
3 Math 80
Consider the following SQL query.
SELECT S.Student_Name, sum(P.Marks)
FROM Student S, Performance P
WHERE S.Roll_No = P.Roll_No
GROUP BY S.Student_Name
The number of rows that will be returned by the SQL query is _____________.
Q.52 What is the output of the following C code? Assume that the address of x is 2000 (in decimal) and
an integer requires four bytes of memory.
int main () {
unsigned int x[4][3] =
{{1,2,3},{4,5,6},{7,8,9},{10,11,12}};
printf(“%u, %u, %u”, x+3, *(x+3), *(x+2)+3);
}
(A) 2036, 2036, 2036 (B) 2012, 4, 2204 (C) 2036, 10, 10 (D) 2012, 4, 6
Q.53 The graph shown below has 8 edges with distinct integer edge weights. The minimum spanning tree
(MST) is of weight 36 and contains the edges: {(A, C), (B, C), (B, E), (E, F), (D, F)}. The edge
weights of only those edges which are in the MST are given in the figure shown below. The
minimum possible sum of weights of all 8 edges of this graph is ___________.
11. GATE 2015 SET-1 COMPUTER SCIENCE - CS
CS-1 11/11
Q.54 Consider the following C function.
int fun1(int n){
int i,j,k,p,q=0;
for (i=1; i<n; ++i) {
p=0;
for (j=n; j>1; j=j/2)
++p;
for (k=1; k<p; k=k*2)
++q;
}
return q;
}
Which one of the following most closely approximates the return value of the function fun1?
(A) 3
n (B) 2
(log )n n (C) logn n (D) log(log )n n
Q.55 Consider the following pseudo code, where x and y are positive integers.
begin
q := 0
r := x
while 𝑟𝑟 ≥ 𝑦𝑦 do
begin
r := r – y
q := q + 1
end
end
The post condition that needs to be satisfied after the program terminates is
(A) {𝑟𝑟 = 𝑞𝑞𝑞𝑞 + 𝑦𝑦 ˄ 𝑟𝑟 < 𝑦𝑦} (B) { 𝑥𝑥 = 𝑞𝑞𝑞𝑞 + 𝑟𝑟 ˄ 𝑟𝑟 < 𝑦𝑦}
(C) { 𝑦𝑦 = 𝑞𝑞𝑞𝑞 + 𝑟𝑟 ˄ 0 < 𝑟𝑟 < 𝑦𝑦} (D) { 𝑞𝑞 + 1 < 𝑟𝑟 − 𝑦𝑦 ˄ 𝑦𝑦 > 0}
END OF THE QUESTION PAPER
12. GATE 2015 SET-2 COMPUTER – CS
CS 1/12
Q. 1 – Q. 25 carry one mark each.
Q.1 Consider the following two statements.
𝑆𝑆1: If a candidate is known to be corrupt, then he will not be elected
𝑆𝑆2: If a candidate is kind, he will be elected
Which one of the following statements follows from 𝑆𝑆1 and 𝑆𝑆2 as per sound inference rules of
logic?
(A) If a person is known to be corrupt, he is kind
(B) If a person is not known to be corrupt, he is not kind
(C) If a person is kind, he is not known to be corrupt
(D) If a person is not kind, he is not known to be corrupt
Q.2 The cardinality of the power set of { 0, 1, 2, …, 10 } is _________.
Q.3 Let 𝑅𝑅 be the relation on the set of positive integers such that 𝑎𝑎𝑎𝑎𝑎𝑎 if and only if 𝑎𝑎 and 𝑏𝑏 are distinct
and have a common divisor other than 1. Which one of the following statements about 𝑅𝑅 is true?
(A) 𝑅𝑅 is symmetric and reflexive but not transitive
(B) 𝑅𝑅 is reflexive but not symmetric and not transitive
(C) 𝑅𝑅 is transitive but not reflexive and not symmetric
(D) 𝑅𝑅 is symmetric but not reflexive and not transitive
Q.4 The number of divisors of 2100 is _____ .
Q.5
The larger of the two eigenvalues of the matrix
4 5
2 1
is _______.
Q.6 An unordered list contains n distinct elements. The number of comparisons to find an element in
this list that is neither maximum nor minimum is
(A) Ɵ(n log n) (B) Ɵ(n) (C) Ɵ(log n) (D) Ɵ(1)
Q.7 The minimum number of JK flip-flops required to construct a synchronous counter with the count
sequence (0,0,1,1,2,2,3,3,0,0,…) is __________ .
Q.8 Assume that for a certain processor, a read request takes 50 nanoseconds on a cache miss and 5
nanoseconds on a cache hit. Suppose while running a program, it was observed that 80% of the
processor's read requests result in a cache hit. The average read access time in nanoseconds is
__________.
13. GATE 2015 SET-2 COMPUTER – CS
CS 2/12
Q.9 A computer system implements a 40-bit virtual address, page size of 8 kilobytes, and a 128-entry
translation look-aside buffer (TLB) organized into 32 sets each having four ways. Assume that the
TLB tag does not store any process id. The minimum length of the TLB tag in bits is _________.
Q.10 Consider the following statements.
I. The complement of every Turing decidable language is Turing decidable
II. There exists some language which is in NP but is not Turing decidable
III. If L is a language in NP, L is Turing decidable
Which of the above statements is/are true?
(A) Only II (B) Only III (C) Only I and II (D) Only I and III
Q.11 Consider the following function written in the C programming language.
void foo(char *a){
if ( *a && *a != ‘ ‘){
foo(a+1);
putchar(*a);
}
}
The output of the above function on input “ABCD EFGH” is
(A) ABCD EFGH (B) ABCD (C) HGFE DCBA (D) DCBA
Q.12 Consider a complete binary tree where the left and the right subtrees of the root are max-heaps. The
lower bound for the number of operations to convert the tree to a heap is
(A) Ω(log 𝑛𝑛) (B) Ω(𝑛𝑛) (C) Ω(𝑛𝑛 log 𝑛𝑛) (D) Ω(𝑛𝑛2
)
Q.13 A binary tree T has 20 leaves. The number of nodes in T having two children is _______.
Q.14 Consider the following C function.
int fun(int n){
int x=1,k;
if (n==1) return x;
for (k=1; k<n; ++k)
x = x + fun(k) * fun(n-k);
return x;
}
The return value of fun(5) is ________.
14. GATE 2015 SET-2 COMPUTER – CS
CS 3/12
Q.15 A software requirements specification (SRS) document should avoid discussing which one of the
following?
(A) User interface issues
(B) Non-functional requirements
(C) Design specification
(D) Interfaces with third party software
Q.16 Consider two decision problems 𝑄𝑄1, 𝑄𝑄2 such that 𝑄𝑄1 reduces in polynomial time to 3-SAT and
3-SAT reduces in polynomial time to 𝑄𝑄2. Then which one of the following is consistent with the
above statement?
(A) 𝑄𝑄1 is in NP, 𝑄𝑄2 is NP hard.
(B) 𝑄𝑄2 is in NP, 𝑄𝑄1 is NP hard.
(C) Both 𝑄𝑄1 and 𝑄𝑄2 are in NP .
(D) Both 𝑄𝑄1 and 𝑄𝑄2 are NP hard.
Q.17 Match the following:
P. Lexical analysis 1. Graph coloring
Q. Parsing 2. DFA minimization
R. Register allocation 3. Post-order traversal
S. Expression evaluation 4. Production tree
(A) P-2, Q-3, R-1, S-4 (B) P-2, Q-1, R-4, S-3
(C) P-2, Q-4, R-1, S-3 (D) P-2, Q-3, R-4, S-1
Q.18 In the context of abstract-syntax-tree (AST) and control-flow-graph (CFG), which one of the
following is TRUE?
(A) In both AST and CFG, let node N2 be the successor of node N1. In the input program, the code
corresponding to N2 is present after the code corresponding to N1
(B) For any input program, neither AST nor CFG will contain a cycle
(C) The maximum number of successors of a node in an AST and a CFG depends on the input
program
(D) Each node in AST and CFG corresponds to at most one statement in the input program
Q.19 Consider the basic COCOMO model where E is the effort applied in person-months, D is the
development time in chronological months, KLOC is the estimated number of delivered lines of
code (in thousands) and 𝑎𝑎𝑏𝑏, 𝑏𝑏𝑏𝑏, 𝑐𝑐𝑏𝑏, 𝑑𝑑𝑏𝑏 have their usual meanings. The basic COCOMO equations
are of the form
(A) 𝐸𝐸 = 𝑎𝑎𝑏𝑏(𝐾𝐾𝐾𝐾𝐾𝐾𝐾𝐾) exp(𝑏𝑏𝑏𝑏) , 𝐷𝐷 = 𝑐𝑐𝑏𝑏(𝐸𝐸) exp(𝑑𝑑𝑏𝑏)
(B) 𝐷𝐷 = 𝑎𝑎𝑏𝑏(𝐾𝐾𝐾𝐾𝐾𝐾𝐾𝐾) exp(𝑏𝑏𝑏𝑏) , 𝐸𝐸 = 𝑐𝑐𝑏𝑏(𝐷𝐷) exp(𝑑𝑑𝑏𝑏)
(C) 𝐸𝐸 = 𝑎𝑎𝑏𝑏 exp(𝑏𝑏𝑏𝑏) , 𝐷𝐷 = 𝑐𝑐𝑏𝑏(𝐾𝐾𝐾𝐾𝐾𝐾𝐾𝐾) exp(𝑑𝑑𝑏𝑏)
(D) 𝐸𝐸 = 𝑎𝑎𝑏𝑏 exp(𝑑𝑑𝑏𝑏) , 𝐷𝐷 = 𝑐𝑐𝑏𝑏(𝐾𝐾𝐾𝐾𝐾𝐾𝐾𝐾) exp(𝑏𝑏𝑏𝑏)
Q.20 A system has 6 identical resources and N processes competing for them. Each process can request
atmost 2 resources. Which one of the following values of N could lead to a deadlock?
(A) 1 (B) 2 (C) 3 (D) 4
15. GATE 2015 SET-2 COMPUTER – CS
CS 4/12
Q.21 Consider the following transaction involving two bank accounts x and y.
read(x); x := x - 50; write(x); read(y); y:= y + 50; write(y)
The constraint that the sum of the accounts x and y should remain constant is that of
(A) Atomicity (B) Consistency
(C) Isolation (D) Durability
Q.22 With reference to the B+ tree index of order 1 shown below, the minimum number of nodes
(including the Root node) that must be fetched in order to satisfy the following query: "Get all
records with a search key greater than or equal to 7 and less than 15" is ____________.
Q.23 Identify the correct order in which a server process must invoke the function calls accept,
bind, listen, and recv according to UNIX socket API.
(A) listen, accept, bind, recv (B) bind, listen, accept, recv
(C) bind, accept, listen, recv (D) accept, listen, bind, recv
Q.24 A link has a transmission speed of 106
bits/sec. It uses data packets of size 1000 bytes each.
Assume that the acknowledgment has negligible transmission delay, and that its propagation delay
is the same as the data propagation delay. Also assume that the processing delays at nodes are
negligible. The efficiency of the stop-and-wait protocol in this setup is exactly 25%. The value of
the one-way propagation delay (in milliseconds) is ____________.
Q.25 Which one of the following statements is NOT correct about HTTP cookies?
(A) A cookie is a piece of code that has the potential to compromise the security of an Internet user
(B) A cookie gains entry to the user’s work area through an HTTP header
(C) A cookie has an expiry date and time
(D) Cookies can be used to track the browsing pattern of a user at a particular site
9
5 13 17
1 3 5 7 9 11 13 15 17
16. GATE 2015 SET-2 COMPUTER – CS
CS 5/12
Q. 26 – Q. 55 carry two marks each.
Q.26 Consider the following routing table at an IP router:
Network No. Net Mask Next Hop
128.96.170.0 255.255.254.0 Interface 0
128.96.168.0 255.255.254.0 Interface 1
128.96.166.0 255.255.254.0 R2
128.96.164.0 255.255.252.0 R3
0.0.0.0 Default R4
For each IP address in Group I identify the correct choice of the next hop from Group II using the
entries from the routing table above.
Group I Group II
i) 128.96.171.92 a) Interface 0
ii) 128.96.167.151 b) Interface 1
iii) 128.96.163.151 c) R2
iv) 128.96.165.121 d) R3
e) R4
(A) i-a, ii-c, iii-e, iv-d (B) i-a, ii-d, iii-b, iv-e
(C) i-b, ii-c, iii-d, iv-e (D) i-b, ii-c, iii-e, iv-d
Q.27 Host A sends a UDP datagram containing 8880 bytes of user data to host B over an Ethernet LAN.
Ethernet frames may carry data up to 1500 bytes (i.e. MTU=1500 bytes). Size of UDP header is 8
bytes and size of IP header is 20 bytes. There is no option field in IP header. How many total
number of IP fragments will be transmitted and what will be the contents of offset field in the last
fragment?
(A) 6 and 925
(B) 6 and 7400
(C) 7 and 1110
(D) 7 and 8880
Q.28 Assume that the bandwidth for a TCP connection is 1048560 bits /sec. Let α be the value of RTT in
milliseconds (rounded off to the nearest integer) after which the TCP window scale option is
needed. Let β be the maximum possible window size with window scale option. Then the values of
α and β are
(A) 63 milliseconds, 65535 x 2
14
(B) 63 milliseconds, 65535 x 216
(C) 500 milliseconds, 65535 x 214
(D) 500 milliseconds, 65535 x 2
16
17. GATE 2015 SET-2 COMPUTER – CS
CS 6/12
Q.29 Consider a simple checkpointing protocol and the following set of operations in the log.
(start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7);
(checkpoint);
(start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3), (write, T3, z, 7, 2);
If a crash happens now and the system tries to recover using both undo and redo operations, what
are the contents of the undo list and the redo list?
(A) Undo: T3, T1; Redo: T2 (B) Undo: T3, T1; Redo: T2, T4
(C) Undo: none; Redo: T2, T4, T3, T1 (D) Undo: T3, T1, T4; Redo: T2
Q.30 Consider two relations R1(A,B) with the tuples (1,5), (3,7) and R2(A,C) = (1,7), (4,9). Assume that
R(A,B,C) is the full natural outer join of R1 and R2. Consider the following tuples of the form
(A,B,C): a = (1,5,null), b = (1,null,7), c = (3, null, 9), d = (4,7,null), e = (1,5,7), f = (3,7,null), g =
(4,null,9). Which one of the following statements is correct?
(A) R contains a, b, e, f, g but not c, d.
(B) R contains all of a, b, c, d, e, f, g.
(C) R contains e, f, g but not a, b.
(D) R contains e but not f, g.
Q.31 Consider six memory partitions of sizes 200 KB, 400 KB, 600 KB, 500 KB, 300 KB and 250 KB,
where KB refers to kilobyte. These partitions need to be allotted to four processes of sizes 357 KB,
210 KB, 468 KB and 491 KB in that order. If the best fit algorithm is used, which partitions are
NOT allotted to any process?
(A) 200 KB and 300 KB (B) 200 KB and 250 KB
(C) 250 KB and 300 KB (D) 300 KB and 400 KB
Q.32 Consider a typical disk that rotates at 15000 rotations per minute (RPM) and has a transfer rate of
50×10
6
bytes/sec. If the average seek time of the disk is twice the average rotational delay and the
controller’s transfer time is 10 times the disk transfer time, the average time (in milliseconds) to
read or write a 512-byte sector of the disk is _________________.
Q.33 A computer system implements 8 kilobyte pages and a 32-bit physical address space. Each page
table entry contains a valid bit, a dirty bit, three permission bits, and the translation. If the
maximum size of the page table of a process is 24 megabytes, the length of the virtual address
supported by the system is _______________ bits.
18. GATE 2015 SET-2 COMPUTER – CS
CS 7/12
Q.34 Consider the intermediate code given below.
(1) i = 1
(2) j = 1
(3) t1 = 5 ∗ i
(4) t2 = t1 + j
(5) t3 = 4 ∗ t2
(6) t4 = t3
(7) a[t4] = -1
(8) j = j + 1
(9) if j<=5 goto (3)
(10) i=i+1
(11) if i<5 goto (2)
The number of nodes and edges in the control-flow-graph constructed for the above code,
respectively, are
(A) 5 and 7 (B) 6 and 7 (C) 5 and 5 (D) 7 and 8
Q.35 The number of states in the minimal deterministic finite automaton corresponding to the regular
expression (0 + 1)∗
(10) is __________.
Q.36 Which of the following languages is/are regular?
L1: {wxw
R
| w, x ϵ {a, b}*
and |w|, |x| > 0}, w
R
is the reverse of string w
L2: {a
n
b
m
| m ≠ n and m, n ≥ 0}
L3: {a
p
b
q
c
r
| p, q, r ≥ 0}
(A) L1 and L3 only (B) L2 only (C) L2 and L3 only (D) L3 only
Q.37 Given below are some algorithms, and some algorithm design paradigms.
1. Dijkstra’s Shortest Path i. Divide and Conquer
2. Floyd-Warshall algorithm to compute all
pairs shortest path
ii. Dynamic Programming
3. Binary search on a sorted array iii. Greedy design
4. Backtracking search on a graph iv. Depth-first search
v. Breadth-first search
Match the above algorithms on the left to the corresponding design paradigm they follow.
(A) 1-i, 2-iii, 3-i, 4-v.
(B) 1-iii, 2-iii, 3-i, 4-v.
(C) 1-iii, 2-ii, 3-i, 4-iv.
(D) 1-iii, 2-ii, 3-i, 4-v.
19. GATE 2015 SET-2 COMPUTER – CS
CS 8/12
Q.38 A Young tableau is a 2D array of integers increasing from left to right and from top to bottom. Any
unfilled entries are marked with ∞, and hence there cannot be any entry to the right of, or below a
∞. The following Young tableau consists of unique entries.
1 2 5 14
3 4 6 23
10 12 18 25
31 ∞ ∞ ∞
When an element is removed from a Young tableau, other elements should be moved into its place
so that the resulting table is still a Young tableau (unfilled entries may be filled in with a ∞). The
minimum number of entries (other than 1) to be shifted, to remove 1 from the given Young tableau
is ______________.
Q.39 Suppose you are provided with the following function declaration in the C programming language.
int partition(int a[], int n);
The function treats the first element of a[] as a pivot, and rearranges the array so that all elements
less than or equal to the pivot is in the left part of the array, and all elements greater than the pivot
is in the right part. In addition, it moves the pivot so that the pivot is the last element of the left part.
The return value is the number of elements in the left part.
The following partially given function in the C programming language is used to find the 𝑘𝑘𝑡𝑡ℎ
smallest element in an array a[] of size n using the partition function. We assume 𝑘𝑘 ≤ 𝑛𝑛.
int kth_smallest(int a[], int n, int k)
{
int left_end = partition(a,n);
if ( left_end+1 == k ){
return a[left_end];
}
if ( left_end+1 > k ){
return kth_smallest( _____________________ );
} else {
return kth_smallest( _____________________ );
}
}
The missing argument lists are respectively
(A) (a, left_end, k) and (a+left_end+1, n-left_end-1, k-left_end-1)
(B) (a, left_end, k) and (a, n-left_end-1, k-left_end-1)
(C) (a+left_end+1, n-left_end-1, k-left_end-1) and (a, left_end, k)
(D) (a, n-left_end-1, k-left_end-1) and (a, left_end, k)
Q.40 Which one of the following hash functions on integers will distribute keys most uniformly over 10
buckets numbered 0 to 9 for 𝑖𝑖 ranging from 0 to 2020?
(A) ℎ(𝑖𝑖) = 𝑖𝑖2
mod 10
(B) ℎ(𝑖𝑖) = 𝑖𝑖3
mod 10
(C) ℎ(𝑖𝑖) = (11 ∗ 𝑖𝑖2
) mod 10
(D) ℎ(𝑖𝑖) = (12 ∗ 𝑖𝑖) mod 10
20. GATE 2015 SET-2 COMPUTER – CS
CS 9/12
Q.41 The secant method is used to find the root of an equation f(x) = 0. It is started from two distinct
estimates xa and xb for the root. It is an iterative procedure involving linear interpolation to a root.
The iteration stops if f(xb) is very small and then xb is the solution. The procedure is given below.
Observe that there is an expression which is missing and is marked by ?. Which is the suitable
expression that is to be put in place of ? so that it follows all steps of the secant method?
Secant
Initialize: xa, xb, ε, N // ε = convergence indicator
// N = maximum no. of iterations
fb = f(xb)
i = 0
while (i < N and |fb| > ε) do
i = i + 1 // update counter
xt = ? // missing expression for
// intermediate value
xa = xb // reset xa
xb = xt // reset xb
fb = f(xb) // function value at new xb
end while
if |fb| > ε then // loop is terminated with i=N
write “Non-convergence”
else
write “return xb”
end if
(A) xb – (fb–f(xa))fb /(xb–xa)
(B) xa – (fa–f(xa))fa /(xb–xa)
(C) xb – (xb–xa)fb /(fb–f(xa))
(D) xa – (xb–xa) fa /(fb–f(xa))
21. GATE 2015 SET-2 COMPUTER – CS
CS 10/12
Q.42 Consider the C program below.
#include <stdio.h>
int *A, stkTop;
int stkFunc(int opcode, int val)
{
static int size=0, stkTop=0;
switch (opcode) {
case -1: size = val; break;
case 0: if (stkTop < size) A[stkTop++] = val; break;
default: if (stkTop) return A[--stkTop];
}
return -1;
}
int main()
{
int B[20]; A = B; stkTop = -1;
stkFunc (-1, 10);
stkFunc ( 0, 5);
stkFunc ( 0, 10);
printf ("%dn", stkFunc(1, 0) + stkFunc(1, 0));
}
The value printed by the above program is __________.
Q.43 Consider the sequence of machine instructions given below:
MUL R5, R0, R1
DIV R6, R2, R3
ADD R7, R5, R6
SUB R8, R7, R4
In the above sequence, R0 to R8 are general purpose registers. In the instructions shown, the first
register stores the result of the operation performed on the second and the third registers. This
sequence of instructions is to be executed in a pipelined instruction processor with the following 4
stages: (1) Instruction Fetch and Decode (IF), (2) Operand Fetch (OF), (3) Perform Operation (PO)
and (4) Write back the result (WB). The IF, OF and WB stages take 1 clock cycle each for any
instruction. The PO stage takes 1 clock cycle for ADD or SUB instruction, 3 clock cycles for MUL
instruction and 5 clock cycles for DIV instruction. The pipelined processor uses operand
forwarding from the PO stage to the OF stage. The number of clock cycles taken for the execution
of the above sequence of instructions is ___________.
22. GATE 2015 SET-2 COMPUTER – CS
CS 11/12
Q.44 Consider a processor with byte-addressable memory. Assume that all registers, including Program
Counter (PC) and Program Status Word (PSW), are of size 2 bytes. A stack in the main memory is
implemented from memory location (0100)16 and it grows upward. The stack pointer (SP) points to
the top element of the stack. The current value of SP is (016E) 16. The CALL instruction is of two
words, the first word is the op-code and the second word is the starting address of the subroutine
(one word = 2 bytes). The CALL instruction is implemented as follows:
• Store the current value of PC in the stack
• Store the value of PSW register in the stack
• Load the starting address of the subroutine in PC
The content of PC just before the fetch of a CALL instruction is (5FA0) 16. After execution of the
CALL instruction, the value of the stack pointer is
(A) (016A) 16 (B) (016C) 16 (C) (0170) 16 (D) (0172) 16
Q.45 The number of min-terms after minimizing the following Boolean expression is _________.
[𝐷𝐷′
+ 𝐴𝐴𝐵𝐵′
+ 𝐴𝐴′
𝐶𝐶 + 𝐴𝐴𝐶𝐶′
𝐷𝐷 + 𝐴𝐴′𝐶𝐶′𝐷𝐷]′
Q.46 Let 𝑓𝑓(𝑥𝑥) = 𝑥𝑥−(1/3)
and 𝐴𝐴 denote the area of the region bounded by 𝑓𝑓(𝑥𝑥) and the X-axis, when 𝑥𝑥
varies from −1 to 1. Which of the following statements is/are TRUE?
I) 𝑓𝑓 is continuous in [−1, 1]
II) 𝑓𝑓 is not bounded in [−1, 1]
III) 𝐴𝐴 is nonzero and finite
(A) II only (B) III only
(C) II and III only (D) I, II and III
Q.47
Perform the following operations on the matrix
3 4 45
7 9 105
13 2 195
.
(i) Add the third row to the second row
(ii) Subtract the third column from the first column.
The determinant of the resultant matrix is___________.
Q.48 The number of onto functions (surjective functions) from set 𝑋𝑋 = {1, 2, 3, 4} to set 𝑌𝑌 = {𝑎𝑎, 𝑏𝑏, 𝑐𝑐} is
__________.
Q.49 Let 𝑋𝑋 and 𝑌𝑌 denote the sets containing 2 and 20 distinct objects respectively and 𝐹𝐹denote the set of
all possible functions defined from 𝑋𝑋 to 𝑌𝑌. Let 𝑓𝑓 be randomly chosen from 𝐹𝐹. The probability of 𝑓𝑓
being one-to-one is ________.
23. GATE 2015 SET-2 COMPUTER – CS
CS 12/12
Q.50 Consider the alphabet ∑ = {0, 1}, the null/empty string 𝜆𝜆 and the sets of strings X0, X1, and X2
generated by the corresponding non-terminals of a regular grammar. X0, X1, and X2 are related as
follows.
X0 = 1 X1
X1 = 0 X1 + 1 X2
X2 = 0 X1 + {𝜆𝜆}
Which one of the following choices precisely represents the strings in X0?
(A) 10(0* + (10)*)1 (B) 10(0* + (10)*)*1
(C) 1(0 + 10)*1 (D) 10(0 + 10)*1 + 110(0 + 10)*1
Q.51 A graph is self-complementary if it is isomorphic to its complement. For all self-complementary
graphs on 𝑛𝑛 vertices, 𝑛𝑛 is
(A) A multiple of 4
(B) Even
(C) Odd
(D) Congruent to 0 𝑚𝑚𝑚𝑚𝑚𝑚 4, or, 1 𝑚𝑚𝑚𝑚𝑚𝑚 4.
Q.52 In a connected graph, a bridge is an edge whose removal disconnects a graph. Which one of the
following statements is true?
(A) A tree has no bridges
(B) A bridge cannot be part of a simple cycle
(C) Every edge of a clique with size ≥ 3 is a bridge (A clique is any complete subgraph of a graph)
(D) A graph with bridges cannot have a cycle
Q.53 Which one of the following well formed formulae is a tautology?
(A) ∀𝑥𝑥 ∃𝑦𝑦 𝑅𝑅(𝑥𝑥, 𝑦𝑦) ↔ ∃𝑦𝑦 ∀𝑥𝑥 𝑅𝑅(𝑥𝑥, 𝑦𝑦)
(B) (∀𝑥𝑥 [∃𝑦𝑦 𝑅𝑅(𝑥𝑥, 𝑦𝑦) → 𝑆𝑆(𝑥𝑥, 𝑦𝑦)]) → ∀𝑥𝑥∃𝑦𝑦 𝑆𝑆(𝑥𝑥, 𝑦𝑦)
(C) [∀𝑥𝑥 ∃𝑦𝑦 (𝑃𝑃(𝑥𝑥, 𝑦𝑦) → 𝑅𝑅(𝑥𝑥, 𝑦𝑦)] ↔ [∀𝑥𝑥 ∃𝑦𝑦 (¬ 𝑃𝑃(𝑥𝑥, 𝑦𝑦) ∨ 𝑅𝑅(𝑥𝑥, 𝑦𝑦)]
(D) ∀𝑥𝑥 ∀𝑦𝑦 𝑃𝑃(𝑥𝑥, 𝑦𝑦) → ∀𝑥𝑥 ∀𝑦𝑦 𝑃𝑃(𝑦𝑦, 𝑥𝑥)
Q.54 Which one of the following assertions concerning code inspection and code walkthrough is true?
(A) Code inspection is carried out once the code has been unit tested
(B) Code inspection and code walkthrough are synonyms
(C) Adherence to coding standards is checked during code inspection
(D) Code walkthrough is usually carried out by an independent test team
Q.55 A half adder is implemented with XOR and AND gates. A full adder is implemented with two half
adders and one OR gate. The propagation delay of an XOR gate is twice that of an AND/OR gate.
The propagation delay of an AND/OR gate is 1.2 microseconds. A 4-bit ripple-carry binary adder is
implemented by using four full adders. The total propagation time of this 4-bit binary adder in
microseconds is____________.
END OF THE QUESTION PAPER
24. GATE 2015 SET-3 COMPUTER SCIENCE - CS
CS 1/14
Q. 1 – Q. 25 carry one mark each.
Q.1 Consider the following C program segment.
#include <stdio.h>
int main()
{
char s1[7] = "1234", *p;
p = s1 + 2;
*p = ‘0’;
printf("%s", s1);
}
What will be printed by the program?
(A) 12 (B) 120400 (C) 1204 (D) 1034
Q.2 Suppose 𝑈𝑈 is the power set of the set 𝑆𝑆 = {1,2,3,4,5,6}. For any 𝑇𝑇 ∈ 𝑈𝑈, let |𝑇𝑇| denote the number
of elements in 𝑇𝑇 and 𝑇𝑇′ denote the complement of 𝑇𝑇. For any 𝑇𝑇, 𝑅𝑅 ∈ 𝑈𝑈, let 𝑇𝑇 ∖ 𝑅𝑅 be the set of all
elements in 𝑇𝑇 which are not in 𝑅𝑅. Which one of the following is true?
(A) ∀𝑋𝑋 ∈ 𝑈𝑈 (|𝑋𝑋| = |𝑋𝑋′
|)
(B) ∃𝑋𝑋 ∈ 𝑈𝑈 ∃𝑌𝑌 ∈ 𝑈𝑈 (|𝑋𝑋| = 5, |𝑌𝑌| = 5 and 𝑋𝑋 ∩ 𝑌𝑌 = ∅)
(C) ∀𝑋𝑋 ∈ 𝑈𝑈 ∀𝑌𝑌 ∈ 𝑈𝑈 (|𝑋𝑋| = 2, |𝑌𝑌| = 3 and 𝑋𝑋 ∖ 𝑌𝑌 = ∅)
(D) ∀𝑋𝑋 ∈ 𝑈𝑈 ∀𝑌𝑌 ∈ 𝑈𝑈 (𝑋𝑋 ∖ 𝑌𝑌 = 𝑌𝑌′
∖ 𝑋𝑋′
)
Q.3 Consider the relation 𝑋𝑋(𝑃𝑃, 𝑄𝑄, 𝑅𝑅, 𝑆𝑆, 𝑇𝑇, 𝑈𝑈) with the following set of functional dependencies
𝐹𝐹 = {
{𝑃𝑃, 𝑅𝑅} → {𝑆𝑆, 𝑇𝑇},
{𝑃𝑃, 𝑆𝑆, 𝑈𝑈} → {𝑄𝑄, 𝑅𝑅}
}
Which of the following is the trivial functional dependency in 𝐹𝐹+
, where 𝐹𝐹+
is closure of F ?
(A) {𝑃𝑃, 𝑅𝑅} → {𝑆𝑆, 𝑇𝑇} (B) {𝑃𝑃, 𝑅𝑅} → {𝑅𝑅, 𝑇𝑇} (C) {𝑃𝑃, 𝑆𝑆} → {𝑆𝑆} (D) {𝑃𝑃, 𝑆𝑆, 𝑈𝑈} → {𝑄𝑄}
Q.4 The maximum number of processes that can be in Ready state for a computer system with 𝑛𝑛 CPUs
is
(A) 𝑛𝑛 (B) 𝑛𝑛2 (C) 2𝑛𝑛
(D) Independent of 𝑛𝑛
Q.5 Among simple LR (SLR) , canonical LR, and look-ahead LR (LALR), which of the following pairs
identify the method that is very easy to implement and the method that is the most powerful , in that
order?
(A) SLR, LALR
(B) Canonical LR, LALR
(C) SLR, canonical LR
(D) LALR, canonical LR
25. GATE 2015 SET-3 COMPUTER SCIENCE - CS
CS 2/14
Q.6 Let # be a binary operator defined as
𝑋𝑋 # 𝑌𝑌 = 𝑋𝑋′
+ 𝑌𝑌′ where 𝑋𝑋 and 𝑌𝑌 are Boolean variables.
Consider the following two statements.
(S1) (𝑃𝑃 # 𝑄𝑄)#𝑅𝑅 = 𝑃𝑃#(𝑄𝑄 # 𝑅𝑅)
(S2) 𝑄𝑄#𝑅𝑅 = 𝑅𝑅#𝑄𝑄
Which of the following is/are true for the Boolean variables 𝑃𝑃, 𝑄𝑄 and 𝑅𝑅?
(A) Only S1 is true
(B) Only S2 is true
(C) Both S1 and S2 are true
(D) Neither S1 nor S2 are true
Q.7 Consider a software project with the following information domain characteristics for calculation of
function point metric.
Number of external inputs (I) = 30
Number of external outputs (O) = 60
Number of external inquiries (E) = 23
Number of files (F) = 08
Number of external interfaces (N) = 02
It is given that the complexity weighting factors for I, O, E, F and N are 4, 5, 4, 10 and 7,
respectively. It is also given that, out of fourteen value adjustment factors that influence the
development effort, four factors are not applicable, each of the other four factors have value 3, and
each of the remaining factors have value 4. The computed value of function point metric is
_____________.
Q.8 In a web server, ten WebPages are stored with the URLs of the form
http://www.yourname.com/𝑣𝑣𝑣𝑣𝑣𝑣.html; where, 𝑣𝑣𝑣𝑣𝑣𝑣 is a different number from 1 to 10 for each
Webpage. Suppose, the client stores the Webpage with 𝑣𝑣𝑣𝑣𝑣𝑣 = 1 (say W1) in local machine, edits
and then tests. Rest of the WebPages remains on the web server. W1 contains several relative URLs
of the form “𝑣𝑣𝑣𝑣𝑣𝑣.html” referring to the other WebPages. Which one of the following statements
needs to be added in W1, so that all the relative URLs in W1 refer to the appropriate WebPages on
the web server?
(A) <a href: “http://www.yourname.com/”, href: “...𝑣𝑣𝑣𝑣𝑣𝑣.html”>
(B) <base href: “http://www.yourname.com/”>
(C) <a href: “http://www.yourname.com/”>
(D) <base href: “http://www.yourname.com/”, range:“…𝑣𝑣𝑣𝑣𝑣𝑣.html”>
26. GATE 2015 SET-3 COMPUTER SCIENCE - CS
CS 3/14
Q.9 Consider the following statements.
I. TCP connections are full duplex
II. TCP has no option for selective acknowledgement
III. TCP connections are message streams
(A) Only I is correct
(B) Only I and III are correct
(C) Only II and III are correct
(D) All of I, II and III are correct
Q.10
Consider the equality
3
0
n
i
i X
=
=∑ and the following choices for 𝑋𝑋
I. Ɵ(𝑛𝑛4)
II. Ɵ(𝑛𝑛5)
III. 𝑂𝑂(𝑛𝑛5)
IV. Ω(𝑛𝑛3)
The equality above remains correct if 𝑋𝑋 is replaced by
(A) Only I
(B) Only II
(C) I or III or IV but not II
(D) II or III or IV but not I
Q.11 Consider a binary tree T that has 200 leaf nodes. Then, the number of nodes in T that have exactly
two children are ________.
Q.12 Given a hash table 𝑇𝑇 with 25 slots that stores 2000 elements, the load factor 𝛼𝛼 for 𝑇𝑇 is
____________.
Q.13
In the given matrix
−
121
010
211
, one of the eigenvalues is 1. The eigenvectors corresponding to
the eigenvalue 1 are
(A) {𝛼𝛼(4,2,1)|𝛼𝛼 ≠ 0, 𝛼𝛼 ∈ ℝ} (B) {𝛼𝛼(−4,2,1)|𝛼𝛼 ≠ 0, 𝛼𝛼 ∈ ℝ}
(C) {𝛼𝛼�√2, 0,1�|𝛼𝛼 ≠ 0, 𝛼𝛼 ∈ ℝ} (D) {𝛼𝛼�−√2, 0,1�|𝛼𝛼 ≠ 0, 𝛼𝛼 ∈ ℝ}
Q.14 The value of lim𝑥𝑥→∞(1 + 𝑥𝑥2)𝑒𝑒−𝑥𝑥
is
(A) 0 (B)
2
1
(C) 1 (D) ∞
Q.15 The number of 4 digit numbers having their digits in non-decreasing order (from left to right)
constructed by using the digits belonging to the set {1, 2, 3} is____________.
27. GATE 2015 SET-3 COMPUTER SCIENCE - CS
CS 4/14
Q.16 In a room there are only two types of people, namely Type 1 and Type 2. Type 1 people always tell
the truth and Type 2 people always lie. You give a fair coin to a person in that room, without
knowing which type he is from and tell him to toss it and hide the result from you till you ask for it.
Upon asking, the person replies the following
“The result of the toss is head if and only if I am telling the truth.”
Which of the following options is correct?
(A) The result is head
(B) The result is tail
(C) If the person is of Type 2, then the result is tail
(D) If the person is of Type 1, then the result is tail
Q.17 While inserting the elements 71, 65, 84, 69, 67, 83 in an empty binary search tree (BST) in the
sequence shown, the element in the lowest level is
(A) 65 (B) 67 (C) 69 (D) 83
Q.18 The result evaluating the postfix expression 10 5 + 60 6 / * 8 − is
(A) 284 (B) 213 (C) 142 (D) 71
Q.19 Consider the following relation
Cinema(theater, address, capacity)
Which of the following options will be needed at the end of the SQL query
SELECT P1.address
FROM Cinema P1
such that it always finds the addresses of theaters with maximum capacity?
(A) WHERE P1.capacity >= All (select P2.capacity from Cinema P2)
(B) WHERE P1.capacity >= Any (select P2.capacity from Cinema P2)
(C) WHERE P1.capacity > All (select max(P2.capacity) from Cinema P2)
(D) WHERE P1.capacity > Any (select max(P2.capacity) from Cinema P2)
Q.20 Consider the following array of elements.
〈89, 19, 50, 17, 12, 15, 2, 5, 7, 11, 6, 9, 100〉
The minimum number of interchanges needed to convert it into a max-heap is
(A) 4 (B) 5 (C) 2 (D) 3
28. GATE 2015 SET-3 COMPUTER SCIENCE - CS
CS 5/14
Q.21 Two processes 𝑋𝑋 and 𝑌𝑌 need to access a critical section. Consider the following synchronization
construct used by both the processes
Process 𝑋𝑋
/* other code for process 𝑋𝑋 */
while(true)
{
varP = true;
while(varQ == true)
{
/* Critical Section */
varP = false;
}
}
/* other code for process 𝑋𝑋 */
Process 𝑌𝑌
/* other code for process 𝑌𝑌 */
while(true)
{
varQ = true;
while(varP == true)
{
/* Critical Section */
varQ = false;
}
}
/* other code for process 𝑌𝑌 */
Here, varP and varQ are shared variables and both are initialized to false. Which one of the
following statements is true?
(A) The proposed solution prevents deadlock but fails to guarantee mutual exclusion
(B) The proposed solution guarantees mutual exclusion but fails to prevent deadlock
(C) The proposed solution guarantees mutual exclusion and prevents deadlock
(D) The proposed solution fails to prevent deadlock and fails to guarantee mutual exclusion
Q.22 Let L be the language represented by the regular expression Σ∗
0011Σ∗
where Σ = {0, 1}. What is
the minimum number of states in a DFA that recognizes L� (complement of L)?
(A) 4 (B) 5 (C) 6 (D) 8
Q.23 Consider a software program that is artificially seeded with 100 faults. While testing this program,
159 faults are detected, out of which 75 faults are from those artificially seeded faults. Assuming
that both real and seeded faults are of same nature and have same distribution, the estimated
number of undetected real faults is ____________.
Q.24 Consider a machine with a byte addressable main memory of 220
bytes, block size of 16 bytes and a
direct mapped cache having 212
cache lines. Let the addresses of two consecutive bytes in main
memory be (E201F)16 and (E2020)16. What are the tag and cache line address (in hex) for main
memory address (E201F)16?
(A) E, 201 (B) F, 201 (C) E, E20 (D) 2, 01F
Q.25 Consider a CSMA/CD network that transmits data at a rate of 100 Mbps (108
bits per second) over
a 1 km (kilometer) cable with no repeaters. If the minimum frame size required for this network is
1250 bytes, what is the signal speed (km/sec) in the cable?
(A) 8000 (B) 10000 (C) 16000 (D) 20000
29. GATE 2015 SET-3 COMPUTER SCIENCE - CS
CS 6/14
Q. 26 – Q. 55 carry two marks each.
Q.26 The velocity v (in kilometer/minute) of a motorbike which starts from rest, is given at fixed
intervals of time t (in minutes) as follows:
t 2 4 6 8 10 12 14 16 18 20
v 10 18 25 29 32 20 11 5 2 0
The approximate distance (in kilometers) rounded to two places of decimals covered in 20 minutes
using Simpson’s 1/3rd
rule is _______________.
Q.27 Assume that a mergesort algorithm in the worst case takes 30 seconds for an input of size 64.
Which of the following most closely approximates the maximum input size of a problem that can
be solved in 6 minutes?
(A) 256 (B) 512 (C) 1024 (D) 2048
Q.28 Consider the following recursive C function.
void get(int n)
{
if (n<1) return;
get(n-1);
get(n-3);
printf(“%d”, n);
}
If get(6) function is being called in main()then how many times will the get()function be
invoked before returning to the main()?
(A) 15 (B) 25 (C) 35 (D) 45
Q.29 Consider a B+ tree in which the search key is 12 bytes long, block size is 1024 bytes, record pointer
is 10 bytes long and block pointer is 8 bytes long. The maximum number of keys that can be
accommodated in each non-leaf node of the tree is ____________.
Q.30 Given the function 𝐹𝐹 = 𝑃𝑃′ + 𝑄𝑄𝑄𝑄, where 𝐹𝐹 is a function in three Boolean variables 𝑃𝑃, 𝑄𝑄 and 𝑅𝑅 and
𝑃𝑃′ = ! 𝑃𝑃 , consider the following statements.
(S1) 𝐹𝐹 = ∑(4, 5, 6)
(S2) 𝐹𝐹 = ∑(0, 1, 2, 3, 7)
(S3) 𝐹𝐹 = ∏(4, 5, 6)
(S4) 𝐹𝐹 = ∏(0, 1, 2, 3, 7)
Which of the following is true?
(A) (S1)- False, (S2)- True, (S3)- True, (S4)- False
(B) (S1)- True, (S2)- False, (S3)- False, (S4)- True
(C) (S1)- False, (S2)- False, (S3)- True, (S4)- True
(D) (S1)- True, (S2)- True, (S3)- False, (S4)- False
30. GATE 2015 SET-3 COMPUTER SCIENCE - CS
CS 7/14
Q.31 Language 1L is polynomial time reducible to language 2L . Language 3L is polynomial time
reducible to 2L , which in turn is polynomial time reducible to language 4L . Which of the
following is/are true?
I. if 4L P∈ , then 2L P∈
II. if 1L P∈ or 3L P∈ , then 2L P∈
III. 1L P∈ , if and only if 3L P∈
IV. if 4L P∈ , then 1L P∈ and 3L P∈
(A) II only (B) III only
(C) I and IV only (D) I only
Q.32 Consider the following C program.
#include<stdio.h>
int f1(void);
int f2(void);
int f3(void);
int x = 10;
int main( )
{
int x = 1;
x += f1( ) + f2( ) + f3( ) + f2( );
printf(“%d”, x);
return 0;
}
int f1() { int x = 25; x++; return x;}
int f2() { static int x = 50; x++; return x;}
int f3() { x *= 10; return x};
The output of the program is ________.
Q.33 Consider the following C program.
#include<stdio.h>
int main( )
{
static int a[ ] = {10, 20, 30, 40, 50};
static int *p[ ] = {a, a+3, a+4, a+1, a+2};
int **ptr = p;
ptr++;
printf(“%d%d”, ptr-p,**ptr);
}
The output of the program is ______________.
31. GATE 2015 SET-3 COMPUTER SCIENCE - CS
CS 8/14
Q.34 Which of the following languages are context-free?
L1 = {am
bn
an
bm
| m, n ≥ 1}
L2 = {am
bn
am
bn
| m, n ≥ 1}
L3 = {am
bn
| m = 2n + 1 }
(A) L1 and L2 only (B) L1 and L3 only (C) L2 and L3 only (D) L3 only
Q.35 Consider the following policies for preventing deadlock in a system with mutually exclusive
resources.
I. Processes should acquire all their resources at the beginning of execution. If any resource is
not available, all resources acquired so far are released
II. The resources are numbered uniquely, and processes are allowed to request for resources
only in increasing resource numbers
III. The resources are numbered uniquely, and processes are allowed to request for resources
only in decreasing resource numbers
IV. The resources are numbered uniquely. A process is allowed to request only for a resource
with resource number larger than its currently held resources
Which of the above policies can be used for preventing deadlock?
(A) Any one of I and III but not II or IV
(B) Any one of I, III, and IV but not II
(C) Any one of II and III but not I or IV
(D) Any one of I, II, III, and IV
Q.36 In the network 200.10.11.144/27, the fourth octet (in decimal) of the last IP address of the network
which can be assigned to a host is ____________.
Q.37 Consider a network connecting two systems located 8000 kilometers apart. The bandwidth of the
network is 500×106
bits per second. The propagation speed of the media is 4×106
meters per
second. It is needed to design a Go-Back-𝑁𝑁 sliding window protocol for this network. The average
packet size is 10
7
bits. The network is to be used to its full capacity. Assume that processing delays
at nodes are negligible. Then, the minimum size in bits of the sequence number field has to be
___________.
Q.38 Consider the following reservation table for a pipeline having three stages 𝑆𝑆1, 𝑆𝑆2 and 𝑆𝑆3.
𝑇𝑇𝑇𝑇 𝑇𝑇𝑇𝑇 →
1 2 3 4 5
𝑆𝑆1 𝑋𝑋 𝑋𝑋
𝑆𝑆2 𝑋𝑋 𝑋𝑋
𝑆𝑆3 𝑋𝑋
The minimum average latency (MAL) is ________.
32. GATE 2015 SET-3 COMPUTER SCIENCE - CS
CS 9/14
Q.39 Consider the following code sequence having five instructions 𝐼𝐼1 to 𝐼𝐼5. Each of these instructions
has the following format.
OP Ri, Rj, Rk
where operation OP is performed on contents of registers Rj and Rk and the result is stored in
register Ri.
𝐼𝐼1: ADD R1, R2, R3
𝐼𝐼2: MUL R7, R1, R3
𝐼𝐼3: SUB R4, R1, R5
𝐼𝐼4: ADD R3, R2, R4
𝐼𝐼5: MUL R7, R8, R9
Consider the following three statements.
S1: There is an anti-dependence between instructions 𝐼𝐼2 and 𝐼𝐼5
S2: There is an anti-dependence between instructions 𝐼𝐼2 and 𝐼𝐼4
S3: Within an instruction pipeline an anti-dependence always creates one or more stalls
Which one of above statements is/are correct?
(A) Only S1 is true
(B) Only S2 is true
(C) Only S1 and S3 are true
(D) Only S2 and S3 are true
33. GATE 2015 SET-3 COMPUTER SCIENCE - CS
CS 10/14
Q.40 Consider the following two C code segments. Y and X are one and two dimensional arrays of size 𝑛𝑛
and 𝑛𝑛 × 𝑛𝑛 respectively, where 2 ≤ 𝑛𝑛 ≤ 10. Assume that in both code segments, elements of Y are
initialized to 0 and each element X[i][j] of array X is initialized to i+j. Further assume that
when stored in main memory all elements of X are in same main memory page frame.
Code segment 1:
//initialize elements of Y to 0
//initialize elements X[i][j] of X to i+j
for(i = 0; i < n; i++)
Y[i] += X[0][i];
Code Segment 2:
//initialize elements of Y to 0
//initialize elements X[i][j] of X to i+j
for(i = 0; i < n; i++)
Y[i] += X[i][0];
Which of the following statements is/are correct?
S1: Final contents of array Y will be same in both code segments
S2: Elements of array X accessed inside the for loop shown in code segment 1 are
contiguous in main memory
S3: Elements of array X accessed inside the for loop shown in code segment 2 are
contiguous in main memory
(A) Only S2 is correct
(B) Only S3 is correct
(C) Only S1 and S2 are correct
(D) Only S1 and S3 are correct
Q.41 Consider the following partial Schedule S involving two transactions T1 and T2. Only the read and
the write operations have been shown. The read operation on data item P is denoted by read(P) and
the write operation on data item P is denoted by write(P).
Time
instance
Transaction-id
T1 T2
1 read(A)
2 write(A)
3 read(C)
4 write(C)
5 read(B)
6 write(B)
7 read(A)
8 commit
9 read(B)
Schedule S
Suppose that the transaction T1 fails immediately after time instance 9. Which one of the following
statements is correct?
(A) T2 must be aborted and then both T1 and T2 must be re-started to ensure transaction atomicity
(B) Schedule S is non-recoverable and cannot ensure transaction atomicity
(C) Only T2 must be aborted and then re-started to ensure transaction atomicity
(D) Schedule S is recoverable and can ensure atomicity and nothing else needs to be done
34. GATE 2015 SET-3 COMPUTER SCIENCE - CS
CS 11/14
Q.42 If the following system has non-trivial solution,
,0
0
0
=++
=++
=++
qzpyrx
pzryqx
rzqypx
then which one of the following options is TRUE?
(A) 0=+− rqp or rqp −==
(B) 0=−+ rqp or rqp =−=
(C) 0=++ rqp or rqp ==
(D) 0=+− rqp or rqp −=−=
Q.43 Consider the following C program:
#include<stdio.h>
int main( )
{
int i, j, k = 0;
j = 2 * 3 / 4 + 2.0 / 5 + 8 / 5;
k −= −−j;
for(i = 0; i < 5; i++)
{
switch(i + k)
{
case 1:
case 2: printf(“n%d”, i+k);
case 3: printf(“n%d”, i+k);
default: printf(“n%d”, i+k);
}
}
return 0;
}
The number of times printf statement is executed is ____________.
Q.44
If for non-zero x,
1 1
( ) 25af x bf
x x
+ =−
where ba ≠ then ∫
2
1
)( dxxf is
(A) 2 2
1 47b
(ln 2 25)
2
a
a b
− + −
(B) 2 2
1 47b
(2ln 2 25)
2
a
a b
− − −
(C) 2 2
1 47b
(2ln 2 25)
2
a
a b
− + −
(D) 2 2
1 47b
(ln 2 25)
2
a
a b
− − −
35. GATE 2015 SET-3 COMPUTER SCIENCE - CS
CS 12/14
Q.45 Let G be a connected undirected graph of 100 vertices and 300 edges. The weight of a minimum
spanning tree of G is 500. When the weight of each edge of G is increased by five, the weight of a
minimum spanning tree becomes ________.
Q.46 Two hosts are connected via a packet switch with 107
bits per second links. Each link has a
propagation delay of 20 microseconds. The switch begins forwarding a packet 35 microseconds
after it receives the same. If 10000 bits of data are to be transmitted between the two hosts using a
packet size of 5000 bits, the time elapsed between the transmission of the first bit of data and the
reception of the last bit of the data in microseconds is____________.
Q.47 For the processes listed in the following table, which of the following scheduling schemes will give
the lowest average turnaround time?
Process Arrival Time Processing Time
A 0 3
B 1 6
C 4 4
D 6 2
(A) First Come First Serve
(B) Non-preemptive Shortest Job First
(C) Shortest Remaining Time
(D) Round Robin with Quantum value two
36. GATE 2015 SET-3 COMPUTER SCIENCE - CS
CS 13/14
Q.48 Consider three software items: Program-𝑋𝑋, Control Flow Diagram of Program-𝑌𝑌 and Control Flow
Diagram of Program-𝑍𝑍 as shown below
Program-𝑿𝑿:
sumcal(int maxint, int value)
{
int result=0, i=0;
if (value <0)
{
value = −value;
}
while((i<value) AND (result
<= maxint))
{
i=i+1;
result = result + 1;
}
if(result <= maxint)
{
printf(result);
}
else
{
printf(“large”);
}
printf(“end of program”);
}
Control Flow Diagram of Program-𝒀𝒀:
Control Flow Diagram of Program-𝒁𝒁:
The values of McCabe’s Cyclomatic complexity of Program-𝑋𝑋, Program-𝑌𝑌, and Program-𝑍𝑍
respectively are
(A) 4, 4, 7 (B) 3, 4, 7 (C) 4, 4, 8 (D) 4, 3, 8
Q.49 Consider the equation (43)𝑥𝑥 = (𝑦𝑦3)8 where 𝑥𝑥 and 𝑦𝑦 are unknown. The number of possible
solutions is ______________
Q.50 Let R be a relation on the set of ordered pairs of positive integers such that ((p,q),(r,s)) ϵ R if and
only if p− s = q− r. Which one of the following is true about R?
(A) Both reflexive and symmetric (B) Reflexive but not symmetric
(C) Not reflexive but symmetric (D) Neither reflexive nor symmetric
Control Flow Diagram of
Program-𝑋𝑋
Control Flow Diagram of
Program-𝑌𝑌
37. GATE 2015 SET-3 COMPUTER SCIENCE - CS
CS 14/14
Q.51 Suppose 𝑋𝑋𝑖𝑖 for 𝑖𝑖 = 1,2,3 are independent and identically distributed random variables whose
probability mass functions are Pr[𝑋𝑋𝑖𝑖 = 0] = Pr[𝑋𝑋𝑖𝑖 = 1] = 1/2 for 𝑖𝑖 = 1, 2, 3. Define another
random variable 𝑌𝑌 = 𝑋𝑋1 𝑋𝑋2 ⊕ 𝑋𝑋3, where ⊕ denotes XOR. Then
Pr[𝑌𝑌 = 0|𝑋𝑋3 = 0] =_______________.
Q.52 The total number of prime implicants of the function 𝑓𝑓(𝑤𝑤, 𝑥𝑥, 𝑦𝑦, 𝑧𝑧) = ∑(0, 2, 4, 5, 6, 10) is _______.
Q.53 Suppose 𝑐𝑐 = 〈𝑐𝑐[0], … , 𝑐𝑐[𝑘𝑘 − 1]〉 is an array of length 𝑘𝑘, where all the entries are from the set {0, 1}.
For any positive integers 𝑎𝑎 and 𝑛𝑛, consider the following pseudocode.
DOSOMETHING(𝑐𝑐, 𝑎𝑎, 𝑛𝑛)
𝑧𝑧 ← 1
for 𝑖𝑖 ← 0 to 𝑘𝑘 − 1
do 𝑧𝑧 ← 𝑧𝑧2
mod 𝑛𝑛
if 𝑐𝑐[𝑖𝑖] = 1
then 𝑧𝑧 ← (𝑧𝑧 × 𝑎𝑎) mod 𝑛𝑛
return 𝑧𝑧
If 𝑘𝑘 = 4, 𝑐𝑐 = 〈1, 0, 1, 1〉, 𝑎𝑎 = 2 and 𝑛𝑛 = 8, then the output of DOSOMETHING(𝑐𝑐, 𝑎𝑎, 𝑛𝑛) is
__________________.
Q.54 Let 𝑓𝑓(𝑛𝑛) = 𝑛𝑛 and 𝑔𝑔(𝑛𝑛) = 𝑛𝑛(1+ 𝑠𝑠𝑠𝑠𝑠𝑠 𝑛𝑛)
, where 𝑛𝑛 is a positive integer. Which of the following
statements is/are correct?
I. 𝑓𝑓(𝑛𝑛) = 𝑂𝑂(𝑔𝑔(𝑛𝑛))
II. 𝑓𝑓(𝑛𝑛) = Ω(𝑔𝑔(𝑛𝑛))
(A) Only I
(B) Only II
(C) Both I and II
(D) Neither I nor II
Q.55 Consider the following grammar 𝐺𝐺
𝑆𝑆 → 𝐹𝐹 | 𝐻𝐻
𝐹𝐹 → 𝑝𝑝 | 𝑐𝑐
𝐻𝐻 → 𝑑𝑑 | 𝑐𝑐
where 𝑆𝑆, 𝐹𝐹, and 𝐻𝐻 are non-terminal symbols, 𝑝𝑝, 𝑑𝑑, and 𝑐𝑐 are terminal symbols. Which of the
following statement(s) is/are correct?
S1. LL(1) can parse all strings that are generated using grammar 𝐺𝐺
S2. LR(1) can parse all strings that are generated using grammar 𝐺𝐺
(A) Only S1 (B) Only S2 (C) Both S1 and S2 (D) Neither S1 nor S2
END OF THE QUESTION PAPER
38. GATE 2016 General Aptitude - GA Set-5
1/3
Q. 1 – Q. 5 carry one mark each.
Q.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.
Q.2 A rewording of something written or spoken is a ______________.
(A) paraphrase (B) paradox (C) paradigm (D) paraffin
Q.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
Q.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
Q.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
39. GATE 2016 General Aptitude - GA Set-5
2/3
Q. 6 – Q. 10 carry two marks each.
Q.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.
Quarter Product Elegance Smooth Soft Executive
Q1 27300 20009 17602 9999
Q2 25222 19392 18445 8942
Q3 28976 22429 19544 10234
Q4 21012 18229 16595 10109
Which product contributes the greatest fraction to the revenue of the company in that year?
(A) Elegance (B) Executive (C) Smooth (D) Soft
Q.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.
Q.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)
Q.9 If f(𝑥𝑥) = 2𝑥𝑥7 + 3𝑥𝑥 − 5, which of the following is a factor of f(x)?
(A) (x3
+8) (B) (x-1) (C) (2x-5) (D) (x+1)
40. GATE 2016 General Aptitude - GA Set-5
3/3
Q.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
END OF THE QUESTION PAPER
41. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q. 1 - Q. 25 carry one mark each.
Q.1 Let p,q,r,s represent the following propositions.
p: x ∈ {8,9,10,11,12}
q: x is a composite number
r: x is a perfect square
s: x is a prime number
The integer x ≥ 2 which satisfies ¬((p ⇒ q)∧(¬r ∨¬s)) is .
Q.2 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?
(A) an = an−1 +2an−2
(B) an = an−1 +an−2
(C) an = 2an−1 +an−2
(D) an = 2an−1 +2an−2
Q.3
lim
x→4
sin(x−4)
x−4
= .
Q.4 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 .
Q.5 Two eigenvalues of a 3 × 3 real matrix P are (2 +
√
−1) and 3. The determinant of P is
.
CS(Set A) 1/17
42. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.6 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) x¯y+ ¯x¯y
(C) ¯xy+xy
(D) xy+ ¯x¯y
Q.7 The 16-bit 2’s complement representation of an integer is 1111 1111 1111 0101; its decimal
representation is .
Q.8 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
.
Q.9 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.
Q.10 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 Ω(logn)
CS(Set A) 2/17
43. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.11 Consider the following directed graph:
a
b c
f
ed
The number of different topological orderings of the vertices of the graph is .
Q.12 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)
CS(Set A) 3/17
44. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.13 The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are:
(A) Θ(nlogn), Θ(nlogn), and Θ(n2)
(B) Θ(n2), Θ(n2), and Θ(nlogn)
(C) Θ(n2), Θ(nlogn), and Θ(nlogn)
(D) Θ(n2), Θ(nlogn), and Θ(n2)
Q.14 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
CS(Set A) 4/17
45. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.15 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 is .
Q.16 Which of the following languages is generated by the given grammar?
S −→ aS | bS | ε
(A) {anbm | n,m ≥ 0}
(B) {w ∈ {a,b}∗ | w has equal number of a’s and b’s }
(C) {an | n ≥ 0}∪{bn | n ≥ 0}∪{anbn | n ≥ 0}
(D) {a,b}∗
CS(Set A) 5/17
46. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.17 Which of the following decision problems are undecidable?
I. Given NFAs N1 and N2, is L(N1)∩L(N2) = Φ?
II. Given a CFG G = (N,Σ,P,S) and a string x ∈ Σ∗, does x ∈ L(G)?
III. Given CFGs G1 and G2, is L(G1) = L(G2)?
IV. Given a TM M, is L(M) = Φ?
(A) I and IV only
(B) II and III only
(C) III and IV only
(D) II and IV only
Q.18 Which one of the following regular expressions represents the language: the set of all binary
strings having two consecutive 0s and two consecutive 1s?
(A) (0+1)∗0011(0+1)∗ +(0+1)∗1100(0+1)∗
(B) (0+1)∗(00(0+1)∗11+11(0+1)∗00)(0+1)∗
(C) (0+1)∗00(0+1)∗ +(0+1)∗11(0+1)∗
(D) 00(0+1)∗11+11(0+1)∗00
Q.19 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 .
CS(Set A) 6/17
47. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.20 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
Q.21 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) VXYZ
(B) VWXZ
(C) VWXY
(D) VWXYZ
Q.22 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
CS(Set A) 7/17
48. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.23 A database of research articles in a journal uses the following schema.
(VOLUME, NUMBER, STARTPAGE, 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
Q.24 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
Q.25 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
CS(Set A) 8/17
49. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q. 26 - Q. 55 carry two marks each.
Q.26 The coefficient of x12 in (x3 +x4 +x5 +x6 +···)3 is .
Q.27 Consider the recurrence relation a1 = 8, an = 6n2 +2n+an−1. Let a99 = K ×104. The value
of K is .
Q.28 A function f : N+ → N+, defined on the set of positive integers N+, satisfies the following
properties:
f(n) = f(n/2) if nis even
f(n) = f(n+5) if nis odd
Let R = {i|∃j : f(j) = i} be the set of distinct values that f takes. The maximum possible size
of R is .
Q.29 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, HEADS) 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)
.
CS(Set A) 9/17
50. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.30 Consider the two cascaded 2-to-1 multiplexers as shown in the figure.
MUX
2−to−10
1
0
1
0
MUX
2−to−1 X
R
R
P Q
s s
The minimal sum of products form of the output X is
(A) ¯P ¯Q+PQR
(B) ¯PQ+QR
(C) PQ+ ¯P ¯QR
(D) ¯Q ¯R+PQR
Q.31 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 .
Q.32 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.
Q.33 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)
CS(Set A) 10/17
51. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.34 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
Q.35 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);
}
void 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
CS(Set A) 11/17
52. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.36 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
Q.37 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(d 2d) but not O(2d)
Q.38 Consider the weighted undirected graph with 4 vertices, where the weight of edge {i, j} is
given by the entry Wij in the matrix W.
W =
0 2 8 5
2 0 5 8
8 5 0 x
5 8 x 0
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 .
Q.39 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 .
CS(Set A) 12/17
53. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.40 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
Q.41 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.
while Q is not Empty do
if S is Empty OR Top(S) ≤ Head(Q) then
x := Dequeue(Q);
Push(S,x);
else
x := Pop(S);
Enqueue(Q,x);
end
end
The maximum possible number of iterations of the while loop in the algorithm is
.
Q.42 Consider the following context-free grammars:
G1: S → aS|B, B → b|bB
G2: S → aA|bB, A → aA|B|ε, B → bB|ε
Which one of the following pairs of languages is generated by G1 and G2, respectively?
(A) {ambn|m > 0 or n > 0} and {ambn|m > 0 and n > 0}
(B) {ambn|m > 0 and n > 0} and {ambn|m > 0 or n ≥ 0}
(C) {ambn|m ≥ 0 or n > 0} and {ambn|m > 0 and n > 0}
(D) {ambn|m ≥ 0 and n > 0} and {ambn|m > 0 or n > 0}
CS(Set A) 13/17
54. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.43 Consider the transition diagram of a PDA given below with input alphabet Σ = {a,b} and
stack alphabet Γ = {X,Z}. Z is the initial stack symbol. Let L denote the language accepted
by the PDA.
b,X/ε ε,Z/Z
b,X/εa,Z/XZ
a,X/XX
Which one of the following is TRUE?
(A) L = {anbn|n ≥ 0} and is not accepted by any finite automata
(B) L = {an|n ≥ 0}∪{anbn|n ≥ 0} and is not accepted by any deterministic PDA
(C) L is not accepted by any Turing machine that halts on every input
(D) L = {an|n ≥ 0}∪{anbn|n ≥ 0} and is deterministic context-free
Q.44 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 can 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.
Q.45 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 .
CS(Set A) 14/17
55. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.46 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
Q.47 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.
Q.48 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 .
Q.49 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 is a distinct virtual page
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 .
CS(Set A) 15/17
56. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.50 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.
Code for Pi:
do {
c[i]=1; t[i] = pmax(t[0],...,t[n-1])+1; c[i]=0;
for every j = 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
Q.51 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
CS(Set A) 16/17
57. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.52 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 by K−
x and K+
x for x = A,B, respectively. Let Kx(m)
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?
(A) {m,K+
B (H(m))} (B) {m,K−
B (H(m))} (C) {m,K−
A (H(m))} (D) {m,K+
A (m)}
Q.53 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
.
Q.54 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.
Q.55 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.
CS(Set A) 17/17
58. GATE 2016 General Aptitude - GA Set-6
1/3
Q. 1 – Q. 5 carry one mark each.
Q.1 The man who is now Municipal Commissioner worked as ____________________.
(A) the security guard at a university
(B) a security guard at the university
(C) a security guard at university
(D) the security guard at the university
Q.2 Nobody knows how the Indian cricket team is going to cope with the difficult and seamer-friendly
wickets in Australia.
Choose the option which is closest in meaning to the underlined phrase in the above sentence.
(A) put up with (B) put in with (C) put down to (D) put up against
Q.3 Find the odd one in the following group of words.
mock, deride, praise, jeer
(A) mock (B) deride (C) praise (D) jeer
Q.4 Pick the odd one from the following options.
(A) CADBE (B) JHKIL (C) XVYWZ (D) ONPMQ
Q.5 In a quadratic function, the value of the product of the roots (α, β) is 4. Find the value of
𝛼𝛼 𝑛𝑛
+ 𝛽𝛽𝑛𝑛
𝛼𝛼−𝑛𝑛 + 𝛽𝛽−𝑛𝑛
(A) n
4
(B) 4
n
(C) 2
2n-1
(D) 4
n-1
Q. 6 – Q. 10 carry two marks each.
Q.6 Among 150 faculty members in an institute, 55 are connected with each other through Facebook®
and 85 are connected through WhatsApp®
. 30 faculty members do not have Facebook®
or
WhatsApp®
accounts. The number of faculty members connected only through Facebook®
accounts
is ______________.
(A) 35 (B) 45 (C) 65 (D) 90
59. GATE 2016 General Aptitude - GA Set-6
2/3
Q.7 Computers were invented for performing only high-end useful computations. However, it is no
understatement that they have taken over our world today. The internet, for example, is ubiquitous.
Many believe that the internet itself is an unintended consequence of the original invention. With
the advent of mobile computing on our phones, a whole new dimension is now enabled. One is left
wondering if all these developments are good or, more importantly, required.
Which of the statement(s) below is/are logically valid and can be inferred from the above
paragraph?
(i) The author believes that computers are not good for us.
(ii) Mobile computers and the internet are both intended inventions
(A) (i) only (B) (ii) only (C) both (i) and (ii) (D) neither (i) nor (ii)
Q.8 All hill-stations have a lake. Ooty has two lakes.
Which of the statement(s) below is/are logically valid and can be inferred from the above
sentences?
(i) Ooty is not a hill-station.
(ii) No hill-station can have more than one lake.
(A) (i) only (B) (ii) only
(C) both (i) and (ii) (D) neither (i) nor (ii)
Q.9 In a 2 × 4 rectangle grid shown below, each cell is a rectangle. How many rectangles can be
observed in the grid?
(A) 21 (B) 27 (C) 30 (D) 36
60. GATE 2016 General Aptitude - GA Set-6
3/3
Q.10
Choose the correct expression for f(x) given in the graph.
(A) 𝑓𝑓(𝑥𝑥) = 1 − |𝑥𝑥 − 1| (B) 𝑓𝑓(𝑥𝑥) = 1 + |𝑥𝑥 − 1|
(C) 𝑓𝑓(𝑥𝑥) = 2 − |𝑥𝑥 − 1| (D) 𝑓𝑓(𝑥𝑥) = 2 + |𝑥𝑥 − 1|
END OF THE QUESTION PAPER
x
f(x)
61. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q. 1 - Q. 25 carry one mark each.
Q.1 Consider the following expressions:
(i) false
(ii) Q
(iii) true
(iv) P∨Q
(v) ¬Q∨P
The number of expressions given above that are logically implied by P ∧ (P ⇒ Q) is
.
Q.2 Let f(x) be a polynomial and g(x) = f (x) be its derivative. If the degree of (f(x)+ f(−x)) is
10, then the degree of (g(x)−g(−x)) is .
Q.3 The minimum number of colours that is sufficient to vertex-colour any planar graph is
.
Q.4 Consider the systems, each consisting of m linear equations in n variables.
I. If m < n, then all such systems have a solution
II. If m > n, then none of these systems has a solution
III. If m = n, then there exists a system which has a solution
Which one of the following is CORRECT?
(A) I, II and III are true
(B) Only II and III are true
(C) Only III is true
(D) None of them is true
CS(Set B) 1/18
62. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.5 Suppose that a shop has an equal number of LED bulbs of two different types. The probability
of an LED bulb lasting more than 100 hours given that it is of Type 1 is 0.7, and given that it
is of Type 2 is 0.4. The probability that an LED bulb chosen uniformly at random lasts more
than 100 hours is .
Q.6 Suppose that the eigenvalues of matrix A are 1,2,4. The determinant of (A−1)T is
.
Q.7 Consider an eight-bit ripple-carry adder for computing the sum of A and B, where A and B are
integers represented in 2’s complement form. If the decimal value of A is one, the decimal
value of B that leads to the longest latency for the sum to stabilize is .
Q.8 Let, x1 ⊕x2 ⊕x3 ⊕x4 = 0 where x1, x2, x3, x4 are Boolean variables, and ⊕ is the XOR operator.
Which one of the following must always be TRUE?
(A) x1x2x3x4 = 0
(B) x1x3 +x2 = 0
(C) ¯x1 ⊕ ¯x3 = ¯x2 ⊕ ¯x4
(D) x1 +x2 +x3 +x4 = 0
Q.9 Let X be the number of distinct 16-bit integers in 2’s complement representation. Let Y be the
number of distinct 16-bit integers in sign magnitude representation.
Then X −Y is .
Q.10 A processor has 40 distinct instructions and 24 general purpose registers. A 32-bit instruction
word has an opcode, two register operands and an immediate operand. The number of bits
available for the immediate operand field is .
CS(Set B) 2/18
63. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.11 Breadth First Search (BFS) is started on a binary tree beginning from the root vertex. There is
a vertex t at a distance four from the root. If t is the n-th vertex in this BFS traversal, then the
maximum possible value of n is .
Q.12 The value printed by the following program is .
void f(int* p, int m){
m = m + 5;
*p = *p + m;
return;
}
void main(){
int i=5, j=10;
f(&i, j);
printf("%d", i+j);
}
Q.13 Assume that the algorithms considered here sort the input sequences in ascending order. If the
input is already in ascending order, which of the following are TRUE?
I. Quicksort runs in Θ(n2) time
II. Bubblesort runs in Θ(n2) time
III. Mergesort runs in Θ(n) time
IV. Insertion sort runs in Θ(n) time
(A) I and II only
(B) I and III only
(C) II and IV only
(D) I and IV only
CS(Set B) 3/18
64. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.14 The Floyd-Warshall algorithm for all-pair shortest paths computation is based on
(A) Greedy paradigm.
(B) Divide-and-Conquer paradigm.
(C) Dynamic Programming paradigm.
(D) neither Greedy nor Divide-and-Conquer nor Dynamic Programming paradigm.
Q.15 N items are stored in a sorted doubly linked list. For a delete operation, a pointer is provided
to the record to be deleted. For a decrease-key operation, a pointer is provided to the record on
which the operation is to be performed.
An algorithm performs the following operations on the list in this order: Θ(N) delete, O(logN)
insert, O(logN) find, and Θ(N) decrease-key. What is the time complexity of all these
operations put together?
(A) O(log2
N) (B) O(N) (C) O(N2) (D) Θ(N2 logN)
Q.16 The number of states in the minimum sized DFA that accepts the language defined by the
regular expression
(0+1)∗
(0+1)(0+1)∗
is .
Q.17 Language L1 is defined by the grammar: S1 → aS1b|ε
Language L2 is defined by the grammar: S2 → abS2|ε
Consider the following statements:
P: L1 is regular
Q: L2 is regular
Which one of the following is TRUE?
(A) Both P and Q are true
(B) P is true and Q is false
(C) P is false and Q is true
(D) Both P and Q are false
CS(Set B) 4/18
65. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.18 Consider the following types of languages: L1 : Regular, L2 : Context-free, L3 : Recursive,
L4 : Recursively enumerable. Which of the following is/are TRUE?
I. L3 ∪L4 is recursively enumerable
II. L2 ∪L3 is recursive
III. L∗
1 ∩L2 is context-free
IV. L1 ∪L2 is context-free
(A) I only
(B) I and III only
(C) I and IV only
(D) I, II and III only
Q.19 Match the following:
(P) Lexical analysis (i) Leftmost derivation
(Q) Top down parsing (ii) Type checking
(R) Semantic analysis (iii) Regular expressions
(S) Runtime environments (iv) Activation records
(A) P ↔ i, Q ↔ ii, R ↔ iv, S ↔ iii
(B) P ↔ iii, Q ↔ i, R ↔ ii, S ↔ iv
(C) P ↔ ii, Q ↔ iii, R ↔ i, S ↔ iv
(D) P ↔ iv, Q ↔ i, R ↔ ii, S ↔ iii
Q.20 In which one of the following page replacement algorithms it is possible for the page fault rate
to increase even when the number of allocated frames increases?
(A) LRU (Least Recently Used)
(B) OPT (Optimal Page Replacement)
(C) MRU (Most Recently Used)
(D) FIFO (First In First Out)
CS(Set B) 5/18
66. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.21 B+ Trees are considered BALANCED because
(A) the lengths of the paths from the root to all leaf nodes are all equal.
(B) the lengths of the paths from the root to all leaf nodes differ from each other by at
most 1.
(C) the number of children of any two non-leaf sibling nodes differ by at most 1.
(D) the number of records in any two leaf nodes differ by at most 1.
Q.22 Suppose a database schedule S involves transactions T1, ..., Tn. Construct the precedence
graph of S with vertices representing the transactions and edges representing the conflicts. If
S is serializable, which one of the following orderings of the vertices of the precedence graph
is guaranteed to yield a serial schedule?
(A) Topological order
(B) Depth-first order
(C) Breadth-first order
(D) Ascending order of transaction indices
Q.23 Anarkali digitally signs a message and sends it to Salim. Verification of the signature by Salim
requires
(A) Anarkali’s public key.
(B) Salim’s public key.
(C) Salim’s private key.
(D) Anarkali’s private key.
Q.24 In an Ethernet local area network, which one of the following statements is TRUE?
(A) A station stops to sense the channel once it starts transmitting a frame.
(B) The purpose of the jamming signal is to pad the frames that are smaller than the
minimum frame size.
(C) A station continues to transmit the packet even after the collision is detected.
(D) The exponential backoff mechanism reduces the probability of collision on
retransmissions.
CS(Set B) 6/18
67. GATE 2016 COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
Q.25 Identify the correct sequence in which the following packets are transmitted on the network
by a host when a browser requests a webpage from a remote server, assuming that the host has
just been restarted.
(A) HTTP GET request, DNS query, TCP SYN
(B) DNS query, HTTP GET request, TCP SYN
(C) DNS query, TCP SYN, HTTP GET request
(D) TCP SYN, DNS query, HTTP GET request
Q. 26 - Q. 55 carry two marks each.
Q.26 A binary relation R on N × N is defined as follows: (a,b)R(c,d) if a ≤ c or b ≤ d. Consider
the following propositions:
P: R is reflexive
Q: R is transitive
Which one of the following statements is TRUE?
(A) Both P and Q are true.
(B) P is true and Q is false.
(C) P is false and Q is true.
(D) Both P and Q are false.
Q.27 Which one of the following well-formed formulae in predicate calculus is NOT valid?
(A) (∀x p(x) ⇒ ∀xq(x)) ⇒ (∃x¬p(x) ∨ ∀xq(x))
(B) (∃x p(x) ∨ ∃xq(x)) ⇒ ∃x(p(x) ∨ q(x))
(C) ∃x(p(x) ∧ q(x)) ⇒ (∃x p(x) ∧ ∃xq(x))
(D) ∀x(p(x) ∨ q(x)) ⇒ (∀x p(x) ∨ ∀xq(x))
CS(Set B) 7/18