Gate(Da Pyq Book)
Gate(Da Pyq Book)
Table of Contents 1
Contributors 5
1 Algorithms (467) 6
1.1 Activity Selection Problem (1) 9
1.2 Algorithm Design (8) 9
1.3 Algorithm Design Technique (10) 12
1.4 Algorithm Efficiency (1) 14
1.5 Algorithms Sorting (1) 14
1.6 Array (2) 15
1.7 Artificial Intelligence (2) 15
1.8 Asymptotic Notation (29) 15
1.9 B Tree (2) 22
1.10 Bellman Ford (3) 22
1.11 Binary Heap (1) 23
1.12 Binary Search (2) 23
1.13 Binary Search Tree (1) 24
1.14 Binary Tree (4) 24
1.15 Branch and Bound (1) 25
1.16 Decision Tree (1) 25
1.17 Depth First Search (4) 25
1.18 Dijkstras Algorithm (8) 26
1.19 Double Hashing (1) 29
1.20 Dynamic Programming (11) 29
1.21 GO Mockgate 1 (6) 32
1.22 Graph Algorithms (14) 34
1.23 Graph Search (23) 39
1.24 Greedy Algorithm (5) 45
1.25 Greedy Algorithms (1) 47
1.26 Hashing (10) 47
1.27 Huffman Code (8) 50
1.28 Identify Function (40) 52
1.29 In Place Algo (1) 66
1.30 Insertion Sort (3) 66
1.31 Knapsack Problem (2) 67
1.32 Linear Search (1) 67
1.33 Longest Common Subsequence (1) 67
1.34 Matrix Chain Ordering (7) 68
1.35 Merge Sort (5) 69
1.36 Merging (2) 70
1.37 Minimum Spanning Tree (40) 71
1.38 Non Gatecse (1) 82
1.39 Open Addressing (1) 82
1.40 Optimal Search Tree (1) 83
1.41 Optimal Solution (1) 84
1.42 Out of Gatecse Syllabus (1) 84
1.43 P NP NPC NPH (10) 84
1.44 Prims Algorithm (3) 86
1.45 Pseudocode (1) 88
1.46 Quick Sort (16) 88
1.47 Recurrence Relation (41) 92
1.48 Recursion (7) 101
1.49 Red Black Tree (1) 103
1.50 Searching (7) 103
1.51 Shortest Path (7) 105
1.52 Sorting (36) 107
1.53 Space Complexity (3) 115
1.54 Strongly Connected Components (3) 116
1.55 Time Complexity (44) 116
1.56 Topological Sort (6) 128
1.57 Tree (2) 130
1.58 Tree Search Algorithm (2) 130
1.59 Tree Traversal (1) 131
Answer Keys 131
2 Artificial Intelligence (45) 135
2.1 Artificial Intelligence (18) 135
2.2 Artificial Neural Network (1) 139
2.3 Back Propagation (1) 140
2.4 Blocks World Problem (1) 140
2.5 Chaining (1) 140
2.6 Expert System (2) 140
2.7 Fuzzy Logic (1) 141
2.8 Genetic Algorithms (1) 141
2.9 Heuristic Search (1) 141
2.10 Linear Programming (1) 141
2.11 Machine Learning (2) 142
2.12 Map Coloring (1) 142
2.13 Means End (1) 142
2.14 Minimax Procedure (1) 143
2.15 Neural Network (3) 143
2.16 Planning (1) 144
2.17 Prolog (2) 144
2.18 Reinforcement Learning (1) 145
2.19 Searches (1) 145
2.20 Sigmoid Function (1) 145
2.21 Strips (1) 145
Answer Keys 146
3 Discrete Mathematics: Mathematical Logic (128) 147
3.1 Clausal Form (2) 151
3.2 Combinatory (1) 151
3.3 Countable Uncountable Set (1) 151
3.4 First Order Logic (41) 151
3.5 Functions (1) 162
3.6 Group Theory (1) 162
3.7 Logical Reasoning (3) 163
3.8 Prolog (1) 164
3.9 Propositional Logic (59) 164
3.10 Relations (1) 178
Answer Keys 178
4 Engineering Mathematics: Calculus (66) 180
4.1 Continuity (8) 180
4.2 Convergence (2) 182
4.3 Definite Integral (3) 182
4.4 Differential Equation (1) 183
4.5 Differentiation (6) 183
4.6 GO Mockgate 1 (1) 184
4.7 Integration (12) 184
4.8 Limits (13) 187
4.9 Maxima Minima (13) 189
4.10 Out of Gatecse Syllabus (4) 192
4.11 Polynomials (2) 193
Answer Keys 193
5 Engineering Mathematics: Discrete Mathematics (37) 194
5.1 Boolean Function (1) 196
5.2 Combinatory (2) 196
5.3 Equivalence Class (1) 196
5.4 First Order Logic (2) 197
5.5 Functions (2) 197
5.6 GO Mockgate 1 (1) 198
5.7 Group Theory (1) 198
5.8 Linear Programming (1) 198
5.9 Number Representation (1) 198
5.10 Partial Order (2) 199
5.11 Propositional Logic (8) 199
5.12 Quantifiers (1) 201
5.13 Relations (1) 202
5.14 Set Theory (2) 202
Answer Keys 202
6 Engineering Mathematics: Linear Algebra (107) 204
6.1 Cartesian Coordinates (1) 204
6.2 Determinant (11) 205
6.3 Eigen Value (32) 208
6.4 Eigen Vector (1) 215
6.5 GO Mockgate 1 (1) 215
6.6 Inequality (1) 216
6.7 Matrix (27) 216
6.8 Numerical Methods (2) 221
6.9 Out of Gatecse Syllabus (1) 222
6.10 Rank of Matrix (7) 222
6.11 Subspace (1) 224
6.12 System of Equations (15) 224
6.13 Vector Space (5) 228
Answer Keys 229
7 Non GATE CSE: Optimization (18) 231
7.1 Assignment Problem (2) 231
7.2 Dual Linear Programming (1) 231
7.3 Linear Programming (1) 231
7.4 Linear Programming Problem (1) 231
7.5 Optimization (8) 232
7.6 Transportation Problem (5) 233
Answer Keys 235
8 Programming and DS (27) 237
8.1 Array (2) 237
8.2 Array of Pointers (1) 237
8.3 Dangling Pointers (1) 237
8.4 Data Types (1) 238
8.5 GO Mockgate 1 (1) 238
8.6 Input Output Statement (1) 238
8.7 Operator Precedence (2) 239
8.8 Operators (2) 239
8.9 Parameter Passing (1) 239
8.10 Pointer Declaration (1) 240
8.11 Programming In C (12) 240
8.12 Storage Classes In C (1) 243
8.13 Three Dimensional Array (1) 243
Answer Keys 243
9 Programming and DS: DS (354) 245
9.1 AVL Tree (7) 247
9.2 Array (13) 249
9.3 B Tree (1) 254
9.4 B and Bplus Trees (1) 254
9.5 Binary Heap (37) 254
9.6 Binary Search Tree (45) 262
9.7 Binary Tree (61) 272
9.8 Cryptography (1) 286
9.9 Data Structures (13) 286
9.10 GO Mockgate 1 (3) 290
9.11 Graph Algorithms (1) 291
9.12 Graph Connectivity (1) 291
9.13 Hashing (29) 291
9.14 Heaps (4) 298
9.15 Infix Prefix (7) 299
9.16 Linear Probing (1) 300
9.17 Linked List (25) 300
9.18 Max Heap (1) 307
9.19 Minimum Spanning Tree (2) 307
9.20 Priority (1) 308
9.21 Priority Queue (4) 308
9.22 Pseudocode (1) 309
9.23 Queue (18) 310
9.24 Quick Sort (1) 315
9.25 Radix Sort (2) 315
9.26 Recursion (1) 316
9.27 Relational Algebra (1) 316
9.28 Stack (29) 316
9.29 Tree (28) 323
9.30 Tree Traversal (1) 329
Answer Keys 330
10 Programming: Programming in Python (2) 333
Answer Keys 333
Contributors
User , Answers User Added User Done
Arjun Suresh 8532, 138 GO Editor 333 Lakshman Patel 443
Akash Kanase 1519, 32 Kathleen Bankson 294 kenzou 283
Gate Keeda 1376, 35 Arjun Suresh 176 Arjun Suresh 237
Rajesh Pradhan 1037, 21 Misbah Ghaya 129 soujanyareddy13 157
gatecse 1022, 66 gatecse 100 Milicevic3306 123
Amar Vashishth 1007, 16 Ishrat Jahan 82 Pooja Khatri 98
Sachin Mittal 998, 14 Pooja Khatri 23 gatecse 84
Digvijay 941, 18 Rucha Shelke 22 Hira 70
Bhagirathi Nayak 843, 17 admin 20 Naveen Kumar 57
Vikrant Singh 827, 11 Akash Kanase 19 V S Silpa 53
Prashant Singh 822, 41 Sandeep Singh 15 Shikha Mallick 49
Rajarshi Sarkar 746, 26 Ruturaj Mohanty 13 Misbah Ghaya 45
Rishabh Gupta 589, 3 RISHABH KUMAR 13 sanjay 34
Ahwan Mishra 557, 8 khush tak 9 Pavan Singh 22
Anu 556, 7 Madhav kumar 6 Shaik Masthan 21
suraj 537, 9 sanjay 5 Krithiga2101 21
Pragy Agarwal 497, 6 shivani Sharma 5 Don't defeat anybody but 21
Sankaranarayanan P.N 470, 14 yourself.
Happy Mittal 444, 11 GO Editor 19
Anurag Semwal 414, 7 shadymademe 16
Ayush Upadhyaya 412, 10 Akash Dinkar 15
Abhilash Panicker 392, 5 Prashant Singh 13
Sona Praneeth Akula 385, 8 VIPIN NARAYAN 12
Pooja Palod 364, 9 Sankaranarayanan P.N 12
Deepak Poonia 364, 13 Ajay kumar soni 11
Manali 339, 7 Deepak Poonia 11
Leen Sharma 313, 25 Leen Sharma 11
ryan sequeira 305, 3 Ankit Singh 11
Harsh181996 302, 2 Abhrajyoti Kundu 10
Ankit Rokde 298, 5 srestha 9
Akhil Nadh PC 297, 6 ankitgupta.1729 8
Srinath Jayachandran 291, 5 Pragy Agarwal 7
Kalpish Singhal 286, 3 Ruturaj Mohanty 6
Praveen Saini 281, 6 Subarna Das 6
Manu Thakur 281, 7 Sweta Kumari Rawani 6
Keith Kr 265, 7 Puja Mishra 6
Shyam Singh 256, 4 Manoj Kumar 6
Shaik Masthan 253, 14 Shiva Sagar Rao 6
Shubham Srivastava 247, 5 RISHABH KUMAR 6
srestha 239, 9 Debasmita Bhoumik 5
dd 231, 6 NarutoUzumaki 5
Soumya Jain 230, 4 Sachin Mittal 5
Anoop Sonkar 228, 4 shekhar chauhan 5
Manish Joshi 224, 3 shivani Sharma 5
ankitgupta.1729 219, 12
Sourav Basu 217, 1
Ashish Deshmukh 214, 1
Anurag Pandey 209, 2
Madhur Rawat 187, 3
SAKET NANDAN 180, 4
Nikhil Dhama 177, 5
anshu 175, 5
Kalpna Bhargav 171, 3
1 Algorithms (467)
The post order traversal of a binary tree is DEBFCA. Find out the pre-order traversal
Answer key ☟
where is the set of nodes and is the set of edges in the graph.
A.
B.
C.
D.
ugcnetcse-aug2016-paper3 algorithms
Answer key ☟
Consider a Boolean function of 'n' variables. The order of an algorithm that determines whether the
Boolean function produces a output 1 is
Answer key ☟
A. B.
C. D.
ugcnetcse-july2018-paper2 algorithms
Answer key ☟
A. B.
C. D.
ugcnetcse-jan2017-paper3 algorithms easy match-the-following
Answer key ☟
A. B. C. D.
algorithms heap-sort ugcnetcse-dec2004-paper2
Answer key ☟
algorithms ugcnetcse-oct2020-paper2
Answer key ☟
Dosomething(a,b);
A. B.
C. D.
go2025-mockgate-1 algorithms
Answer key ☟
if(k% 2!= 0)
{
if(b)
{
i=i+j;
b=0;
}
else
{
i=i-j;
b=1;
}
}
}
return i;
}
If the value of is very large tending to infinity then the returned value approximates.
A. B. C. D.
go2025-mockgate-1 algorithms
Answer key ☟
Which one of the following is the approximate value returned by the above function?
A. B.
C. D.
go2025-mockgate-1 algorithms
Answer key ☟
1.1.1 Activity Selection Problem: UGC NET CSE | December 2015 | Part 3 | Question: 16
In Activity-Selection problem, each activity has a start time and a finish time where .
Activities and are compatible if
A. B.
C. or D. and
ugcnetcse-dec2015-paper3 algorithms activity-selection-problem
Answer key ☟
Let be a Depth First Tree of a undirected graph . An array indexed by the vertices of is given.
is the parent of vertex , in . Parent of the root is the root itself.
Give a method for finding and printing the cycle formed if the edge of not in (i.e., ) is
now added to .
Time taken by your method must be proportional to the length of the cycle.
Describe the algorithm in a PASCAL – like language. Assume that the variables have been suitably
declared.
gate1992 algorithms descriptive algorithm-design
Answer key ☟
1.2.2 Algorithm Design: GATE CSE 1994 | Question: 7
Answer key ☟
An element in an array is called a leader if it is greater than all elements to the right of it in . The
best algorithm to find all leaders in an array
Answer key ☟
Given two arrays of numbers and where each number is or , the fastest
algorithm to find the largest span such that or report
that there is not such span,
Answer key ☟
There are bags labeled to . All the coins in a given bag have the same weight. Some bags have
coins of weight gm, others have coins of weight gm. I pick coins respectively from
bags to Their total weight comes out to gm. Then the product of the labels of the bags having gm
coins is ___.
gatecse-2014-set1 algorithms numerical-answers normal algorithm-design
Answer key ☟
Answer: ___________
gatecse-2019 numerical-answers algorithms algorithm-design 1-mark
Answer key ☟
Define to be the maximum amount earned by cutting a rod of length meters into one or more
pieces of integer length and selling them. For , let denote the selling price of a rod whose
length is meters. Consider the array of prices:
A.
B.
C. is achieved by three different solutions
D. cannot be achieved by a solution consisting of three pieces
Answer key ☟
The code snippet given below has been written to compute the length of the longest subarray of that
contains at most two distinct integers. The code has two missing expressions labelled and .
Which one of the following options gives the CORRECT missing expressions?
(Hint: At the end of the -th iteration, the value of is the length of the longest subarray ending with
that contains all equal values, and is the length of the longest subarray ending with that contains at
most two distinct values.)
A.
B.
C.
D.
Answer key ☟
Consider the following problem. Given positive integers it is required to partition them
Consider a greedy algorithm for solving this problem. The numbers are ordered so that and at
step, is placed in that part whose sum in smaller at that step. Give an example with for which the
solution produced by the greedy algorithm is not optimal.
gate1990 descriptive algorithms algorithm-design-technique
Answer key ☟
Answer key ☟
1.3.3 Algorithm Design Technique: GATE CSE 1994 | Question: 1.19, ISRO2016-31
Answer key ☟
Answer key ☟
A. B. C. D.
Answer key ☟
1.3.6 Algorithm Design Technique: GATE CSE 1998 | Question: 1.21, ISRO2008-16
Which one of the following algorithm design techniques is used in finding all pairs of shortest distances
in a graph?
Answer key ☟
A. B.
C. D.
gatecse-2015-set1 algorithms normal match-the-following algorithm-design-technique
Answer key ☟
Given below are some algorithms, and some algorithm design paradigms.
Match the above algorithms on the left to the corresponding design paradigm they follow.
A. B.
C. D.
gatecse-2015-set2 algorithms easy algorithm-design-technique match-the-following
Answer key ☟
Match the algorithms to the design paradigms they are based on.
A.
B.
C.
D.
Answer key ☟
1.3.10 Algorithm Design Technique: UGC NET CSE | December 2006 | Part 2 | Question: 22
Answer key ☟
1.4.1 Algorithm Efficiency: UGC NET CSE | Junet 2015 | Part 2 | Question: 25
Answer key ☟
1.5.1 Algorithms Sorting: UGC NET CSE | Junet 2015 | Part 2 | Question: 48
Which of the following algorithms sort integers, having the range to , in ascending order in
time?
Which of the following is true for computation time in insertion, deletion and finding maximum and
minimum element in a sorted array ?
Answer key ☟
A. B. C. D.
ugcnetcse-july2016-paper3 algorithms array
Answer key ☟
1.7.1 Artificial Intelligence: UGC NET CSE | June 2014 | Part 3 | Question: 31
Consider Where function is a measure of the cost of getting from the start node
to the current node. and is an estimate of the additional cost of getting from the current node to
the goal node. Then is used in which one of the following algorithms?
A. algorithm B. algorithm
C. Greedy best first search algorithm D. Iterative algorithm
ugcnetjune2014iii artificial-intelligence algorithms
Answer key ☟
1.7.2 Artificial Intelligence: UGC NET CSE | June 2014 | Part 3 | Question: 33
________ is used in game trees to reduce the number of branches of the search tree to be traversed
without affecting the solution.
Answer key ☟
A. B.
C. D.
gate1994 algorithms asymptotic-notation normal multiple-selects
Answer key ☟
A. B.
C. If D.
gate1996 algorithms asymptotic-notation normal
Answer key ☟
A. B.
C. D.
gate1999 algorithms recurrence-relation asymptotic-notation normal match-the-following
Answer key ☟
A. is B. is
C. is not D. is
gatecse-2000 algorithms asymptotic-notation normal
Answer key ☟
Answer key ☟
Answer key ☟
Suppose ,
Which one of the following is FALSE?
A. B.
C. D.
gatecse-2005 algorithms asymptotic-notation recurrence-relation normal
Answer key ☟
Which of the following statements about the asymptotic behavior of , and is true?
A.
B.
C.
D.
Answer key ☟
Which of the given options provides the increasing order of asymptotic complexity of functions
and ?
A. B.
C. D.
gatecse-2011 algorithms asymptotic-notation normal
Answer key ☟
Let and denote respectively, the worst case and average case running time of an algorithm
executed on an input of size . Which of the following is ALWAYS TRUE?
A. B.
C. D.
gatecse-2012 algorithms easy asymptotic-notation
Answer key ☟
I.
II.
III.
IV.
A. Only I B. Only II
C. I or III or IV but not II D. II or III or IV but not I
gatecse-2015-set3 algorithms asymptotic-notation normal
Answer key ☟
I.
II.
Answer key ☟
, , , , .
The CORRECT arrangement of the above functions in increasing order of asymptotic complexity is:
A. , , , , B. , , , ,
C. , , , , D. , , , ,
gatecse-2017-set1 algorithms asymptotic-notation normal
Answer key ☟
Which one of the following options arranges the functions in the increasing order of asymptotic growth rate?
A. B.
C. D.
gatecse-2021-set1 algorithms asymptotic-notation 1-mark
Answer key ☟
A. when is a polynomial
B.
C. when is an exponential function
D.
Answer key ☟
Let and be functions of natural numbers given by and Which of the following
statements is/are
A. B.
C. D.
gatecse-2023 algorithms asymptotic-notation multiple-selects 1-mark
Answer key ☟
Let and denote the number of times the statement is executed in and
respectively.
Which of the following statements is/are
A. B.
C. D.
gatecse-2023 algorithms asymptotic-notation multiple-selects 2-marks
Answer key ☟
1.8.18 Asymptotic Notation: GATE CSE 2024 | Set 2 | Question: 5
A. B.
C. D.
gatecse2024-set2 algorithms recurrence-relation asymptotic-notation
Answer key ☟
A. B.
C. D.
gateit-2004 algorithms asymptotic-notation normal
Answer key ☟
a.
b.
c.
d.
e.
A. a, d, c, e, b B. d, a, c, e, b C. a, c, d, e, b D. a, c, d, b, e
gateit-2008 algorithms asymptotic-notation normal
Answer key ☟
1.8.21 Asymptotic Notation: GATE Overflow Test Series | Mock GATE | Test 1 | Question: 47
The asymptotic growth rate order of the below four functions is given by
A. B.
C. D.
go2025-mockgate-1 algorithms asymptotic-notation
Answer key ☟
1.8.22 Asymptotic Notation: UGC NET CSE | December 2013 | Part 2 | Question: 35
A. B. C. D.
ugcnetcse-dec2013-paper2 algorithms easy asymptotic-notation
Answer key ☟
1.8.23 Asymptotic Notation: UGC NET CSE | December 2013 | Part 3 | Question: 35
Let and be two matrices. The efficient algorithm to multiply the two matrices has the time
complexity
A. B. C. D.
ugcnetcse-dec2013-paper3 algorithms asymptotic-notation
Answer key ☟
1.8.24 Asymptotic Notation: UGC NET CSE | December 2013 | Part 3 | Question: 36
A. O(n ) B. O(n )
C. O(n D. O(n lg n)
ugcnetcse-dec2013-paper3 algorithms asymptotic-notation recurrence-relation
Answer key ☟
1.8.25 Asymptotic Notation: UGC NET CSE | January 2017 | Part 3 | Question: 31
A. B.
C. D.
ugcnetcse-jan2017-paper3 algorithms asymptotic-notation recurrence-relation
Answer key ☟
1.8.26 Asymptotic Notation: UGC NET CSE | June 2014 | Part 2 | Question: 24
Big- estimates for the factorial function and the logarithm of the factorial function i.e. and is
given by
A. and B. and
C. and D. and
ugcnetcse-june2014-paper2 algorithms time-complexity asymptotic-notation
Answer key ☟
1.8.27 Asymptotic Notation: UGC NET CSE | June 2014 | Part 2 | Question: 39
A. B.
C. D.
ugcnetcse-june2014-paper2 algorithms time-complexity asymptotic-notation
Answer key ☟
1.8.28 Asymptotic Notation: UGC NET CSE | June 2014 | Part 3 | Question: 61
asymptotic-notation ugcnetjune2014iii
Answer key ☟
1.8.29 Asymptotic Notation: UGC NET CSE | Junet 2015 | Part 3 | Question: 35
A. B.
C. D.
asymptotic-notation algorithms ugcnetcse-june2015-paper3
Answer key ☟
What is the maximum number of nodes in a B-tree of order of depth (root at depth ) ?
Answer key ☟
For any B-tree of minimum degree t 2, every node other than the root must have at least ____ keys
and every node can have at most ____ keys.
Answer key ☟
Which of the following statement(s) is/are correct regarding Bellman-Ford shortest path algorithm?
P: Always finds a negative weighted cycle, if one exists.
Q: Finds whether any negative weighted cycle is reachable from the source.
Answer key ☟
1.10.2 Bellman Ford: GATE CSE 2013 | Question: 19
What is the time complexity of Bellman-Ford single-source shortest path algorithm on a complete graph
of n vertices?
A. B.
C. D.
gatecse-2013 algorithms graph-algorithms normal bellman-ford
Answer key ☟
1.10.3 Bellman Ford: UGC NET CSE | October 2020 | Part 2 | Question: 70
Match with
A. B.
C. D.
Answer key ☟
1.11.1 Binary Heap: UGC NET CSE | December 2012 | Part 3 | Question: 51
Suppose there are sorted lists of element each. The time complexity of producing a sorted
list of all these elements is (use heap data structure)
A. B.
C. D.
ugcnetcse-dec2012-paper3 algorithms time-complexity binary-heap
Answer key ☟
What is the worst-case number of arithmetic operations performed by recursive binary search on a
sorted array of size ?
A. B.
C. D.
gatecse-2021-set2 algorithms binary-search time-complexity 1-mark
Answer key ☟
1.12.2 Binary Search: GATE DS&AI 2024 | Question: 30
Let denote the maximum number of comparisons made while searching for an entry in a sorted
array of size using binary search.
A. B.
C. D.
gate-ds-ai-2024 algorithms binary-search
Answer key ☟
1.13.1 Binary Search Tree: UGC NET CSE | January 2017 | Part 2 | Question: 25
A. Optimal binary search tree construction can be performed efficiently using dynamic programming.
B. Breadth-first search cannot be used to find connected components of a graph.
C. Given the prefix and postfix walks of a binary tree, the tree cannot be reconstructed uniquely.
D. Depth-first-search can be used to find the connected components of a graph.
Answer key ☟
1.14.1 Binary Tree: UGC NET CSE | December 2010 | Part 2 | Question: 22
Answer key ☟
1.14.2 Binary Tree: UGC NET CSE | December 2011 | Part 2 | Question: 19
The post order traversal of a binary tree is DEBFCA. Find out the preorder traversal.
Answer key ☟
1.14.3 Binary Tree: UGC NET CSE | December 2011 | Part 2 | Question: 50
The number of nodes in a complete binary tree of height (with roots at level ) is equal to
A. B.
C. D.
ugcnetcse-dec2011-paper2 algorithms binary-tree
Answer key ☟
1.14.4 Binary Tree: UGC NET CSE | December 2014 | Part 2 | Question: 25
A. nodes B. nodes
C. nodes D. nodes
ugcnetcse-dec2014-paper2 algorithms binary-tree
Answer key ☟
Subject to
and or for .
It is required to find all the optimal solutions to this instance using the branch and bound technique.
i. State what method you would use to compute bounds on the partial solutions.
ii. Using a suitable branching technique, generate the entire search tree for this instance of the problem and find
all the optimal solutions. Number the nodes in the tree in the order in which they are expanded and for each
node show the bound on the partial solutions and the decision which leads to that node.
1.16.1 Decision Tree: UGC NET CSE | December 2014 | Part 3 | Question: 31
A. B. C. D.
ugcnetcse-dec2014-paper3 algorithms decision-tree
Answer key ☟
1.17.1 Depth First Search: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 45
Which of the following statements is/are TRUE?(Mark all the correct options)
A. The tightest upper bound on the worst case time complexity in determining the existence of a cycle in an
undirected graph is .
B. If in a depth-first traversal of a graph with vertices, edges are marked as tree edges, then the number
of connected components in is .
C. The tightest upper bound on the worst case time complexity in determining the existence of a cycle in an
undirected graph is .
D. In a connected graph with vertices DFS will yield tree edges.
Answer key ☟
1.17.2 Depth First Search: UGC NET CSE | December 2015 | Part 2 | Question: 36
In the following graph, discovery time stamps and finishing time stamps of Depth First Search (DFS)
are shown as , where is discovery time stamp and is finishing time stamp.
Answer key ☟
1.17.3 Depth First Search: UGC NET CSE | June 2013 | Part 3 | Question: 68
Answer key ☟
1.17.4 Depth First Search: UGC NET CSE | June 2019 | Part 2 | Question: 65
ugcnetcse-june2019-paper2 depth-first-search
Answer key ☟
a. Output the sequence of vertices identified by the Dijkstra’s algorithm for single source shortest path when
the algorithm is started at node
b. Write down sequence of vertices in the shortest path from to
c. What is the cost of the shortest path from to ?
Answer key ☟
Suppose we run Dijkstra’s single source shortest path algorithm on the following edge-weighted directed
graph with vertex as the source.
In what order do the nodes get included into the set of vertices for which the shortest path distances are
finalized?
A. B. C. D.
gatecse-2004 algorithms graph-algorithms normal dijkstras-algorithm
Answer key ☟
Let be an undirected graph with positive edge weights. Dijkstra’s single source shortest path
algorithm can be implemented using the binary heap data structure with time complexity:
A. B.
C. D.
gatecse-2005 algorithms graph-algorithms normal dijkstras-algorithm
Answer key ☟
To implement Dijkstra’s shortest path algorithm on unweighted graphs so that it runs in linear time, the
data structure to be used is:
A. Queue B. Stack C. Heap D. B-Tree
gatecse-2006 algorithms graph-algorithms easy dijkstras-algorithm
Answer key ☟
Dijkstra's single source shortest path algorithm when run from vertex in the above graph, computes the correct
shortest path distance to
Answer key ☟
Consider the directed graph shown in the figure below. There are multiple shortest paths between
vertices and . Which one will be reported by Dijkstra’s shortest path algorithm? Assume that, in any
iteration, the shortest path to a vertex is updated only when a strictly shorter path to is discovered.
A. B. C. D.
gatecse-2012 algorithms graph-algorithms normal dijkstras-algorithm
Answer key ☟
1.18.7 Dijkstras Algorithm: GATE Overflow Test Series | Mock GATE | Test 4 | Question: 45
What is time complexity of Dijkstra's algorithm if we use sorted linked list instead of min-heap or
priority queue. Assume graph is represented by an adjacency list and and
A. B.
C. D.
go2025-mockgate-4 algorithms graph-algorithms dijkstras-algorithm time-complexity
Answer key ☟
1.18.8 Dijkstras Algorithm: UGC NET CSE | January 2017 | Part 3 | Question: 35
Answer key ☟
1.19.1 Double Hashing: UGC NET CSE | June 2019 | Part 2 | Question: 66
A. B. C. D.
ugcnetcse-june2019-paper2 double-hashing
Answer key ☟
A.
B.
C.
D.
Answer key ☟
A. B. C. D.
gatecse-2008 algorithms normal dynamic-programming
Answer key ☟
A sub-sequence of a given sequence is just the given sequence with some elements (possibly none or all)
left out. We are given two sequences and of lengths and , respectively with indexes of
and starting from .
We wish to find the length of the longest common sub-sequence (LCS) of and as , where an
incomplete recursive definition for the function to compute the length of the LCS of and is
given below:
l(i,j) = 0, if either i = 0 or j = 0
= expr1, if i,j > 0 and X[i-1] = Y[j-1]
= expr2, if i,j > 0 and X[i-1] ≠ Y[j-1]
A. B.
C. D.
gatecse-2009 algorithms normal dynamic-programming recursion
Answer key ☟
A sub-sequence of a given sequence is just the given sequence with some elements (possibly none or all)
left out. We are given two sequences and of lengths and , respectively with indexes of
and starting from .
We wish to find the length of the longest common sub-sequence (LCS) of and as , where an
incomplete recursive definition for the function to compute the length of the LCS of and is
given below:
, if either or
if and
if and
The value of could be obtained by dynamic programming based on the correct recursive definition of
of the form given above, using an array , where and , such that
.
Which one of the following statements would be TRUE regarding the dynamic programming solution for the
recursive definition of ?
Answer key ☟
A. B.
C. D.
gatecse-2010 algorithms dynamic-programming normal
Answer key ☟
1.20.6 Dynamic Programming: GATE CSE 2011 | Question: 25
An algorithm to find the length of the longest monotonically increasing sequence of numbers in an array
is given below.
Let , denote the length of the longest monotonically increasing sequence starting at index in the array.
Initialize .
For all such that
Answer key ☟
Consider two strings ="qpqrr" and ="pqprqrp". Let be the length of the longest common
subsequence (not necessarily contiguous) between and and let be the number of such longest
common subsequences between and . Then ___.
Answer key ☟
Suppose you want to move from to on the number line. In each step, you either move right by a
unit distance or you take a shortcut. A shortcut is simply a pre-specified pair of integers .
Given a shortcut , if you are at position on the number line, you may directly move to . Suppose
denotes the smallest number of steps needed to move from to . Suppose further that there is at most
shortcut involving any number, and in particular, from there is a shortcut to . Let and be such that
. Then the value of the product is _____.
Answer key ☟
A. Greedy paradigm.
B. Divide-and-conquer paradigm.
C. Dynamic Programming paradigm.
D. Neither Greedy nor Divide-and-Conquer nor Dynamic Programming paradigm.
Answer key ☟
1.20.10 Dynamic Programming: UGC NET CSE | December 2013 | Part 3 | Question: 37
A. B. C. D.
ugcnetcse-dec2013-paper3 algorithms dynamic-programming
Answer key ☟
1.20.11 Dynamic Programming: UGC NET CSE | July 2016 | Part 3 | Question: 36
A triangulation of a polygon is a set of chords that divide the polygon into disjoint triangles. Every
triangulation of vertex convex polygon has ____ chords and divides the polygon into ____ triangles
A. B. C. D.
ugcnetcse-july2016-paper3 algorithms dynamic-programming
Answer key ☟
Answer key ☟
Answer key ☟
int left=2*i+1;
int right=2*i+2;
int mid=i;
if (mid!=i) {
swap(A[i], A[mid]);
Heapify(A, mid, n);
}
This binary tree is stored in an array starting from index as the root node of the
binary tree. The left and right child are stored at location and respectively, where is the position
of the parent.
If the above given Build_heap() procedure is applied on this binary tree, then the correct order of elements
stored in the array is::
A. B.
C. D.
go-mockgate-1 algorithms data-structures binary-heap
Answer key ☟
Which of the following statements is/are correct with respect to Djikstra Algorithm?
(P) It always works perfectly for graphs with negative weight edges.
(Q) It does not work perfectly for graphs with negative weight cycles.
(R) It may or may not work for graphs with negative weight edges.
(S) It may not terminate if the graph has negative weight cycle
(T) It always terminates for graphs with negative weight edges.
(U) Time complexity of Djikstra algorithm becomes if AVL tree is used instead of priority queues.
Answer key ☟
What is the time complexity in terms of Big notation for the function call to procedure A?
A. B.
C. D.
go-mockgate-1 time-complexity asymptotic-notation recurrence-relation algorithms
Answer key ☟
Which of the following sorting algorithms performs efficiently to sort a singly linked list containing
nodes and the corresponding time complexity is?
A. B.
C. D.
go-mockgate-1 data-structures linked-list sorting algorithms
Answer key ☟
Note: Initially is the list of all edges incident to and LIST is the set of all vertices in the graph. They
are globally accessible.
a. What kind of subgraphs are obtained when this algorithm traverses the graphs and shown in Fig
and Fig respectively?
b. What is the commonly Known traversal of graphs that can be obtained from the subgraphs generated by
Program Explore?
c. Show that the time complexity of the procedure is for a graph with vertices and edges, given
that each vertex can be accessed and removed from LIST in constant time. Also, show that all edges of the
graph are traversed.
A. Optimal binary search tree construction can be performed efficiently using dynamic programming
B. Breadth-first search cannot be used to find connected components of a graph
C. Given the prefix and postfix walks over a binary tree, the binary tree cannot be uniquely constructed.
D. Depth-first search can be used to find connected components of a graph
gate1994 algorithms normal graph-algorithms
Answer key ☟
Which of the following statements is necessarily true for all and after termination of the above algorithm?
A.
B. If then has a Hamiltonian cycle
C. If there exists a path from to , contains the longest path length from to
D. If there exists a path from to , every simple path from to contains at most edges
Answer key ☟
Let and be two vertices in a undirected graph having distinct positive edge weights. Let
be a partition of such that and . Consider the edge having the minimum weight
amongst all those edges that have one vertex in and one vertex in .
The edge must definitely belong to:
A. the minimum weighted spanning tree of B. the weighted shortest path from to
C. each path from to D. the weighted longest path from to
gatecse-2005 algorithms graph-algorithms normal
Answer key ☟
Let and be two vertices in a undirected graph having distinct positive edge weights. Let
be a partition of such that and . Consider the edge having the minimum weight
amongst all those edges that have one vertex in and one vertex in .
Let the weight of an edge denote the congestion on that edge. The congestion on a path is defined to be the
maximum of the congestions on the edges of the path. We wish to find the path from to having minimum
congestion. Which of the following paths is always such a path of minimum congestion?
Answer key ☟
1.22.6 Graph Algorithms: GATE CSE 2016 Set 2 | Question: 41
In an adjacency list representation of an undirected simple graph , each edge has two
adjacency list entries: in the adjacency list of , and in the adjacency list of . These are called
twins of each other. A twin pointer is a pointer from an adjacency list entry to its twin. If and ,
and the memory size is not a constraint, what is the time complexity of the most efficient algorithm to set the
twin pointer in each entry in each adjacency list?
A. B.
C. D.
gatecse-2016-set2 algorithms graph-algorithms normal
Answer key ☟
Let be connected, undirected, edge-weighted graph. The weights of the edges in are
positive and distinct. Consider the following statements:
Answer key ☟
Answer key ☟
In a directed acyclic graph with a source vertex , the of a directed path is defined to be
the product of the weights of the edges on the path. Further, for a vertex other than , the quality-score
of is defined to be the maximum among the quality-scores of all the paths from to . The quality-score of is
assumed to be .
The sum of the quality-scores of all vertices on the graph shown above is _______
Answer key ☟
In the following table, the left column contains the names of standard graph algorithms and the right
column contains the time complexities of the algorithms. Match each algorithm with its time
complexity.
A. B.
C. D.
gateit-2005 algorithms graph-algorithms match-the-following easy
Answer key ☟
A sink in a directed graph is a vertex i such that there is an edge from every vertex to and there is
no edge from to any other vertex. A directed graph with vertices is represented by its adjacency
matrix , where if there is an edge directed from vertex to and otherwise. The following
algorithm determines whether there is a sink in the graph .
i = 0;
do {
j = i + 1;
while ((j < n) && E1) j++;
if (j < n) E2;
} while (j < n);
flag = 1;
for (j = 0; j < n; j++)
if ((j! = i) && E3) flag = 0;
if (flag) printf("Sink exists");
else printf ("Sink does not exist");
A. and ; B. and ;
C. and ; D. and ;
gateit-2005 algorithms graph-algorithms normal
Answer key ☟
1.22.12 Graph Algorithms: GATE IT 2005 | Question: 84b
A sink in a directed graph is a vertex i such that there is an edge from every vertex to and there is
no edge from to any other vertex. A directed graph with vertices is represented by its adjacency
matrix , where if there is an edge directed from vertex to and otherwise. The following
algorithm determines whether there is a sink in the graph .
i = 0;
do {
j = i + 1;
while ((j < n) && E1) j++;
if (j < n) E2;
} while (j < n);
flag = 1;
for (j = 0; j < n; j++)
if ((j! = i) && E3) flag = 0;
if (flag) printf("Sink exists") ;
else printf ("Sink does not exist");
A. B.
C. D.
gateit-2005 algorithms graph-algorithms normal
Answer key ☟
1.22.13 Graph Algorithms: UGC NET CSE | December 2015 | Part 3 | Question: 20
Floyd-Warshall algorithm utilizes _____ to solve the all-pairs shortest paths problem on a directed graph
in ____ time
Answer key ☟
1.22.14 Graph Algorithms: UGC NET CSE | June 2019 | Part 2 | Question: 61
ugcnetcse-june2019-paper2 graph-algorithms
Answer key ☟
In the graph shown above, the depth-first spanning tree edges are marked with a . Identify the forward,
backward, and cross edges.
Answer key ☟
is:
A. B.
C. D.
gatecse-2000 algorithms easy graph-algorithms graph-search match-the-following
Answer key ☟
Let be an undirected graph. Consider a depth-first traversal of , and let be the resulting depth-first
search tree. Let be a vertex in and let be the first new (unvisited) vertex visited after visiting in
the traversal. Which of the following statement is always true?
Answer key ☟
Consider an undirected, unweighted graph . Let a breadth-first traversal of be done starting from a
node . Let and be the lengths of the shortest paths from to and respectively in . If
is visited before during the breadth-first traversal, which of the following statements is correct?
A. B.
C. D. None of the above
gatecse-2001 algorithms graph-algorithms normal graph-search
Answer key ☟
I. abeghf
II. abfehg
III. abfhge
IV. afghbe
A. I, II and IV only B. I and IV only C. II, III and IV only D. I, III and IV only
gatecse-2003 algorithms graph-algorithms normal graph-search
Answer key ☟
Let be a depth first search tree in an undirected graph . Vertices and are leaves of this tree .
The degrees of both and in are at least . which one of the following statements is true?
Answer key ☟
The Breadth First Search algorithm has been implemented using the queue data structure. One possible
order of visiting the nodes of the following graph is:
A. B. C. D.
gatecse-2008 normal algorithms graph-algorithms graph-search
Answer key ☟
Let be a graph with vertices and edges. What is the tightest upper bound on the running time of
Depth First Search on , when is represented as an adjacency matrix?
A. B. C. D.
gatecse-2014-set1 algorithms graph-algorithms normal graph-search
Answer key ☟
Consider the tree arcs of a BFS traversal from a source node in an unweighted, connected, undirected
graph. The tree formed by the tree arcs is a data structure for computing
Answer key ☟
Suppose depth first search is executed on the graph below starting at some unknown vertex. Assume that
a recursive call to visit a vertex is made only after first checking that the vertex has not been visited
earlier. Then the maximum possible recursion depth (including the initial call) is _________.
Answer key ☟
Let be a simple undirected graph, and be a particular vertex in it called the source. For
, let denote the shortest distance in from to . A breadth first search (BFS) is performed
starting at . Let be the resultant BFS tree. If is an edge of that is not in , then which one of the
following CANNOT be the value of ?
A. B. C. D.
gatecse-2015-set1 algorithms graph-algorithms normal graph-search
Answer key ☟
1.23.12 Graph Search: GATE CSE 2016 Set 2 | Question: 11
Breadth First Search (BFS) is started on a binary tree beginning from the root vertex. There is a vertex
at a distance four from the root. If is the vertex in this BFS traversal, then the maximum possible
value of is __________
gatecse-2016-set2 algorithms graph-algorithms normal numerical-answers graph-search
Answer key ☟
The Breadth First Search (BFS) algorithm has been implemented using the queue data structure. Which
one of the following is a possible order of visiting the nodes in the graph below?
A. B. C. D.
gatecse-2017-set2 algorithms graph-algorithms graph-search
Answer key ☟
Let be a simple undirected graph. Let be a depth first search tree of . Let be a breadth first
search tree of . Consider the following statements.
I. No edge of is a cross edge with respect to . (A cross edge in is between two nodes neither of which
is an ancestor of the other in ).
II. For every edge of , if is at depth and is at depth in , then .
Answer key ☟
Let . Let denote the powerset of . Consider an undirected graph whose vertex set is
. For any is an edge in if and only if (i) , and (ii) either or .
For any vertex in , the set of all possible orderings in which the vertices of can be visited in a Breadth
First Search starting from is denoted by .
Answer key ☟
Let be a directed graph and a depth first search spanning tree in that is rooted at a vertex
. Suppose is also a breadth first search tree in , rooted at . Which of the following
statements is/are TRUE for every such graph and tree ?
A. There are no back-edges in with respect to the tree
B. There are no cross-edges in with respect to the tree
C. There are no forward-edge in with respect to the tree
D. The only edges in are the edges in
Answer key ☟
The number of edges present in the forest generated by the traversal of an undirected graph with
vertices is . The number of connected components in is __________.
gatecse2024-set1 numerical-answers graph-search graph-algorithms
Answer key ☟
Consider performing depth-first search (DFS) on an undirected and unweighted graph starting at
vertex . For any vertex in is the length of the shortest path from to . Let be an edge
in such that . If the edge is explored first in the direction from to during the above DFS,
then becomes a edge.
Answer key ☟
In a depth-first traversal of a graph with vertices, edges are marked as tree edges. The number of
connected components in is
A. B. C. D.
gateit-2005 algorithms graph-algorithms normal graph-search
Answer key ☟
Consider the depth-first-search of an undirected graph with vertices , , and . Let discovery time
represent the time instant when the vertex is first visited, and finish time represent the time
instant when the vertex is last visited. Given that
Answer key ☟
A depth-first search is performed on a directed acyclic graph. Let denote the time at which vertex
is visited for the first time and the time at which the DFS call to the vertex terminates. Which of
the following statements is always TRUE for all edges in the graph ?
A. B.
C. D.
gateit-2007 algorithms graph-algorithms normal graph-search depth-first-search
Answer key ☟
Consider the following sequence of nodes for the undirected graph given below:
1.
2.
3.
4.
A Depth First Search (DFS) is started at node . The nodes are listed in the order they are first visited. Which of
the above is/are possible output(s)?
Answer key ☟
1.23.23 Graph Search: UGC NET CSE | June 2012 | Part 3 | Question: 51
The strategy used to reduce the number of tree branches and the number of static evaluations applied in
case of a game tree is
Answer key ☟
The minimum number of record movements required to merge five files A (with records), B (with
records), C (with records), D (with records) and E (with records) is:
A. B. C. D.
gate1999 algorithms normal greedy-algorithm
Answer key ☟
The following are the starting and ending times of activities and respectively in
chronological order: . Here, denotes the starting time
and denotes the ending time of activity X. We need to schedule the activities in a set of rooms available to us.
An activity can be scheduled in a room only if the room is reserved for the activity for its entire duration. What
is the minimum number of rooms required?
A. B. C. D.
gatecse-2003 algorithms normal greedy-algorithm
Answer key ☟
We are given tasks . The execution of each task requires one unit of time. We can
execute one task at a time. Each task has a profit and a deadline . Profit is earned if the task is
completed before the end of the unit of time.
Are all tasks completed in the schedule that gives maximum profit?
Answer key ☟
We are given tasks . The execution of each task requires one unit of time. We can
execute one task at a time. Each task has a profit and a deadline . Profit is earned if the task is
completed before the end of the unit of time.
A. B. C. D.
gatecse-2005 algorithms greedy-algorithm process-scheduling normal
Answer key ☟
Consider the weights and values of items listed below. Note that there is only one unit of each item.
The task is to pick a subset of these items such that their total weight is no more than Kgs and their total
value is maximized. Moreover, no item may be split. The total value of items picked by an optimal algorithm is
denoted by . A greedy algorithm sorts the items by their value-to-weight ratios in descending order and
packs them greedily, starting from the first item in the ordered list. The total value of items picked by the greedy
algorithm is denoted by .
Answer key ☟
1.25.1 Greedy Algorithms: UGC NET CSE | Junet 2015 | Part 3 | Question: 64
A. B. C. D.
ugcnetcse-june2015-paper3 algorithms greedy-algorithms huffman-code
Answer key ☟
A hash table with ten buckets with one slot per bucket is shown in the following figure. The symbols
to initially entered using a hashing function with linear probing. The maximum number of
comparisons needed in searching an item that is not present is
A. B. C. D.
hashing isro2015 gate1989 algorithms normal
Answer key ☟
1.26.2 Hashing: GATE CSE 1990 | Question: 13b
i. What is the worst-case timing complexity of inserting elements into such a table?
ii. For what type of instance does this hashing scheme take the worst-case time for insertion?
Answer key ☟
Consider a double hashing scheme in which the primary hash function is , and the
secondary hash function is . Assume that the table size is . Then the address
returned by probe in the probe sequence (assume that the probe sequence begins at probe ) for key value
is_____________.
gatecse-2020 numerical-answers algorithms hashing 1-mark
Answer key ☟
Which of the following sequences of key insertions can cause the above state of the hash table (assume the keys
are in decimal notation)?
A. B.
C. D.
gatecse-2021-set1 multiple-selects algorithms hashing 2-marks
Answer key ☟
Suppose we are given keys, hash table slots, and two simple uniform hash functions and
Further suppose our hashing scheme uses for the odd keys and for the even keys. What is the
expected number of keys in a slot?
A. B. C. D.
gatecse-2022 algorithms hashing uniform-hashing 1-mark
Answer key ☟
An algorithm has to store several keys generated by an adversary in a hash table. The adversary is
malicious who tries to maximize the number of collisions. Let be the number of keys, be the
number of slots in the hash table, and .
Which one of the following is the best hashing strategy to counteract the adversary?
Answer key ☟
A hash table contains buckets and uses linear probing to resolve collisions. The key values are
integers and the hash function used is . If the values are inserted in the
table, in what location would the key value be inserted?
A. B. C. D.
gateit-2005 algorithms hashing easy
Answer key ☟
1.26.8 Hashing: GATE Overflow Test Series | Mock GATE | Test 3 | Question: 48
The following elements are inserted in an empty hash table using the
hash function and separate chaining technique for collision avoidance. Let be the number of
empty slots and be the number of non empty slots after the insertions. Three more keys are inserted in
alternate even odd pattern independently starting with an even key. What is the probability that after these
insertions the ratio of and will remain the same? Give answer up to decimal places.
go2025-mockgate-3 numerical-answers algorithms hashing
Answer key ☟
1.26.9 Hashing: GATE Overflow Test Series | Mock GATE | Test 4 | Question: 37
A hash table is given with elements. Linear Probing is used for collision avoidance. A biased coin is
tossed with the probability of appearance of head being . An element is added to the table if it is head
otherwise one element is removed. What is the chance that after trials the load factor of the hash table remains
same? (Up to three decimal points)
go2025-mockgate-4 numerical-answers algorithms hashing
Answer key ☟
1.26.10 Hashing: GATE Overflow Test Series | Mock GATE | Test 5 | Question: 41
In a system to store a file a hash table is created for each word. The alphanumeric value is their
alphabetical order. For example, alphanumeric value for is . The word is placed in hash table while
reading from left to right in that order using hash function. On looking the hash table of the word
"ISOMER" Larry can understand different words. If the total number of anagrams of the word "ISOMER" is
, then the value of is ________
go2025-mockgate-5 numerical-answers algorithms hashing 2-marks
Answer key ☟
A language uses an alphabet of six letters, . The relative frequency of use of each letter of
the alphabet in the language is as given below:
Design a prefix binary code for the language which would minimize the average length of the encoded words of
the language.
descriptive gate1989 algorithms huffman-code
Answer key ☟
A. , , , , , B. , , , , ,
C. , , , , , D. , , , , ,
gatecse-2007 algorithms greedy-algorithm normal huffman-code
Answer key ☟
A. B. C. D.
gatecse-2007 algorithms greedy-algorithm normal huffman-code
Answer key ☟
Answer key ☟
Consider the string . Each letter in the string must be assigned a binary code satisfying the
following properties:
1. For any two letters, the code assigned to one letter must not be a prefix of the code assigned to the other
letter.
2. For any two letters of the same frequency, the letter which occurs earlier in the dictionary order is assigned a
code whose length is at most the length of the code assigned to the other letter.
Among the set of all binary code assignments which satisfy the above two properties, what is the minimum
length of the encoded string?
A. B. C. D.
gatecse-2021-set2 algorithms huffman-code 2-marks
Answer key ☟
The characters to have the set of frequencies based on the first Fibonacci numbers as follows
, , , , , , ,
A Huffman code is used to represent the characters. What is the sequence of characters corresponding to the
following code?
A. B. C. D.
gateit-2006 algorithms greedy-algorithm normal huffman-code
Answer key ☟
1.27.7 Huffman Code: UGC NET CSE | July 2016 | Part 3 | Question: 34
Answer key ☟
1.27.8 Huffman Code: UGC NET CSE | July 2016 | Part 3 | Question: 59
Answer key ☟
What is the output produced by the following program, when the input is "HTGATE"
Function what (s:string): string;
var n:integer;
begin
n = s.length
if n <= 1
then what := s
else what :=contact (what (substring (s, 2, n)), s.C [1])
end;
Note
i. type string=record
length:integer;
C:array[1..100] of char
end
ii. Substring (s, i, j): this yields the string made up of the through characters in s; for appropriately
defined in and .
iii. Contact : this function yields a string of length length + - length obtained by concatenating
with such that precedes .
Answer key ☟
The following program computes values of a mathematical function . Determine the form of .
main ()
{
int m, n; float x, y, t;
scanf ("%f%d", &x, &n);
t = 1; y = 0; m = 1;
do
{
t *= (-x/m);
y += t;
} while (m++ < n);
printf ("The value of y is %f", y);
}
gate1990 descriptive algorithms identify-function
Answer key ☟
A. B.
C. D.
E. None of the above
gate1991 algorithms easy identify-function multiple-selects
Answer key ☟
Answer key ☟
Answer key ☟
1.28.6 Identify Function: GATE CSE 1995 | Question: 1.4
In the following Pascal program segment, what is the value of X after the execution of the program
segment?
X := -10; Y := 20;
If X > Y then if X < 0 then X := abs(X) else X := 2*X;
A. B. C. D. None
gate1995 algorithms identify-function easy
Answer key ☟
Assume that and are non-zero positive integers. What does the following Pascal program segment
do?
while X <> Y do
if X > Y then
X := X - Y
else
Y := Y - X;
write(X);
A. Computes the LCM of two numbers B. Divides the larger number by the smaller number
C. Computes the GCD of two numbers D. None of the above
gate1995 algorithms identify-function normal
Answer key ☟
A. Consider the following Pascal function where and are non-zero positive integers. What is the value of
?
function GET(A,B:integer): integer;
begin
if B=0 then
GET:= 1
else if A < B then
GET:= 0
else
GET:= GET(A-1, B) + GET(A-1, B-1)
end;
B. The Pascal procedure given for computing the transpose of an matrix of integers has an
error. Find the error and correct it. Assume that the following declaration are made in the main program
const
MAXSIZE=20;
type
INTARR=array [1..MAXSIZE,1..MAXSIZE] of integer;
Procedure TRANSPOSE (var A: INTARR; N : integer);
var
I, J, TMP: integer;
begin
for I:=1 to N – 1 do
for J:=1 to N do
begin
TMP:= A[I, J];
A[I, J]:= A[J, I];
A[J, I]:= TMP
end
end;
gate1995 algorithms identify-function normal descriptive
Answer key ☟
What value would the following function return for the input ?
Function fun (x:integer):integer;
Begin
If x > 100 then fun = x – 10
Else fun = fun(fun (x+11))
End;
A. B. C. D.
gate1998 algorithms recursion identify-function normal
Answer key ☟
Answer key ☟
Suppose you are given an array and a procedure reverse which reverses the order of
elements in between positions and (both inclusive). What does the following sequence do, where
:
reverse (s, 1, k);
reverse (s, k+1, n);
reverse (s, 1, n);
Answer key ☟
A. B. C. D.
gatecse-2003 algorithms identify-function normal
Answer key ☟
In the following program fragment, , , and TwoLog_n are integer variables, and is an array of
integers. The variable is initialized to an integer , and TwoLog_n is initialized to the value of
A. B.
C. D. { }
gatecse-2003 algorithms identify-function normal
Answer key ☟
Answer key ☟
A. B. C. D.
gatecse-2004 algorithms identify-function normal
Answer key ☟
int main() {
int a = 2048, sum = 0;
foo(a, sum);
printf("%d\n", sum);
}
A. B.
C. D.
gatecse-2005 algorithms identify-function recursion normal
Answer key ☟
Consider the following algorithm in which , , and are Boolean arrays of size :
algorithm zzz(x[], y[], z[]) {
int i;
for(i=0; i<n; ++i)
z[i] = (x[i] ∧ ~y[i]) ∨ (~x[i] ∧ y[i]);
}
A. B. C. D.
gatecse-2006 algorithms identify-function normal
Answer key ☟
Consider the following C-function in which and are two sorted integer arrays and be
another integer array,
void xyz(int a[], int b [], int c []){
int i,j,k;
i=j=k=0;
while ((i<n) && (j<m))
if (a[i] < b[j]) c[k++] = a[i++];
else c[k++] = b[j++];
}
Which of the following condition(s) hold(s) after the termination of the while loop?
i. and if
ii. and if
Answer key ☟
int main() {
int x = 15;
printf("%d/n", fun(5, &x));
return 0;
}
A. B. C. D.
gatecse-2009 algorithms recursion identify-function normal
Answer key ☟
int main()
{
int a[] = {12, 7, 13, 4, 11, 6};
printf("%d", f(a, 6));
return 0;
}
A. B. C. D.
gatecse-2010 algorithms recursion identify-function normal
Answer key ☟
A. B. C. D.
gatecse-2011 algorithms recursion identify-function normal
Answer key ☟
A. B. C. D.
gatecse-2011 algorithms recursion identify-function normal
Answer key ☟
int i, j, k=0;
for (i=n/2; i<=n; i++)
for (j=2; j<=n; j=j*2)
k = k + n/2;
return (k);
A. B.
C. D.
gatecse-2013 algorithms identify-function normal
Answer key ☟
Consider the following C function in which size is the number of elements in the array E:
int MyX(int *E, unsigned int size)
{
int Y = 0;
int Z;
int i, j, k;
Answer key ☟
Answer key ☟
Let be the square matrix of size . Consider the following pseudocode. What is the expected
output?
C=100;
for i=1 to n do
for j=1 to n do
{
Temp = A[i][j]+C;
A[i][j] = A[j][i];
A[j][i] = Temp -C;
}
for i=1 to n do
for j=1 to n do
output (A[i][j]);
Answer key ☟
Which one of the following most closely approximates the return value of the function ?
A. B. C. D.
gatecse-2015-set1 algorithms normal identify-function
Answer key ☟
Answer key ☟
Suppose is an array of length , where all the entries are from the set . For
any positive integers , consider the following pseudocode.
DOSOMETHING (c, a, n)
for
do
if
then
return z
If , then the output of DOSOMETHING( c, a, n) is _______.
Which one of the following will happen when the function convert is called with any positive integer as
argument?
Answer key ☟
Answer key ☟
Let be an array of elements with , for all such that . The value returned by
is __________
gatecse-2021-set1 algorithms numerical-answers identify-function 2-marks
Answer key ☟
Answer key ☟
The following function takes two ASCII strings and determines whether one is an anagram of the
other. An anagram of a string s is a string obtained by permuting the letters in s.
int anagram (char *a, char *b) {
int count [128], j;
for (j = 0; j < 128; j++) count[j] = 0;
j = 0;
while (a[j] && b[j]) {
A;
B;
}
for (j = 0; j < 128; j++) if (count [j]) return 0;
return 1;
}
Answer key ☟
int main () {
printf("%d", f(20, 1));
return 0;
}
A. B. C. D.
gateit-2005 algorithms identify-function normal
Answer key ☟
The following function computes the value of correctly for all legal values and (
and )
int func(int m, int n)
{
if (E) return 1;
else return(func(m -1, n) + func(m - 1, n - 1));
}
In the above function, which of the following is the correct expression for E?
A. B. &&
C. D. &&
gateit-2006 algorithms identify-function normal
Answer key ☟
A. B. C. D.
gateit-2008 algorithms recursion identify-function normal
Answer key ☟
void f (int n)
{
if (n <= 1) {
printf ("%d", n);
}
else {
f (n/2);
printf ("%d", n%2);
}
}
Which of the following implementations will produce the same output for as the above code?
P1 P2
P1 P2
void f (int n)
{
void f (int n)
if (n <=1) {
{
printf ("%d", n);
if (n/2) {
}
f(n/2);
else {
}
printf ("%d", n%2);
printf ("%d", n%2);
f (n/2);
}
}
}
Answer key ☟
1.28.39 Identify Function: GATE Overflow Test Series | Mock GATE | Test 3 | Question: 40
A. The element which is closest to the B. The inorder successor of the key
given key
C. The inorder predecessor of the key D. May sometimes give garbage value
go2025-mockgate-3 algorithms identify-function
Answer key ☟
1.28.40 Identify Function: GATE Overflow Test Series | Mock GATE | Test 5 | Question: 45
If the output of the above code is and the time complexity of the function is where is the number
of elements in the array passed to it (second argument), then ________
Answer key ☟
1.29.1 In Place Algo: UGC NET CSE | June 2019 | Part 2 | Question: 62
There are many sorting algorithms based on comparison. The running time of heapsort algorithm is
. Like , but unlike , heapsort sorts in place where is equal to
Answer key ☟
The usual implementation of Insertion Sort to sort an array uses linear search to identify the
position where an element is to be inserted into the already sorted part of the array. If, instead, we use
binary search to identify the position, the worst case running time will
A. remain B. become
C. become D. become
gatecse-2003 algorithms sorting time-complexity normal insertion-sort
Answer key ☟
What would be the worst case time complexity of the Insertion Sort algorithm, if the inputs are restricted to
permutations of with at most inversions?
A. B. C. D.
gatecse-2003 algorithms sorting normal insertion-sort
Answer key ☟
1.30.3 Insertion Sort: GATE Overflow Test Series | Mock GATE | Test 1 | Question: 45
An inversion is a pair of numbers at indices and , such that number number . Consider
the following array
Which of the following is the sorted sequence of the number of inversions of each element of the array? if the
element has no inversion consider inversion count as
A. B.
C. D.
go2025-mockgate-1 sorting insertion-sort algorithms
Answer key ☟
1.31.1 Knapsack Problem: UGC NET CSE | June 2014 | Part 3 | Question: 62
A. B. C. D.
ugcnetjune2014iii algorithms greedy-algorithm knapsack-problem
Answer key ☟
1.31.2 Knapsack Problem: UGC NET CSE | September 2013 | Part 3 | Question: 42
Given 0-1 knapsack problem and fractional knapsack problem and the following statements:
: 0-1 knapsack is efficiently solved using Greedy algorithm.
: Fractional knapsack is efficiently solved using Dynamic programming.
Which of the following is true?
Answer key ☟
1.32.1 Linear Search: UGC NET CSE | Junet 2015 | Part 2 | Question: 24
Answer key ☟
A. B.
C. D.
ugcnetcse-dec2015-paper3 algorithms longest-common-subsequence
Answer key ☟
A. B. C. D.
gatecse-2011 algorithms dynamic-programming normal matrix-chain-ordering
Answer key ☟
Answer key ☟
Answer key ☟
1.34.4 Matrix Chain Ordering: UGC NET CSE | August 2016 | Part 3 | Question: 31
Consider the problem of a chain < > of four matrices. Suppose that the dimensions of the
matrices and are and respectively. The minimum
number of scalar multiplications needed to compute the product is ____.
A. B. C. D.
ugcnetcse-aug2016-paper3 algorithms dynamic-programming numerical-answers matrix-chain-ordering
Answer key ☟
1.34.5 Matrix Chain Ordering: UGC NET CSE | December 2014 | Part 3 | Question: 35
Consider the problem of a chain of three matrices. Suppose that the dimensions of the
matrices are , and respectively. There are two different ways of
parenthesization : (i) and (ii) . Computing the product according to the first
parenthesization is ______ times faster in comparison to the second parenthesization.
A. B. C. D.
ugcnetcse-dec2014-paper3 algorithms matrix-chain-ordering
Answer key ☟
1.34.6 Matrix Chain Ordering: UGC NET CSE | January 2017 | Part 3 | Question: 34
The minimum number of scalar multiplication required, for parenthesization of a matrix-chain product
whose sequence of dimensions for four matrices is is
A. B. C. D.
ugcnetcse-jan2017-paper3 algorithms matrix-chain-ordering
Answer key ☟
1.34.7 Matrix Chain Ordering: UGC NET CSE | September 2013 | Part 3 | Question: 39
Answer key ☟
If one uses straight two-way merge sort algorithm to sort the following elements in ascending order:
then the order of these elements after second pass of the algorithm is:
A.
B.
C.
D.
A list of strings, each of length , is sorted into lexicographic order using the merge-sort algorithm.
The worst case running time of this computation is
A. B. C. D.
gatecse-2012 algorithms sorting normal merge-sort
Answer key ☟
Assume that a mergesort algorithm in the worst case takes seconds for an input of size . Which of
the following most closely approximates the maximum input size of a problem that can be solved in
minutes?
A. B. C. D.
gatecse-2015-set3 algorithms sorting merge-sort
Answer key ☟
1.35.4 Merge Sort: UGC NET CSE | December 2013 | Part 2 | Question: 25
Given two sorted list of size 'm' and 'n' respectively. The number of comparisons needed in the worst
case by the merge sort algorithm will be
Answer key ☟
1.35.5 Merge Sort: UGC NET CSE | June 2014 | Part 2 | Question: 36
Mergesort makes two recursive calls. Which statement is true after these two recursive calls finish, but
before the merge step ?
Answer key ☟
For merging two sorted lists of sizes and into a sorted list of size , we require comparisons of
A. B. C. D.
Answer key ☟
1.36.2 Merging: GATE CSE 2014 Set 2 | Question: 38
Answer key ☟
Kruskal’s algorithm for finding a minimum spanning tree of a weighted graph with vertices and
edges has the time complexity of:
A. B. C. D.
E.
gate1991 algorithms graph-algorithms minimum-spanning-tree time-complexity multiple-selects
Answer key ☟
Complexity of Kruskal’s algorithm for finding the minimum spanning tree of an undirected graph
containing vertices and edges if the edges are sorted is _______
gate1992 minimum-spanning-tree algorithms time-complexity easy fill-in-the-blanks
Answer key ☟
How many minimum spanning trees does the following graph have? Draw them. (Weights are assigned
to edges).
Answer key ☟
A complete, undirected, weighted graph is given on the vertex for any fixed ‘n’.
Draw the minimum spanning tree of if
Consider a graph whose vertices are points in the plane with integer co-ordinates such that
and , where is an integer. Two vertices and are adjacent iff
. The weight of an edge
A. What is the weight of a minimum weight-spanning tree in this graph? Write only the answer without any
explanations.
B. What is the weight of a maximum weight-spanning tree in this graph? Write only the answer without any
explanations.
Answer key ☟
Let be an undirected connected graph with distinct edge weights. Let be the edge with
maximum weight and the edge with minimum weight. Which of the following statements is false?
Answer key ☟
Consider a weighted undirected graph with vertex set and edge set
.
The third value in each tuple represents the weight of the edge specified in the tuple.
Answer key ☟
Answer key ☟
An undirected graph has nodes. its adjacency matrix is given by an square matrix whose (i)
diagonal elements are 0’s and (ii) non-diagonal elements are 1’s. Which one of the following is TRUE?
Answer key ☟
Consider a weighted complete graph on the vertex set such that the weight of the
edge is . The weight of a minimum spanning tree of is:
A. B. C. D.
Answer key ☟
A. B.
C. D.
gatecse-2006 algorithms graph-algorithms minimum-spanning-tree normal
Answer key ☟
Let be the minimum weight among all edge weights in an undirected connected graph. Let be a
specific edge of weight . Which of the following is FALSE?
Answer key ☟
Which one of the following is NOT the sequence of edges added to the minimum spanning tree using Kruskal’s
algorithm?
A.
B.
C.
D.
Answer key ☟
Consider a complete undirected graph with vertex set . Entry in the matrix below is
the weight of the edge
What is the minimum possible weight of a spanning tree in this graph such that vertex is a leaf node in the
tree ?
A. B. C. D.
gatecse-2010 algorithms minimum-spanning-tree normal
Answer key ☟
Consider a complete undirected graph with vertex set . Entry in the matrix below is
the weight of the edge
What is the minimum possible weight of a path from vertex to vertex in this graph such that contains at
most edges?
A. B. C. D.
gatecse-2010 normal algorithms minimum-spanning-tree
Answer key ☟
What will be the cost of the minimum spanning tree (MST) of such a graph with nodes?
A. B. C. D.
gatecse-2011 algorithms graph-algorithms minimum-spanning-tree normal
Answer key ☟
A. B. C. D.
gatecse-2011 algorithms graph-algorithms minimum-spanning-tree normal
Answer key ☟
L et be a weighted graph with edge weights greater than one and be the graph constructed
by squaring the weights of edges in . Let and be the minimum spanning trees of and
, respectively, with total weights and . Which of the following statements is TRUE?
Answer key ☟
The number of distinct minimum spanning trees for the weighted graph below is _____
Answer key ☟
The graph shown below has edges with distinct integer edge weights. The minimum spanning tree
(MST) is of weight and contains the edges: . 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 edges of this graph is_______________.
Answer key ☟
1.37.21 Minimum Spanning Tree: GATE CSE 2015 Set 3 | Question: 40
Let be a connected undirected graph of vertices and edges. The weight of a minimum
spanning tree of is . When the weight of each edge of is increased by five, the weight of a
minimum spanning tree becomes ______.
gatecse-2015-set3 algorithms minimum-spanning-tree easy numerical-answers
Answer key ☟
Let 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?
Answer key ☟
Let be a complete undirected graph on vertices, having edges with weights being and
. The maximum possible weight that a minimum weight spanning tree of can have is __________
gatecse-2016-set1 algorithms minimum-spanning-tree normal numerical-answers
Answer key ☟
is an undirected simple graph in which each edge has a distinct weight, and is a particular
edge of . Which of the following statements about the minimum spanning trees of is/are
TRUE?
Answer key ☟
Choose a value for that will maximize the number of minimum weight spanning trees (MWSTs) of . The
number of MWSTs of for this value of is ____.
Answer key ☟
Let be a weighted undirected graph and let be a Minimum Spanning Tree (MST) of
maintained using adjacency lists. Suppose a new weighed edge is added to . The worst
case time complexity of determining if is still an MST of the resultant graph is
A. B.
C. D.
Answer key ☟
Answer key ☟
Answer key ☟
Let be a connected undirected weighted graph. Consider the following two statements.
: There exists a minimum weight edge in which is present in every minimum spanning tree of .
: If every edge in has distinct weight, then has a unique minimum spanning tree.
Consider a simple undirected weighted graph all of whose edge weights are distinct. Which of the
following statements about the minimum spanning trees of is/are
A. The edge with the second smallest weight is always part of any minimum spanning tree of
B. One or both of the edges with the third smallest and the fourth smallest weights are part of any minimum
spanning tree of
C. Suppose be such that and . Consider the edge with the minimum weight such that one
of its vertices is in and the other in Such an edge will always be part of any minimum spanning
tree of
D. can have multiple minimum spanning trees.
Answer key ☟
Let be a directed graph, where is the set of vertices and is the set of
directed edges, as defined by the following adjacency matrix
Answer key ☟
Answer key ☟
Let be a weighted undirected graph and e be an edge with maximum weight in . Suppose there is a
minimum weight spanning tree in containing the edge . Which of the following statements is always
TRUE?
Answer key ☟
1.37.34 Minimum Spanning Tree: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 61
Which of the following can be the sequence of edges added, in that order, to a minimum spanning tree using
Kruskal’s algorithm? (Mark all the appropriate choices)
A.
B.
C.
D.
Answer key ☟
1.37.35 Minimum Spanning Tree: GATE Overflow Test Series | Mock GATE | Test 3 | Question: 60
If the minimum spanning tree for the graph below has total weight and the difference between the
maximum and minimum weights in it is then the value of is __________
Answer key ☟
1.37.36 Minimum Spanning Tree: GATE Overflow Test Series | Mock GATE | Test 4 | Question: 46
Let be an undirected connected graph with distinct edge weights. Let and be the edges with
maximum and minimum edge weights. Which of the following statements is/are TRUE? (Mark all the
appropriate choices)
A. If is present in some cycle then every Minimum Spanning Tree (MST) of must include .
B. will must be absent in every MST.
C. will have a unique MST if is present in MST.
D. MST of will never contain and at the same time.
Answer key ☟
1.37.37 Minimum Spanning Tree: GATE Overflow Test Series | Mock GATE | Test 4 | Question: 47
Answer key ☟
1.37.38 Minimum Spanning Tree: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 46
A. there exists a cut such that is a light edge crossing it forms a MST.
B. If an edge is contained in some Minimum Spanning Tree (MST), it is a light edge crossing some cut.
C. A graph has a unique MST if, for every cut, there is a unique light edge crossing the cut.
D. If a graph has a unique MST, then for every cut of the graph there is a unique light edge crossing the cut.
1.37.39 Minimum Spanning Tree: UGC NET CSE | November 2017 | Part 2 | Question: 5
Use Kruskal’s algorithm to find a minimal spanning tree for the graph. The List of the edges of the tree in the
order in which they are chosen is
A. AD, AE, AG, GC, GB, BF B. GC, GB, BF, GA, AD, AE
C. GC, AD, GB, GA, BF, AE D. AD, AG, GC, AE, GB, BF
ugcnetcse-nov2017-paper2 graph-algorithms minimum-spanning-tree
Answer key ☟
1.
2.
3.
4.
(Option
(Option
(Option
(Option
Answer Given by Candidate :
Answer key ☟
1.38.1 Non Gatecse: UGC NET CSE | October 2020 | Part 2 | Question: 69
Match with
With reference to CMM developed by Software Engineering Institute (SEI)
A. B.
C. D.
ugcnetcse-oct2020-paper2 non-gatecse algorithms
Answer key ☟
1.39.1 Open Addressing: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 44
You need to store records in a hash table of size using open addressing with linear probing. The
hash function in use has the probability that a key is hashed into any of the slots as For a
particular slot in the hash table, what is the probability that this slot is empty, that is, none of the keys hashes
into this slot (rounded to decimal point)?
go2025-mockgate-6 numerical-answers algorithms hashing open-addressing 2-marks
Answer key ☟
1.40.1 Optimal Search Tree: UGC NET CSE | December 2015 | Part 3 | Question: 21
where and denotes the probability with which we search and the
identifier being searched satisfy respectively. The optimal search tree is given by:
1.
1.
1.
1.
1.41.1 Optimal Solution: UGC NET CSE | June 2019 | Part 2 | Question: 68
Answer key ☟
The relative costs of assigning jobs and to machines and are given below:
Using the assignment method find the assignment involving minimum cost. Is this an optimal assignment?
gate1987 algorithms descriptive out-of-gatecse-syllabus
Answer key ☟
Answer key ☟
Ram and Shyam have been asked to show that a certain problem is Ram shows a
polynomial time reduction from the problem to , and Shyam shows a polynomial time
reduction from to Which of the following can be inferred from these reductions?
Answer key ☟
Let S be an NP-complete problem and Q and R be two other problems not known to be in NP. Q is
polynomial time reducible to S and S is polynomial-time reducible to R. Which one of the following
statements is true?
A. R is NP-complete B. R is NP-hard
C. Q is NP-complete D. Q is NP-hard
gatecse-2006 algorithms p-np-npc-nph normal isrodec2017 out-of-gatecse-syllabus
Answer key ☟
The subset-sum problem is defined as follows: Given a set of positive integers and a positive integer
, determine whether there is a subset of whose elements sum to . An algorithm solves this
problem in time. Which of the following statements is false?
A. solves the subset-sum problem in polynomial time when the input is encoded in unary
B. solves the subset-sum problem in polynomial time when the input is encoded in binary
C. The subset sum problem belongs to the class
D. The subset sum problem is
Answer key ☟
A problem in NP is NP-complete if
Answer key ☟
For problems X and Y, Y is NP-complete and X reduces to Y in polynomial time. Which of the
following is TRUE?
Answer key ☟
1.43.8 P NP NPC NPH: UGC NET CSE | December 2014 | Part 3 | Question: 33
Answer key ☟
1.43.9 P NP NPC NPH: UGC NET CSE | June 2019 | Part 2 | Question: 67
Consider the complexity class as the set of languages such that , and the
following two statements:
Answer key ☟
1.43.10 P NP NPC NPH: UGC NET CSE | Junet 2015 | Part 3 | Question: 32
Answer key ☟
Using Prim's algorithm to construct a minimum spanning tree starting with node A, which one of the following
sequences of edges represents a possible order in which the edges would be added to construct the minimum
spanning tree?
A.
B.
C.
D.
Answer key ☟
For the undirected, weighted graph given below, which of the following sequences of edges represents a
correct execution of Prim's algorithm to construct a Minimum Spanning Tree?
A.
B.
C.
D.
Answer key ☟
1.44.3 Prims Algorithm: UGC NET CSE | October 2020 | Part 2 | Question: 78
Using Prim’s algorithm to construct a minimum spanning tree starting with node , which one of the following
sequences of edges represents a possible order in which the edges would be added to construct the minimum
spanning tree?
A.
B.
C.
D.
Answer key ☟
1.45 Pseudocode (1)
1.45.1 Pseudocode: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 43
Consider the pseudocode given below. The function Dosomething takes an argument a pointer to the
root of an arbitrary tree which uses a queue data structure .
int Dosomething(struct Node *node)
{
if(node != NULL)
{
Enque(Q,node);
while (Q is not empty)
{
struct Node *temp = Deque(Q);
if (!temp -> left && temp -> right || temp -> left && !temp -> right)
count++;
if (temp -> left != NULL)
Enque(Q,temp -> left);
if (temp -> right != NULL)
Enque(Q,temp -> right);
}
}
return count;
}
A. The number of internal nodes of a tree. B. The number of nodes with one child.
C. The number of child nodes. D. The number of nodes in the tree.
go2025-mockgate-2 identify-function pseudocode
Answer key ☟
Let be a quicksort program to sort numbers in ascending order. Let and be the time taken by the
program for the inputs and , respectively. Which of the following holds?
A. B.
C. D.
gate1987 algorithms sorting quick-sort
Answer key ☟
i. Sort the input file using QUICKSORT by correctly positioning the first element of the file/subfile. Show the
subfiles obtained at all intermediate steps. Use square brackets to demarcate subfiles.
ii. Sort the input file using -way- MERGESORT showing all major intermediate steps. Use square brackets to
demarcate subfiles.
Answer key ☟
1.46.3 Quick Sort: GATE CSE 1992 | Question: 03,iv
Assume that the last element of the set is used as partition element in Quicksort. If distinct elements
from the set are to be sorted, give an input for which Quicksort takes maximum time.
gate1992 algorithms sorting easy quick-sort descriptive
Answer key ☟
Quick-sort is run on two inputs shown below to sort in ascending order taking first element as pivot
i.
ii.
Let and be the number of comparisons made for the inputs (i) and (ii) respectively. Then,
A. B.
C. D. we cannot say anything for arbitrary
gate1996 algorithms sorting normal quick-sort
Answer key ☟
Randomized quicksort is an extension of quicksort where the pivot is chosen randomly. What is the
worst case complexity of sorting n numbers using Randomized quicksort?
A. B. C. D.
gatecse-2001 algorithms sorting time-complexity easy quick-sort
Answer key ☟
The median of elements can be found in time. Which one of the following is correct about the
complexity of quick sort, in which median is selected as pivot?
A. B.
C. D.
gatecse-2006 algorithms sorting easy quick-sort
Answer key ☟
Consider the Quicksort algorithm. Suppose there is a procedure for finding a pivot element which splits
the list into two sub-lists each of which contains at least one-fifth of the elements. Let be the
number of comparisons required to sort elements. Then
A. B.
C. D.
gatecse-2008 algorithms sorting easy quick-sort
Answer key ☟
In quick-sort, for sorting elements, the smallest element is selected as pivot using an
time algorithm. What is the worst case time complexity of the quick sort?
A. B.
C. D.
gatecse-2009 algorithms sorting normal quick-sort
Answer key ☟
Let be quicksort program to sort numbers in ascending order using the first element as the pivot. Let
and be the number of comparisons made by P for the inputs and respectively.
Which one of the following holds?
A. B. C. D.
gatecse-2014-set1 algorithms sorting easy quick-sort
Answer key ☟
You have an array of elements. Suppose you implement quicksort by always choosing the central
element of the array as the pivot. Then the tightest upper bound for the worst case performance is
A. B. C. D.
gatecse-2014-set3 algorithms sorting easy quick-sort
Answer key ☟
Which one of the following is the recurrence equation for the worst case time complexity of the quick
sort algorithm for sorting numbers? In the recurrence equations given in the options below, is
a constant.
A. B.
C. D.
gatecse-2015-set1 algorithms recurrence-relation sorting easy quick-sort
Answer key ☟
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 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 of size 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 (___________);
}
}
Answer key ☟
An array of distinct elements is to be sorted using quicksort. Assume that the pivot element is chosen
uniformly at random. The probability that the pivot element gets placed in the worst possible location in
the first round of partitioning (rounded off to decimal places) is ________
gatecse-2019 numerical-answers algorithms quick-sort probability 1-mark
Answer key ☟
Consider sorting the following array of integers in ascending order using an inplace Quicksort algorithm
that uses the last element as the pivot.
Answer key ☟
1.46.15 Quick Sort: GATE Overflow Test Series | Mock GATE | Test 5 | Question: 43
Suppose we are given an algorithm that find the median in time , where is the number of
inputs. Now consider a QuickSort implementation where we first find median using the above algorithm
, then use this median as pivot. What will be the worst case time complexity of this modified QuickSort?
A. B.
C. D.
go2025-mockgate-5 algorithms quick-sort time-complexity 2-marks
Answer key ☟
1.46.16 Quick Sort: UGC NET CSE | June 2014 | Part 3 | Question: 66
Suppose that the splits at every level of quicksort are in the proportion to , where is
a constant. The minimum depth of a leaf in the recursion tree is approximately given by
A. B.
C. D.
ugcnetjune2014iii data-structures sorting algorithms quick-sort
Answer key ☟
1.47 Recurrence Relation (41)
Answer key ☟
Answer key ☟
Answer key ☟
recurrence relation,
, for and
Answer key ☟
Answer key ☟
Answer key ☟
Let be the number of times the ‘if…then…’ statement gets executed when the algorithm is run with value .
Set up the recurrence relation by defining in terms of . Solve for .
Answer key ☟
1.47.8 Recurrence Relation: GATE CSE 1994 | Question: 1.7, ISRO2017-14
The recurrence relation that arises in relation with the complexity of binary search is:
A. B.
C. D.
gate1994 algorithms recurrence-relation easy isro2017
Answer key ☟
Answer key ☟
Use the recurrence relation to answer the following questions. Assume that
are positive integers. Write only the answers without any explanation.
Answer key ☟
A. B.
C. D. None of the above
gate1997 algorithms recurrence-relation normal
Answer key ☟
1.47.12 Recurrence Relation: GATE CSE 1998 | Question: 6a
Answer key ☟
A. B. C. D.
gatecse-2002 algorithms recurrence-relation normal
Answer key ☟
A. B. C. D.
gatecse-2002 algorithms recurrence-relation normal
Answer key ☟
for all
The value of for is
A. B.
C. D.
gatecse-2003 algorithms time-complexity recurrence-relation difficult
Answer key ☟
A. B. C. D.
gatecse-2004 algorithms recurrence-relation time-complexity normal isro2015
Answer key ☟
evaluates to
A. B. C. D.
gatecse-2004 algorithms recurrence-relation normal
Answer key ☟
A. B.
C. D.
algorithms recurrence-relation isro2016 gatecse-2006
Answer key ☟
Let denote the number of binary strings of length that contain no consecutive s.
Which of the following recurrences does satisfy?
A. B.
C. D.
gatecse-2008 algorithms recurrence-relation normal
Answer key ☟
Let denote the number of binary strings of length that contain no consecutive s.
The value of is
A. B. C. D.
gatecse-2008 algorithms recurrence-relation normal
Answer key ☟
Which one of the following represents the time complexity of the algorithm?
A. B.
C. D.
gatecse-2009 algorithms recurrence-relation time-complexity normal
Answer key ☟
The recurrence relation capturing the optimal execution time of the problem with
discs is
A. B.
C. D.
gatecse-2012 algorithms easy recurrence-relation
Answer key ☟
Which one of the following correctly determines the solution of the recurrence relation with ?
A. B. C. D.
gatecse-2014-set2 algorithms recurrence-relation normal
Answer key ☟
Let a represent the number of bit strings of length n containing two consecutive s. What is the
recurrence relation for ?
A. B.
C. D.
gatecse-2015-set1 algorithms recurrence-relation normal
Answer key ☟
If function is being called in then how many times will the function be invoked before
returning to the ?
A. B. C. D.
gatecse-2015-set3 algorithms recurrence-relation normal
Answer key ☟
The given diagram shows the flowchart for a recursive function . Assume that all statements,
except for the recursive calls, have time complexity. If the worst case time complexity of this
function is , then the least possible value (accurate up to two decimal positions) of is ________.
Flow chart for Recursive Function .
Answer key ☟
A. B.
C. D.
gatecse-2017-set2 algorithms recurrence-relation
Answer key ☟
A. B. )
C. ) D. )
gatecse-2020 algorithms recurrence-relation 1-mark
Answer key ☟
A. B.
C. D.
gatecse-2021-set1 algorithms recurrence-relation time-complexity 2-marks
Answer key ☟
1.47.30 Recurrence Relation: GATE CSE 2021 Set 2 | Question: 39
For constants and , consider the following recurrence defined on the non-negative integers:
A. If is , then is
B. If is , then is
C. If is for some , then is
D. If is , then is
Answer key ☟
A. B.
C. D.
Answer key ☟
Consider a list of recursive algorithms and a list of recurrence relations as shown below. Each recurrence
relation corresponds to exactly one algorithm and is used to derive the time complexity of the algorithm.
Which of the following is the correct match between the algorithms and their recurrence relations?
A. B.
C. D.
gateit-2004 algorithms recurrence-relation normal match-the-following
Answer key ☟
A. B.
C. D.
gateit-2005 algorithms recurrence-relation easy
Answer key ☟
A. B.
C. D.
gateit-2008 algorithms recurrence-relation normal
Answer key ☟
1.47.35 Recurrence Relation: UGC NET CSE | December 2012 | Part 3 | Question: 14
A. B.
C. D.
ugcnetcse-dec2012-paper3 algorithms recurrence-relation time-complexity
Answer key ☟
1.47.36 Recurrence Relation: UGC NET CSE | December 2015 | Part 3 | Question: 19
is
Answer key ☟
1.47.37 Recurrence Relation: UGC NET CSE | December 2018 | Part 2 | Question: 21
A. B.
C. D.
ugcnetcse-dec2018-paper2 recurrence-relation
Answer key ☟
1.47.38 Recurrence Relation: UGC NET CSE | July 2018 | Part 2 | Question: 21
A. B.
C. D.
ugcnetcse-july2018-paper2 algorithms time-complexity recurrence-relation
Answer key ☟
1.47.39 Recurrence Relation: UGC NET CSE | June 2013 | Part 3 | Question: 12
A. B.
C. D.
ugcnetcse-june2013-paper3 algorithms recurrence-relation
Answer key ☟
1.47.40 Recurrence Relation: UGC NET CSE | June 2014 | Part 3 | Question: 63
A. B. C. D.
ugcnetjune2014iii algorithms recurrence-relation
Answer key ☟
1.47.41 Recurrence Relation: UGC NET CSE | September 2013 | Part 3 | Question: 37
Answer key ☟
A. B. C. D.
gate1995 algorithms normal recursion
Answer key ☟
Answer key ☟
Consider the following program written in pseudo-code. Assume that and are integers.
Count (x, y) {
if (y !=1 ) {
if (x !=1) {
print("*");
Count (x/2, y);
}
else {
y=y-1;
Count (1024, y);
}
}
}
The number of times that the statement is executed by the call is _____
Answer key ☟
Answer key ☟
int main(){
int n=10;
mystery(n);
return 0;
}
Answer key ☟
Answer key ☟
1.49.1 Red Black Tree: UGC NET CSE | January 2017 | Part 3 | Question: 33
Red-black trees are one of many search tree schemes that are “balanced” in order to guarantee that basic
dynamic-set operations take _____ time in the worst case.
A. B. C. D.
ugcnetcse-jan2017-paper3 algorithms red-black-tree
Answer key ☟
Consider the following program that attempts to locate an element in an array using binary search.
Assume . The program is erroneous. Under what conditions does the program fail?
var i,j,k: integer; x: integer;
a: array; [1..N] of integer;
begin i:= 1; j:= n;
repeat
k:(i+j) div 2;
if a[k] < x then i:= k
else j:= k
until (a[k] = x) or (i >= j);
if (a[k] = x) then
writeln ('x is in the array')
else
writeln ('x is not in the array')
end;
Answer key ☟
The average number of key comparisons required for a successful search for sequential search on
items is
Answer key ☟
Consider the following algorithm for searching for a given number in an unsorted array
having distinct values:
Assuming that is present in , what is the expected number of comparisons made by the algorithm before it
terminates?
A. B. C. D.
gatecse-2002 searching normal
Answer key ☟
Consider the following C program that attempts to locate an element in an array using binary
search. The program is erroneous.
f (int Y[10] , int x) {
int i, j, k;
i= 0; j = 9;
do {
k = (i+ j) / 2;
if( Y[k] < x) i = k;else j = k;
} while (Y[k] != x) && (i < j)) ;
if(Y[k] == x) printf(" x is in the array ") ;
else printf(" x is not in the array ") ;
}
A. is and
B. is and
C. is and
D. is and and is even
Answer key ☟
1.50.5 Searching: GATE CSE 2008 | Question: 85
Consider the following C program that attempts to locate an element in an array using binary
search. The program is erroneous.
f (int Y[10] , int x) {
int i, j, k;
i= 0; j = 9;
do {
k = (i + j) / 2;
if( Y[k] < x) i = k;else j = k;
} while (Y[k] != x) && (i < j)) ;
if(Y[k] == x) printf(" x is in the array ") ;
else printf(" x is not in the array ") ;
}
Answer key ☟
Let be an array of numbers consisting of a sequence of 's followed by a sequence of 's. The
problem is to find the smallest index such that is by probing the minimum number of locations
in . The worst case number of probes performed by an optimal algorithm is ____________.
Answer key ☟
A sequential search operation is performed on an array for the key value of (ignore quotes).
Consider the following piece of assembly language code that uses back patching to perform the
sequential search.
i=0;
P: if (i<A.length) goto ____;
Q: goto ____;
R: if (x==A[i]) goto ____
S: goto _____;
T: return i;
U: return -1;
What should be the correct values in the blanks provided ordered from top to bottom?
A. R T U P B. R U T P C. P U T R D. P T U R
go-mockgate-1 algorithms searching compiler-design intermediate-code code-optimization
Answer key ☟
Fill in the blanks in the following template of an algorithm to compute all pairs shortest path lengths in a
directed graph with adjacency matrix . equals if there is an edge in from to , and
otherwise. Your aim in filling in the blanks is to ensure that the algorithm is correct.
INITIALIZATION: For i = 1 ... n
{For j = 1 ... n
{ if a[i,j] = 0 then P[i,j] =_______ else P[i,j] =_______;}
}
a. Copy the complete line containing the blanks in the Initialization step and fill in the blanks.
b. Copy the complete line containing the blanks in the Algorithm step and fill in the blanks.
c. Fill in the blank: The running time of the Algorithm is (___).
Answer key ☟
A single-source shortest path algorithm is executed on the weighted graph with an arbitrary vertex
of as the source. Which of the following can always be inferred from the path costs computed?
Answer key ☟
In an unweighted, undirected connected graph, the shortest path from a node to every other node is
computed most efficiently, in terms of time complexity, by
Answer key ☟
Let be a directed, weighted graph with weight function . For some function
, for each edge , define as .
Which one of the options completes the following sentence so that it is TRUE?
“The shortest paths in under are shortest paths under too,_____________”.
A. for every
B. if and only if is positive
C. if and only if is negative
D. if and only if is the distance from to in the graph obtained by adding a new vertex to and edges
of zero weight from to every vertex of
Answer key ☟
Consider a weighted, undirected graph with positive edge weights and let be an edge in the graph. It
is known that the shortest path from the source vertex to has weight 53 and the shortest path from
to has weight 65. Which one of the following statements is always TRUE?
A. Weight B. Weight
C. Weight D. Weight
gateit-2007 algorithms graph-algorithms normal ugcnetcse-june2012-paper3 shortest-path
Answer key ☟
1.51.6 Shortest Path: UGC NET CSE | December 2014 | Part 3 | Question: 34
Dijkstra algorithm, which solves the single-source shortest--paths problem, is a _______, and the Floyd-
Warshall algorithm, which finds shortest paths between all pairs of vertices, is a ________.
Answer key ☟
1.51.7 Shortest Path: UGC NET CSE | Junet 2015 | Part 3 | Question: 31
Answer key ☟
Answer key ☟
1.52.2 Sorting: GATE CSE 1990 | Question: 3-v
A. B.
C. D.
gate1990 normal algorithms sorting easy time-complexity multiple-selects
Answer key ☟
Answer key ☟
Give an optimal algorithm in pseudo-code for sorting a sequence of numbers which has only distinct
numbers ( is not known a Priori). Give a brief analysis for the time-complexity of your algorithm.
gate1991 sorting time-complexity algorithms difficult descriptive
Answer key ☟
Answer key ☟
Use Bubble sort to arrange the sequence in ascending order. Give the sequence at the end of each of the first five
passes.
gate1995 algorithms sorting easy descriptive bubble-sort
Answer key ☟
Answer key ☟
A. B.
C. D.
gate1998 algorithms sorting easy match-the-following
Answer key ☟
A. it takes time
B. it maintains the relative order of occurrence of non-distinct elements
C. it uses divide and conquer paradigm
D. it takes space
Answer key ☟
Let be an matrix such that the elements in each row and each column are arranged in ascending
order. Draw a decision tree, which finds st, nd and rd smallest elements in minimum number of
comparisons.
Answer key ☟
An array contains four occurrences of , five occurrences of , and three occurrences of in any order.
The array is to be sorted using swap operations (elements that are swapped need to be adjacent).
a. What is the minimum number of swaps needed to sort such an array in the worst case?
b. Give an ordering of elements in the above array so that the minimum number of swaps needed to sort the
array is maximum.
gatecse-2000 algorithms sorting normal descriptive
Answer key ☟
A. B. C. D.
gatecse-2003 algorithms sorting inversion normal
Answer key ☟
The tightest lower bound on the number of comparisons, in the worst case, for comparison-based sorting
is of the order of
A. B. C. D.
gatecse-2004 algorithms sorting asymptotic-notation easy
Answer key ☟
Suppose there are sorted lists of elements each. The time complexity of producing a
sorted list of all these elements is: (Hint:Use a heap data structure)
A. B.
C. D.
gatecse-2005 algorithms sorting normal
Answer key ☟
Which one of the following in place sorting algorithms needs the minimum number of swaps?
Answer key ☟
Which of the following sorting algorithms has the lowest worse-case complexity?
Answer key ☟
1.52.17 Sorting: GATE CSE 2009 | Question: 11
What is the number of swaps required to sort elements using selection sort, in the worst case?
A. B.
C. D.
gatecse-2009 algorithms sorting easy selection-sort
Answer key ☟
The number of elements that can be sorted in time using heap sort is
A. B.
C. D.
gatecse-2013 algorithms sorting normal heap-sort
Answer key ☟
Which one of the following is the tightest upper bound that represents the number of swaps required to
sort numbers using selection sort?
A. ) B. ) C. ) D. )
gatecse-2013 algorithms sorting easy selection-sort
Answer key ☟
The minimum number of comparisons required to find the minimum and the maximum of numbers
is ________
gatecse-2014-set1 algorithms numerical-answers normal maximum-minimum sorting
Answer key ☟
The worst case running times of Insertion sort , Merge sort and Quick sort, respectively are:
A. , and
B. , and
C. , and
D. , and
Answer key ☟
Assume that the algorithms considered here sort the input sequences in ascending order. If the input is
already in the ascending order, which of the following are TRUE?
Answer key ☟
Which algorithm out of the following options uses the least number of comparisons (among the array elements)
to sort the above array in ascending order?
Answer key ☟
A. B. C. D.
gatecse2024-set1 algorithms heap-sort sorting
Answer key ☟
Let be an array containing integer values. The distance of is defined as the minimum number of
elements in that must be replaced with another integer so that the resulting array is sorted in non-
decreasing order. The distance of the array is ___________.
gatecse2024-set2 numerical-answers algorithms sorting
Answer key ☟
i. Bubble sort
ii. Insertion sort
iii. Selection sort
Which ONE among the following choices of sorting algorithms sorts the numbers in the array in
increasing order after exactly two passes over the array?
Answer key ☟
1.52.27 Sorting: GATE IT 2005 | Question: 59
Let and be two sorted arrays containing integers each, in non-decreasing order. Let be a sorted
array containing integers obtained by merging the two arrays and . Assuming the arrays are
indexed starting from , consider the following four statements
I.
II.
III.
IV.
A. only I and II B. only I and IV C. only II and III D. only III and IV
gateit-2005 algorithms sorting normal
Answer key ☟
If we use Radix Sort to sort integers in the range , for some which is independent of
, the time taken would be?
A. B. C. D.
gateit-2008 algorithms sorting normal
Answer key ☟
1.52.29 Sorting: GATE Overflow Test Series | Mock GATE | Test 4 | Question: 17
Consider a selection sorting implementation which takes time units for input of size . How much
time units will it take for an input of size
go2025-mockgate-4 numerical-answers algorithms sorting time-complexity
Answer key ☟
1.52.30 Sorting: GATE Overflow Test Series | Mock GATE | Test 5 | Question: 44
A sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted
output as they appear in the input unsorted array.
We have a list of -dimensional points where represents coordinate and represents coordinate:
We sort this list in descending order of coordinates. Which of the below option follow properties of stable
sort?
A. B.
C. D.
go2025-mockgate-5 algorithms sorting 2-marks
Answer key ☟
1.52.31 Sorting: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 25
Here, we need to sort the student data first by age and then by name. For the sorting by name which of the
following algorithms is/are inappropriate to be used? (Mark all the appropriate choices)
A. Merge Sort B. Insertion Sort C. Quick Sort D. Heap Sort
go2025-mockgate-6 algorithms sorting multiple-selects 1-mark
Answer key ☟
Given a sequence of numbers where numbers at odd positions as well as even positions are sorted in
increasing order. For example
1 42 3 44 6 45 9
Which of the following sorting algorithm performs the best here with respect to the number of comparisons
performed?
A. Insertion sort
B. Bubble sort
C. Selection sort
D. Asymptotically all the above three have the same worst case performance
gate-suitability-test-1 sorting
Assuming there are n keys and each key is in the range [0, m-1]. The run time of bucket sort is
Answer key ☟
You have to sort a list , consisting of a sorted list followed by a few ‘random’ elements. Which of the
following sorting method would be most suitable for such a task ?
Answer key ☟
If there are n integers to sort, each integer had d digits and each digit is in the set , radix sort
can sort the numbers in
A. B. C. D.
ugcnetcse-dec2015-paper3 algorithms sorting
Answer key ☟
Which of the following is best running time to sort integers in the range to ?
A. B. C. D.
ugcnetcse-june2019-paper2 sorting
Answer key ☟
double foo(int n)
{
int i;
double sum;
if(n == 0)
{
return 1.0;
}
else
{
sum = 0.0;
for(i = 0; i < n; i++)
{
sum += foo(i);
}
return sum;
}
}
A. B. C. D.
gatecse-2005 algorithms recursion normal space-complexity
Answer key ☟
1.53.2 Space Complexity: UGC NET CSE | December 2015 | Part 2 | Question: 39
Answer key ☟
1.53.3 Space Complexity: UGC NET CSE | October 2020 | Part 2 | Question: 73
Match with
A. B.
C. D.
ugcnetcse-oct2020-paper2 space-complexity algorithms
Answer key ☟
The most efficient algorithm for finding the number of connected components in an undirected graph on
vertices and edges has time complexity
A. B. C. D.
gatecse-2008 algorithms graph-algorithms time-complexity normal strongly-connected-components
Answer key ☟
Let be a graph with vertices, with each vertex labelled by a distinct permutation of the numbers
There is an edge between vertices and if and only if the label of can be obtained by
swapping two adjacent numbers in the label of . Let denote the degree of a vertex in , and denote the
number of connected components in . Then, ______.
gatecse-2018 algorithms graph-algorithms numerical-answers 2-marks strongly-connected-components
Answer key ☟
Which of the following is the correct decomposition of the directed graph given below into its strongly
connected components?
A.
B.
C.
D.
Answer key ☟
Given below is the sketch of a program that represents the path in a two-person game tree by the
sequence of active procedure calls at any time. The program assumes that the payoffs are real number in
a limited range; that the constant INF is larger than any positive payoff and its negation is smaller than any
negative payoff and that there is a function “payoff” and that computes the payoff for any board that is a leaf.
The type “boardtype” has been suitably declared to represent board positions. It is player- ’s move if mode =
MAX and player- ’s move if mode=MIN. The type modetype =(MAX, MIN). The functions “min” and “max”
find the minimum and maximum of two real numbers.
function search(B: boardtype; mode: modetype): real;
var
C:boardtype; {a child of board B}
value:real;
begin
if B is a leaf then
return (payoff(B))
else
begin
if mode = MAX then value :=-INF
else
value:INF;
for each child C of board B do
if mode = MAX then
value:=max (value, search (C, MIN))
else
value:=min(value, search(C, MAX))
return(value)
end
end; (search)
Comment on the working principle of the above program. Suggest a possible mechanism for reducing the
amount of search.
Answer key ☟
Answer key ☟
A. B. C. D.
E.
gate1993 algorithms time-complexity easy
Answer key ☟
Suppose we want to arrange the numbers stored in any array such that all negative values occur before
all positive ones. Minimum number of exchanges required in the worst case is
Answer key ☟
1.55.5 Time Complexity: GATE CSE 1999 | Question: 1.16
A. B. C. D.
gate1999 algorithms time-complexity normal
Answer key ☟
Consider the following algorithms. Assume, procedure and procedure take and unit
of time respectively. Derive the time complexity of the algorithm in -notation.
algorithm what (n)
begin
if n = 1 then call A
else
begin
what (n-1);
call B(n)
end
end.
Answer key ☟
Let be a sorted array of integers. Let denote the time taken for the most efficient algorithm to
determined if there are two elements with sum less than in . Which of the following statement is
true?
A. is B.
C. D.
gatecse-2000 easy algorithms time-complexity
Answer key ☟
The cube root of a natural number is defined as the largest natural number such that . The
complexity of computing the cube root of ( is represented by binary notation) is
A. but not
B. but not for any constant
C. for some constant , but not for any constant
D. for some constant , but not
Answer key ☟
Two matrices and are to be stored in arrays and respectively. Each array can be stored
either in row-major or column-major order in contiguous memory locations. The time complexity of an
algorithm to compute will be
Answer key ☟
Let be an array storing a bit ( or ) at each location, and is a function whose time
complexity is . Consider the following program fragment written in a C like language:
counter = 0;
for (i=1; i<=n; i++)
{
if (a[i] == 1) counter++;
else {f (counter); counter = 0;}
}
A. B.
C. D.
gatecse-2004 algorithms time-complexity normal
Answer key ☟
Consider the following C-program fragment in which , and are integer variables.
for( i = n, j = 0; i > 0; i /= 2, j +=i );
Let denote the value stored in the variable after termination of the for loop. Which one of the following
is true?
A. B.
C. D.
gatecse-2006 algorithms normal time-complexity
Answer key ☟
The number of comparisons made in the execution of the loop for any is:
A. B.
C. D.
gatecse-2007 algorithms time-complexity normal isro2016
Answer key ☟
A. B.
C. D.
gatecse-2007 algorithms time-complexity normal
Answer key ☟
An array of numbers is given, where is an even number. The maximum as well as the minimum of
these numbers needs to be determined. Which of the following is TRUE about the number of
comparisons needed?
Answer key ☟
Let denote number of times the loop is executed by the program on input . Which of the following is
TRUE?
A. B.
C. D. None of the above
gatecse-2007 algorithms time-complexity normal
Answer key ☟
The minimum number of comparisons required to determine if an integer appears more than times in
a sorted array of integers is
A. B. C. D.
gatecse-2008 normal algorithms time-complexity
Answer key ☟
1.55.17 Time Complexity: GATE CSE 2008 | Question: 47
We have a binary heap on elements and wish to insert more elements (not necessarily one after
another) into this heap. The total time required for this is
A. B. C. D.
Answer key ☟
A. and B. and
C. and D. and
gatecse-2008 algorithms time-complexity normal
Answer key ☟
Answer key ☟
Two alternative packages and are available for processing a database having records. Package
requires time units and package requires time units to process records.
What is the smallest value of for which package will be preferred over ?
A. B. C. D.
gatecse-2010 algorithms time-complexity easy
Answer key ☟
Consider the following pseudo code. What is the total number of multiplications to be performed?
D = 2
for i = 1 to n do
for j = i to n do
for k = j + 1 to n do
D = D * 3
Answer key ☟
Answer key ☟
An unordered list contains distinct elements. The number of comparisons to find an element in this list
that is neither maximum nor minimum is
A. B. C. D.
gatecse-2015-set2 algorithms time-complexity easy
Answer key ☟
1.55.24 Time Complexity: GATE CSE 2017 Set 2 | Question: 03
A.
B.
C.
D.
Answer key ☟
A. B.
C. D.
gatecse-2017-set2 algorithms time-complexity
Answer key ☟
A. B.
C. D.
gatecse-2019 algorithms time-complexity 2-marks
Answer key ☟
Given an integer array of size , we want to check if the array is sorted (in either ascending or
descending order). An algorithm solves this problem by making a single pass through the array and
comparing each element of the array only with its adjacent elements. The worst-case time complexity of this
algorithm is
Answer key ☟
Exponentiation is a heavily used operation in public key cryptography. Which of the following options
is the tightest upper bound on the number of multiplications required to compute
?
A. B.
D.
C.
Answer key ☟
Let be points in the -plane such that no three of them are collinear. For every pair of
points and , let be the line passing through them. Let be the line with the steepest gradient
among all lines.
The time complexity of the best algorithm for finding and is
A. B.
C. D.
gateit-2007 algorithms time-complexity normal
Answer key ☟
1.55.30 Time Complexity: GATE Overflow Test Series | Mock GATE | Test 4 | Question: 38
Which one of the following is the approximate value return by the above function?
A. B.
C. D.
go2025-mockgate-4 algorithms time-complexity
Answer key ☟
1.55.31 Time Complexity: GATE Overflow Test Series | Mock GATE | Test 4 | Question: 48
A contractor has to get completed a task of units. He assigns Mr. for this work. Further Mr.
divides this work into people because a person takes responsibility to do the work only if it is a single
unit of work, otherwise, he divides the work among people such that first one performs half of the work and
second person performs the one third of the work and the remaining work is being performed by the third
person. And, in assigning units of work to some persons, it costs rupees. The total expenditure to perform
the task will be
A. B.
C. D.
go2025-mockgate-4 algorithms time-complexity
Answer key ☟
1.55.32 Time Complexity: GATE Overflow Test Series | Mock GATE | Test 5 | Question: 42
A. B. C. D.
go2025-mockgate-5 algorithms time-complexity 2-marks
Answer key ☟
1.55.33 Time Complexity: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 30
Given an array of distinct elements, you have to design an algorithm that should return elements in
sorted order. The returned elements can be from any position in the given array. The least time
complexity of such an algorithm assuming comparison based sorting will be
A. B.
C. D.
go2025-mockgate-6 algorithms time-complexity 1-mark
Answer key ☟
The total number of function calls, time complexity and the return value of the following function
respectively are
int foo(int n)
{
int j,sum = 0,mycount=0;;
if(n <= 0) return 0;
sum += n + foo(n-1);
for(j = 0; j < n*n*n; j++)
mycount += j;
return sum < mycount? sum : mycount;
}
A. B.
C. D.
gate-suitability-test-1 time-complexity
1.55.35 Time Complexity: UGC NET CSE | December 2006 | Part 2 | Question: 21
Which algorithm has same average, worst case and best case time ?
A. Binary search B. Maximum of n number
C. Quick sort D. Fibonacci search
algorithms time-complexity ugcnetcse-dec2006-paper2
Answer key ☟
1.55.36 Time Complexity: UGC NET CSE | December 2010 | Part 2 | Question: 23
A. B. C. D.
ugcnetcse-dec2010-paper2 algorithms time-complexity
Answer key ☟
1.55.37 Time Complexity: UGC NET CSE | December 2012 | Part 3 | Question: 11
The time complexities of some standard graph algorithms are given. Match each algorithm with its time
complexity ? ( and are no. of nodes and edges respectively)
A. B.
C. D.
ugcnetcse-dec2012-paper3 algorithms time-complexity
Answer key ☟
1.55.38 Time Complexity: UGC NET CSE | December 2014 | Part 3 | Question: 32
A. B.
C. D.
ugcnetcse-dec2014-paper3 algorithms time-complexity
Answer key ☟
1.55.39 Time Complexity: UGC NET CSE | Junet 2015 | Part 3 | Question: 33
Answer key ☟
1.55.40 Time Complexity: UGC NET CSE | October 2020 | Part 2 | Question: 25
Answer key ☟
1.55.41 Time Complexity: UGC NET CSE | October 2020 | Part 2 | Question: 52
Answer key ☟
1.55.42 Time Complexity: UGC NET CSE | October 2022 | Part 1 | Question: 87
A.
B.
C.
D.
Answer key ☟
1.55.43 Time Complexity: UGC NET CSE | September 2013 | Part 2 | Question: 9
The amortized time complexity to perform ____ operation(s) in Splay trees is O(Ig n)
Answer key ☟
1.55.44 Time Complexity: UGC NET CSE | September 2013 | Part 3 | Question: 40
The time complexity of an efficient algorithm to find the longest monotonically increasing subsequence
of n numbers is
Answer key ☟
A. B. C. D.
gatecse-2007 algorithms graph-algorithms topological-sort easy
Answer key ☟
Answer key ☟
1.56.3 Topological Sort: GATE CSE 2016 Set 1 | Question: 11
The number of different topological orderings of the vertices of the graph is _____________.
Answer key ☟
Which of the following is/are valid vertex orderings that can be obtained from a topological sort of the DAG?
A. B.
C. D.
gate-ds-ai-2024 algorithms topological-sort directed-acyclic-graph
Answer key ☟
1.56.5 Topological Sort: GATE Overflow Test Series | Mock GATE | Test 3 | Question: 58
Answer key ☟
1.56.6 Topological Sort: UGC NET CSE | December 2005 | Part 2 | Question: 23
A. B. C. D.
ugcnetcse-dec2005-paper2 algorithms topological-sort
Answer key ☟
The number of disk pages access in B-tree search, where h is height, n is the number of keys and t is the
minimum degree, is
A. B.
C. D.
ugcnetcse-dec2015-paper2 algorithms tree
Answer key ☟
A. B.
C. D.
ugcnetcse-jan2017-paper3 algorithms tree
Answer key ☟
1.58.1 Tree Search Algorithm: UGC NET CSE | Junet 2015 | Part 3 | Question: 58
Answer key ☟
1.58.2 Tree Search Algorithm: UGC NET CSE | September 2013 | Part 3 | Question: 2
Answer key ☟
1.59.1 Tree Traversal: UGC NET CSE | Junet 2015 | Part 2 | Question: 4
A. B.
C. D.
ugcnetcse-june2015-paper2 tree tree-traversal
Answer key ☟
Answer Keys
1.0.1 C 1.0.2 Q-Q 1.0.3 Q-Q 1.0.4 Q-Q 1.0.5 D
1.0.6 A 1.0.7 A 1.0.8 D 1.0.9 C 1.0.10 B
1.1.1 C 1.2.1 N/A 1.2.2 N/A 1.2.3 B 1.2.4 C
1.2.5 12 1.2.6 29 1.2.7 A;C 1.2.8 B 1.3.1 N/A
1.3.2 N/A 1.3.3 C 1.3.4 A 1.3.5 B 1.3.6 A
1.3.7 C 1.3.8 C 1.3.9 C 1.3.10 Q-Q 1.4.1 B
1.5.1 C 1.6.1 C 1.6.2 D 1.7.1 C 1.7.2 C
1.8.1 A;B 1.8.2 B 1.8.3 X 1.8.4 D 1.8.5 B
1.8.6 A 1.8.7 C 1.8.8 D 1.8.9 A 1.8.10 C
1.8.11 C 1.8.12 D 1.8.13 B 1.8.14 D 1.8.15 A
1.8.16 A;C 1.8.17 A;D 1.8.18 A 1.8.19 D 1.8.20 A
1.8.21 D 1.8.22 B 1.8.23 B 1.8.24 X 1.8.25 C
1.8.26 B 1.8.27 B 1.8.28 B 1.8.29 D 1.9.1 Q-Q
1.9.2 C 1.10.1 B 1.10.2 C 1.10.3 X 1.11.1 A
1.12.1 B 1.12.2 A 1.13.1 B 1.14.1 Q-Q 1.14.2 Q-Q
1.14.3 Q-Q 1.14.4 C 1.15.1 N/A 1.16.1 C 1.17.1 B;C;D
1.17.2 A 1.17.3 D 1.17.4 C 1.18.1 N/A 1.18.2 B
1.18.3 D 1.18.4 A 1.18.5 D 1.18.6 D 1.18.7 C
A software program that infers and manipulates existing knowledge in order to generate new knowledge
is known as:
Answer key ☟
A perceptron has input weights and with threshold value What output
does it give for the input and
A. B. C. D.
ugcnetcse-july2016-paper3
Answer key ☟
A. B.
C. D.
gate-ds-ai-2024 artificial-intelligence
Answer key ☟
2.1.2 Artificial Intelligence: UGC NET CSE | December 2013 | Part 3 | Question: 26
The mean-end analysis process centers around the detection of differences between the current state and
goal state. Once such a difference is isolated, an operator that can reduce the difference must be found.
But perhaps that operator cannot be applied to the current state. So a sub-problem of getting to a state in which
it can be applied is set up. The kind of backward chaining in which operators are selected and then sub goals are
set up to establish the precondition of operators is called
Answer key ☟
2.1.3 Artificial Intelligence: UGC NET CSE | December 2014 | Part 3 | Question: 72
Match the following learning modes . characteristics of available information for learning :
a. Supervised i. Instructive information on desired responses, explicitly specified by a teacher.
b. Recording ii. A priori design information for memory storing
c. iii. Partial information about desired responses, or only “right” or “wrong” evaluative
Reinforcement information
d.
Unsupervised iv. No information about desired responses
Codes :
a b c d
A. i ii iii iv
B. i iii ii iv
C. ii iv iii i
D. ii iii iv i
Answer key ☟
2.1.4 Artificial Intelligence: UGC NET CSE | December 2015 | Part 3 | Question: 46
Answer key ☟
2.1.5 Artificial Intelligence: UGC NET CSE | December 2015 | Part 3 | Question: 64
Consider the two class classification task that consists of the following points:
Class
Class
The decision boundary between the two classes and using single perception is given by:
A. B.
C. D.
ugcnetcse-dec2015-paper3 artificial-intelligence
Answer key ☟
2.1.6 Artificial Intelligence: UGC NET CSE | January 2017 | Part 3 | Question: 55
Consider following two rules and in logical reasoning in Artificial Intelligence (AI):
From is known as Modulus Tollens (MT)
From is known as Modus Ponens(MP)
Answer key ☟
2.1.7 Artificial Intelligence: UGC NET CSE | July 2018 | Part 2 | Question: 71
Answer key ☟
2.1.8 Artificial Intelligence: UGC NET CSE | July 2018 | Part 2 | Question: 72
In artificial Intelligence (AI), a simple reflex agent selects actions on the basis of ___
ugcnetcse-july2018-paper2 artificial-intelligence
Answer key ☟
2.1.9 Artificial Intelligence: UGC NET CSE | July 2018 | Part 2 | Question: 73
A. B.
C. D.
ugcnetcse-july2018-paper2 artificial-intelligence
Answer key ☟
2.1.10 Artificial Intelligence: UGC NET CSE | July 2018 | Part 2 | Question: 74
Consider following sentences regarding , an informed search strategy in Artificial Intelligence (AI).
Here, is the cost of the optimal solution path. Which of the following is correct with respect to the above
statements?
ugcnetcse-july2018-paper2 artificial-intelligence
Answer key ☟
2.1.11 Artificial Intelligence: UGC NET CSE | June 2012 | Part 3 | Question: 2
2.1.12 Artificial Intelligence: UGC NET CSE | June 2012 | Part 3 | Question: 21
algorithm uses to estimate the cost of getting from the initial state to the goal state,
where is a measure of cost getting from initial state to the current node and the function is an
estimate of the cost of getting from the current node to the goal state. To find a path involving the fewest
number of steps, we should test,
A. B. C. D.
ugcnetcse-june2012-paper3 artificial-intelligence
Answer key ☟
2.1.13 Artificial Intelligence: UGC NET CSE | June 2014 | Part 3 | Question: 28
A. B.
C. D.
ugcnetjune2014iii artificial-intelligence
Answer key ☟
2.1.14 Artificial Intelligence: UGC NET CSE | June 2014 | Part 3 | Question: 30
Answer key ☟
2.1.15 Artificial Intelligence: UGC NET CSE | Junet 2015 | Part 3 | Question: 23
ugcnetcse-june2015-paper3 artificial-intelligence
Answer key ☟
2.1.16 Artificial Intelligence: UGC NET CSE | Junet 2015 | Part 3 | Question: 56
Answer key ☟
2.1.17 Artificial Intelligence: UGC NET CSE | Junet 2015 | Part 3 | Question: 59
A. B.
C. D.
ugcnetcse-june2015-paper3 artificial-intelligence
Answer key ☟
2.1.18 Artificial Intelligence: UGC NET CSE | October 2020 | Part 2 | Question: 36
Answer key ☟
2.2.1 Artificial Neural Network: UGC NET CSE | December 2013 | Part 3 | Question: 30
Answer key ☟
2.3.1 Back Propagation: UGC NET CSE | December 2012 | Part 2 | Question: 46
Back propagation is a learning technique that adjusts weights in the neutral network by propagating
weight changes.
Answer key ☟
2.4.1 Blocks World Problem: UGC NET CSE | September 2013 | Part 3 | Question: 5
Answer key ☟
Forward chaining systems are ____ where as backward chaining systems are ____
Answer key ☟
2.6.1 Expert System: UGC NET CSE | December 2012 | Part 3 | Question: 67
Answer key ☟
2.6.2 Expert System: UGC NET CSE | December 2015 | Part 3 | Question: 45
Answer key ☟
2.7.1 Fuzzy Logic: UGC NET CSE | June 2019 | Part 2 | Question: 94
A fuzzy conjunction operator denoted as and a fuzzy disjunction operator denoted as form
a dual pair if they satisfy the condition:
A. B.
C. D.
ugcnetcse-june2019-paper2 artificial-intelligence fuzzy-logic
Answer key ☟
2.8.1 Genetic Algorithms: UGC NET CSE | June 2019 | Part 2 | Question: 97
i. Evolution
ii. Selection
iii. Reproduction
iv. Mutation
Answer key ☟
2.9.1 Heuristic Search: UGC NET CSE | December 2013 | Part 3 | Question: 25
If h* represents an estimate from the cost of getting from the current node N to the goal node and h
represents actual cost of getting from the current node to the goal node, then A* algorithm gives an
optimal solution if
A. h* is equal to h B. h* overestimates h
C. h* underestimates h D. none of these
ugcnetcse-dec2013-paper3 artificial-intelligence heuristic-search
Answer key ☟
2.10.1 Linear Programming: UGC NET CSE | September 2013 | Part 3 | Question: 13
If an artificial variable is present in the ‘basic variable’ of optimal simplex table then the solution is
Answer key ☟
2.11 Machine Learning (2)
2.11.1 Machine Learning: UGC NET CSE | December 2012 | Part 3 | Question: 73
ugcnetcse-dec2012-paper3 machine-learning
Answer key ☟
2.11.2 Machine Learning: UGC NET CSE | June 2014 | Part 3 | Question: 09
Perceptron learning, Delta learning and learning are learning methods which falls under the
category of
ugcnetjune2014iii machine-learning
Answer key ☟
2.12.1 Map Coloring: UGC NET CSE | June 2013 | Part 3 | Question: 71
The map colouring problem can be solved using which of the following technique?
Answer key ☟
2.13.1 Means End: UGC NET CSE | September 2013 | Part 3 | Question: 6
Means-Ends Analysis process centres around the detection of difference between the current state and
the goal state. Once such a difference is found, then to reduce the difference one applies
A. a forward search that can reduce the difference
B. a backward search that can reduce the difference
C. a bidirectional search that can reduce the difference
D. an operator that can reduce the difference
Answer key ☟
2.14.1 Minimax Procedure: UGC NET CSE | June 2019 | Part 2 | Question: 91
Here and represents MIN and MAX nodes respectively. The value of the root node of the game tree is
A. B. C. D.
ugcnetcse-june2019-paper2 artificial-intelligence minimax-procedure
Answer key ☟
2.15.1 Neural Network: UGC NET CSE | December 2012 | Part 3 | Question: 9
You are given an OR problem and XOR problem to solve. Then, which one of the following statements
is true?
A. Both OR and XOR problems can be solved using single layer perception
B. OR can be solved using single layer perception and XOR problem can be solved using self organizing maps
C. OR problem can be solved using radial basis function and XOR problem can be solved using single layer
perception
D. OR can be solved using single layer perception and XOR problem can be solved using radial basis function
Answer key ☟
2.15.2 Neural Network: UGC NET CSE | June 2019 | Part 2 | Question: 98
Answer key ☟
2.15.3 Neural Network: UGC NET CSE | September 2013 | Part 3 | Question: 28
A. B.
C. D.
ugcnetcse-sep2013-paper3 neural-network machine-learning
Answer key ☟
a. The planning graph data structure can be used to give a better heuristic for a planning problem
b. Dropping negative effects from every action schema in a planning problem results in a relaxed problem
ugcnetcse-july2018-paper2 planning
Answer key ☟
Which one of the following is the correct implementation of the meta-predicate “not” in PROLOG (Here
G represents a goal)?
Answer key ☟
2.18 Reinforcement Learning (1)
2.18.1 Reinforcement Learning: UGC NET CSE | June 2019 | Part 2 | Question: 100
Reinforcement learning can be formalized in terms of ____ in which the agent initially only knows the
set of possible _____ and the set of possible actions.
Answer key ☟
Answer key ☟
2.20.1 Sigmoid Function: UGC NET CSE | June 2019 | Part 2 | Question: 99
A. B. C. D.
ugcnetcse-june2019-paper2 artificial-intelligence sigmoid-function
Answer key ☟
A. a feature-centric representation
B. an action-centric representation
C. a combination of feature-centric and action-centric representations
D. a hierarchical feature-centric representation
ugcnetcse-june2019-paper2 artificial-intelligence strips
Answer key ☟
Answer Keys
2.0.1 C 2.0.2 C 2.1.1 D 2.1.2 C 2.1.3 A
2.1.4 C 2.1.5 B 2.1.6 D 2.1.7 B 2.1.8 Q-Q
2.1.9 Q-Q 2.1.10 Q-Q 2.1.11 B 2.1.12 A 2.1.13 D
2.1.14 B 2.1.15 B 2.1.16 A 2.1.17 B 2.1.18 D
2.2.1 D 2.3.1 B 2.4.1 B 2.5.1 D 2.6.1 A
2.6.2 B 2.7.1 C 2.8.1 C 2.9.1 C 2.10.1 B
2.11.1 D 2.11.2 A 2.12.1 B 2.13.1 D 2.14.1 B
2.15.1 D 2.15.2 D 2.15.3 C 2.16.1 Q-Q 2.17.1 B
2.17.2 C 2.18.1 C 2.19.1 D 2.20.1 B 2.21.1 B
3 Discrete Mathematics: Mathematical Logic (128)
Which of the following shall be a compound proposition involving the propositions p, q and r, that is
true when exactly two of the p, q and r are true and is false otherwise?
A.
B.
C.
D.
ugcnetcse-june2013-paper2
Answer key ☟
A. True and False B. False and True C. False and False D. True and True
ugcnetcse-june2013-paper2
Answer key ☟
The tracing model in Prolog describes program execution in terms of certain events. These events are
i. "If Gora gets the job and works hard, then he will be promoted. if Gora gets promotion, then he will be
happy. He will not be happy, therefore, either he will not get the job or he will not work hard."
ii. "Either Puneet is not guilty or Pankaj is telling the truth. Pankaj is not telling the truth, therefore, Puneet is
not guilty."
iii. If is a real number such that , then . Suppose that , then .
A. i and iii B. ii and iii C. i,ii, and iii D. i and ii
ugcnetcse-dec2015-paper2 discrete-mathematics mathematical-logic
Answer key ☟
________ predicate calculus allows quantified variables to refer to objects in the domain of discourse
and not to predicates or functions.
A. Zero-order B. First-order
C. Second-order D. High-order
ugcnetjune2014iii discrete-mathematics mathematical-logic
Answer key ☟
"If my computations are correct and I pay the electric bill, then I will run out of money. If I don't pay the
electric bill, the power will be turned off. Therefore, If I don't run out of money and the power is still on
then my computations are incorrect."
Convert this argument into logical notations using the variables for propositions of computations,
electric bills, out of money and the power respectively. (Where means NOT).
A.
B.
C.
D.
ugcnetcse-june2015-paper2 mathematical-logic
Answer key ☟
is
A. B.
C. D.
ugcnetcse-dec2014-paper3 mathematical-logic
Answer key ☟
A. B.
C. D.
ugcnetcse-dec2014-paper3 mathematical-logic
Answer key ☟
A.
B.
C.
D.
ugcnetcse-june2015-paper3 mathematical-logic
Answer key ☟
Let P(m,n) be the statement "m divides n" where the universe of discourse for both the variable is the set
of positive integers. Determine the truth values of each of the following propositions:
i. ,
ii.
iii.
A. a-True, b-True, c-False
B. a-True, b-False, c-False
C. a-False, b-False, c-False
D. a-True, b-True, c-True
Answer key ☟
i.
ii.
iii.
Answer key ☟
A. B.
C. D.
ugcnetcse-june2011-paper2 discrete-mathematics mathematical-logic
Answer key ☟
A. B.
C. D.
ugcnetcse-nov2017-paper2 discrete-mathematics mathematical-logic
Answer key ☟
Match List-I with List-II and choose the correct answer from the code given below :
Answer key ☟
Codes:
ugcnetjan2017ii mathematical-logic
Answer key ☟
Answer key ☟
3.1 Clausal Form (2)
Answer key ☟
Show using resolution principle that the well-formed formula, given above, cannot be satisfied for any
interpretation.
Answer key ☟
3.2.1 Combinatory: GATE Overflow Test Series | Mock GATE | Test 1 | Question: 27
Suppose of all the possible ways to choose two representative among players in a team, there are
exactly different ways to choose one or more female as a representative. The number of different
males in the team is _________
go2025-mockgate-1 numerical-answers combinatory discrete-mathematics
Answer key ☟
3.3.1 Countable Uncountable Set: UGC NET CSE | December 2015 | Part 2 | Question: 3
Answer key ☟
Symbolize the expression "Every mother loves her children" in predicate logic.
gate1989 descriptive first-order-logic mathematical-logic
Answer key ☟
Answer key ☟
A.
B.
C.
D.
Answer key ☟
Which of the following is a valid first order formula? (Here and are first order formulae with as
their only free variable)
A.
B.
C.
D.
Answer key ☟
3.4.5 First Order Logic: GATE CSE 2003 | Question: 33
Answer key ☟
3.4.6 First Order Logic: GATE CSE 2004 | Question: 23, ISRO2007-32
Identify the correct translation into logical notation of the following assertion.
Some boys in the class are taller than all the girls
A.
B.
C.
D.
Answer key ☟
What is the first order predicate calculus statement equivalent to the following?
A.
B.
C.
D.
Answer key ☟
3.4.8 First Order Logic: GATE CSE 2006 | Question: 26
Which one of the first order predicate calculus statements given below correctly expresses the following
English statement?
A.
B.
C.
D.
Answer key ☟
A. B.
C. D.
gatecse-2007 mathematical-logic easy first-order-logic
Answer key ☟
Let and be two predicates such that means is a finite state automaton and
means that is a pushdown automaton. Let be another predicate such that
means and are equivalent. Which of the following first order logic statements represent the following?
A.
B.
C.
D.
Answer key ☟
Which one of the following is the most appropriate logical formula to represent the statement?
"Gold and silver ornaments are precious".
The following notations are used:
is a gold ornament
is a silver ornament
is precious
A. B.
C. D.
gatecse-2009 mathematical-logic easy first-order-logic
Answer key ☟
I.
II.
III.
IV.
Answer key ☟
Suppose the predicate is used to represent the statement that person can fool person at
time .
Which one of the statements below expresses best the meaning of the formula,
Answer key ☟
Which one of the following options is CORRECT given three positive integers and , and a
predicate
Answer key ☟
What is the correct translation of the following statement into mathematical logic?
Answer key ☟
A. B.
C. D.
gatecse-2013 mathematical-logic easy first-order-logic
Answer key ☟
A. B.
C. D.
mathematical-logic normal marks-to-all gatecse-2013 first-order-logic
Answer key ☟
Predicate glitters is true if glitters and predicate gold is true if is gold. Which one of the following
logical formulae represents the above statement?
A.
B.
C.
D.
Answer key ☟
The CORRECT formula for the sentence, "not all Rainy days are Cold" is
A. B.
C. D.
gatecse-2014-set3 mathematical-logic easy first-order-logic
Answer key ☟
A.
B.
C.
D.
Answer key ☟
Which one of the following well-formed formulae in predicate calculus is NOT valid ?
A.
B.
C.
D.
Answer key ☟
Consider the first-order logic sentence . Assuming non-empty logical domains, which
of the sentences below are implied by ?
I.
II.
III.
IV.
Answer key ☟
where is a quantifier-free first-order logic formula using only predicate symbols, and
possibly equality, but no function symbols. Suppose has a model with a universe containing elements.
Which one of the following statements is necessarily true?
A. There exists at least one model of with universe of size less than or equal to
B. There exists no model of with universe of size less than or equal to
C. There exists no model of with universe size of greater than
D. Every model of has a universe of size equal to
Answer key ☟
Answer key ☟
A.
B.
C.
D.
Answer key ☟
where is a statement about integers, and is a statement about pairs of integers. Which of the following (one
or more) option(s) would imply Geetha's conjecture?
A.
B.
C.
D.
Answer key ☟
Let and be three statements with variables and chosen from some universe.
Consider the following statement:
A.
B.
C.
D.
Answer key ☟
Let and be arbitrary predicates. Which of the following statements is always TRUE?
A.
B.
C.
D.
Answer key ☟
Consider the following first order logic formula in which is a binary relation symbol.
The formula is
Answer key ☟
A.
B.
C.
D.
Answer key ☟
Which of the following first order formulae is logically valid? Here is a first order formula with
as a free variable, and is a first order formula with no free variable.
A.
B.
C.
D.
A.
B.
C.
D.
Answer key ☟
3.4.33 First Order Logic: GATE Overflow Test Series | Mock GATE | Test 1 | Question: 31
Which of the following is the correct first order logic representation for the below sentence?
A.
B.
C.
D.
Answer key ☟
3.4.34 First Order Logic: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 65
Which of the following is/are correct formalization of the sentence? (Mark all the appropriate choices)
" Every student will do well in some examination"
Here, means student will do well in examination
A.
B.
C.
D.
Answer key ☟
3.4.35 First Order Logic: GATE Overflow Test Series | Mock GATE | Test 3 | Question: 30
Which of the following is the correct first order logic representation for the sentence
A.
B.
C.
D.
Answer key ☟
3.4.36 First Order Logic: GATE Overflow Test Series | Mock GATE | Test 4 | Question: 29
A.
B.
C.
D. None of the above
Answer key ☟
3.4.37 First Order Logic: UGC NET CSE | January 2017 | Part 3 | Question: 60
The first order logic (FOL) statement is equivalent to which of the following?
A.
B.
C.
D.
Answer key ☟
3.4.38 First Order Logic: UGC NET CSE | July 2018 | Part 2 | Question: 77
A. It is syntactically valid but does not express the meaning of the English sentence
B. It is syntactically valid and expresses the meaning of the English sentence also
C. It is syntactically invalid but expresses the meaning of the English sentence
D. It is syntactically invalid and does not express the meaning of the English sentence
Answer key ☟
3.4.39 First Order Logic: UGC NET CSE | June 2013 | Part 3 | Question: 69
If we convert
to .
This process is known as
A. Simplification
B. Unification
C. Skolemization
D. Resolution
Answer key ☟
3.4.40 First Order Logic: UGC NET CSE | June 2014 | Part 2 | Question: 19
The notation denotes the proposition “there exists a unique such that is true”. Give the
truth values of the following statements :
I.
II.
Answer key ☟
3.4.41 First Order Logic: UGC NET CSE | September 2013 | Part 3 | Question: 1
Which of the following is a correct predicate logic statement for “Every Natural number has one
successor”?
A.
B.
C.
D.
first-order-logic ugcnetcse-sep2013-paper3
Answer key ☟
A. B.
C. D.
ugcnetcse-july2018-paper2 discrete-mathematics functions
Answer key ☟
3.6.1 Group Theory: UGC NET CSE | December 2015 | Part 2 | Question: 10
Which of the following property/ies a Group G must hold, in order to be an Abelian group?
i. The distributive property
ii. The commutative property
iii. The symmetric property
A. i and ii B. ii and iii C. i only D. ii only
ugcnetcse-dec2015-paper2 discrete-mathematics set-theory&algebra group-theory
Answer key ☟
Answer key ☟
Which one of the following statements follows from and as per sound inference rules of logic?
Answer key ☟
In a room there are only two types of people, namely and . people always tell the
truth and 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?
Answer key ☟
How many atoms are matched to the variable 'X' before the query father(X, Jane) reports a Result?
A. B. C. D.
ugcnetcse-dec2015-paper3 mathematical-logic prolog non-gatecse
Answer key ☟
Answer key ☟
Answer key ☟
A. B.
C. D.
gate1989 normal mathematical-logic propositional-logic multiple-selects
Answer key ☟
3.9.4 Propositional Logic: GATE CSE 1990 | Question: 3-x
A.
B.
C.
D.
Answer key ☟
Answer key ☟
A. B.
C. D.
gate1992 mathematical-logic easy propositional-logic multiple-selects
Answer key ☟
Use Modus ponens or resolution to show that the following set is inconsistent:
1.
2.
3.
4.
where and are universally quantified variables, is a constant and are monadic predicates.
Answer key ☟
Answer key ☟
3.9.9 Propositional Logic: GATE CSE 1993 | Question: 8.2
Answer key ☟
Let and be propositions. Using only the Truth Table, decide whether
is True or False.
Answer key ☟
Obtain the principal (canonical) conjunctive normal form of the propositional formula
Answer key ☟
If the proposition is true, then the truth value of the proposition , where is
negation, is inclusive OR and is implication, is
Answer key ☟
A.
B.
C.
D.
Answer key ☟
3.9.14 Propositional Logic: GATE CSE 1997 | Question: 3.2
A. B.
C. D.
gate1997 mathematical-logic easy propositional-logic
Answer key ☟
Answer key ☟
Answer key ☟
Let be propositions. Assume that the equivalence and hold. Then the truth-
value of the formula is always
A. True B. False
C. Same as the truth-value of D. Same as the truth-value of
gatecse-2000 mathematical-logic normal propositional-logic
Answer key ☟
Answer key ☟
"If then unless " is represented by which of the following formulas in propositional logic? (" " is
negation, " " is conjunction, and " " is implication)
A. B.
C. D.
gatecse-2002 mathematical-logic normal propositional-logic
Answer key ☟
Determine whether each of the following is a tautology, a contradiction, or neither (" " is disjunction, "
" is conjunction, " " is implication, " " is negation, and " " is biconditional (if and only if).
1.
2.
3.
Answer key ☟
A. is logically valid
B. is logically valid
C. is satisfiable if and only if is satisfiable
D. if and only if both and are unsatisfiable
Answer key ☟
Answer key ☟
Let and be three atomic propositional assertions. Let denote and denote
Which one of the following is a tautology?
A. B. C. D.
gatecse-2005 mathematical-logic propositional-logic normal
Answer key ☟
Answer key ☟
and are two propositions. Which of the following logical expressions are equivalent?
I.
II.
III.
IV.
Answer key ☟
A. B.
C. D.
gatecse-2009 mathematical-logic easy propositional-logic
Answer key ☟
Which one of the following propositional logic formulas is TRUE when exactly two of and are
TRUE?
A.
B.
C.
D.
Answer key ☟
Answer key ☟
L: P implies Q
M: Q implies P
N: P is equivalent to Q
Answer key ☟
A.
B.
C.
D.
Answer key ☟
is a composite number.
is a perfect square.
is a prime number.
Answer key ☟
3.9.32 Propositional Logic: GATE CSE 2016 Set 2 | Question: 01
i.
ii.
iii.
iv.
v.
The number of expressions given above that are logically implied by is ___________.
Answer key ☟
I.
II.
III.
IV.
Answer key ☟
Let , and be propositions and the expression be a contradiction. Then, the expression
is
A. a tautology B. a contradiction
C. always TRUE when is FALSE D. always TRUE when is TRUE
gatecse-2017-set1 mathematical-logic propositional-logic
Answer key ☟
Let denote the statements ” It is raining”, “It is cold”, and “It is pleasant”, respectively. Then the
statement “It is not raining and it is pleasant, and it is not pleasant only if it is raining and it is cold ” is
represented by
A. B.
C. D.
gatecse-2017-set2 mathematical-logic propositional-logic
Answer key ☟
Let and be two propositions. Consider the following two formulae in propositional logic.
Answer key ☟
Choose the correct choice(s) regarding the following proportional logic assertion :
Answer key ☟
Consider the statement: " Fail grade cannot be given when student scores more than marks."
Which one of the following is the CORRECT representation of the above statement in propositional logic?
A. B.
C. D.
gatecse2024-set2 mathematical-logic propositional-logic
Answer key ☟
Let and be two propositions. Which of the following statements is a tautology /are tautologies?
A.
B.
C.
D.
Answer key ☟
Answer key ☟
3.9.41 Propositional Logic: GATE Overflow Test Series | Mock GATE | Test 1 | Question: 30
Which of the following is/are well formed propositional formulae? (Mark all the appropriate choices)
A. B.
C. D.
go2025-mockgate-1 propositional-logic multiple-selects mathematical-logic
Answer key ☟
3.9.42 Propositional Logic: GATE Overflow Test Series | Mock GATE | Test 4 | Question: 23
Meera, Priya and David are three students that took the Logic exam. Let's consider a propositional
language where represents “Meera passed the exam”, represents “Priya passed the exam”,and
represents "David passed the exam".
Which of the following is the formal representation of the sentence “Exactly one, among Meera, Priya and
David, passed the exam”?
A.
B.
C.
D. None of the above
Answer key ☟
3.9.43 Propositional Logic: GATE Overflow Test Series | Mock GATE | Test 5 | Question: 28
Anjana, Chandani, and Pooja are three students that took the Logic exam. Let’s consider a propositional
language where represents “Anjana passed the exam”, represents “Chandani passed the exam” and
represents "Pooja passed the exam".
Which of the following is the formal representation of the sentence “At least two among Anjana, Chandani and
Pooja passed the exam”?
A.
B.
C.
D. None of the above
Answer key ☟
3.9.44 Propositional Logic: GATE Overflow Test Series | Mock GATE | Test 5 | Question: 58
Several friends are planning a road trip. If Biden goes on the road trip, then Neilia goes on the road trip.
If Neilia does not go on the road trip, then Trump does not go on the road trip. Which of the following
statements must be TRUE? (Mark all the appropriate choices)
A. If Trump goes on the road trip, then Biden goes on the road trip.
B. Biden does not go on the road trip, if Neilia does not go on the road trip.
C. If Trump goes on the road trip, then Neilia goes on the road trip.
D. If Biden goes on the road trip, then Trump goes on the road trip.
Answer key ☟
3.9.45 Propositional Logic: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 11
Which of the following is NOT a valid conclusion? (Mark all the appropriate choices)
Answer key ☟
3.9.46 Propositional Logic: UGC NET CSE | December 2006 | Part 2 | Question: 2
A. B. C. D.
Answer key ☟
3.9.47 Propositional Logic: UGC NET CSE | December 2013 | Part 2 | Question: 34
Let P(m,n) be the statement "m divides n" where the universe of discourse for both the variable is the set
of positive integers. Determine the truth values of each of the following propositions:
I. ,
II.
A. Both I and II are true B. Both I and II are false
C. I-false & II-true D. I-true& II-false
ugcnetcse-dec2013-paper2 discrete-mathematics propositional-logic
Answer key ☟
3.9.48 Propositional Logic: UGC NET CSE | December 2015 | Part 3 | Question: 44
A. B.
C. D.
ugcnetcse-dec2015-paper3 propositional-logic mathematical-logic
Answer key ☟
3.9.49 Propositional Logic: UGC NET CSE | January 2017 | Part 2 | Question: 6
is the premise :
A. B. C. D.
ugcnetjan2017ii discrete-mathematics propositional-logic
Answer key ☟
3.9.50 Propositional Logic: UGC NET CSE | January 2017 | Part 3 | Question: 59
Answer key ☟
3.9.51 Propositional Logic: UGC NET CSE | June 2009 | Part 2 | Question: 25
A.
B.
C.
D. None
ugcnetcse-june2009-paper2 propositional-logic
Answer key ☟
3.9.52 Propositional Logic: UGC NET CSE | June 2014 | Part 2 | Question: 20
Give a compound proposition involving propositions and that is true when exactly two of and
are true and is false otherwise
A.
B.
C.
D.
Answer key ☟
3.9.53 Propositional Logic: UGC NET CSE | June 2019 | Part 2 | Question: 6
A. B.
C. D.
ugcnetcse-june2019-paper2 propositional-logic
Answer key ☟
3.9.54 Propositional Logic: UGC NET CSE | June 2019 | Part 2 | Question: 8
ugcnetcse-june2019-paper2 propositional-logic
Answer key ☟
3.9.55 Propositional Logic: UGC NET CSE | Junet 2015 | Part 2 | Question: 10
Answer key ☟
3.9.56 Propositional Logic: UGC NET CSE | Junet 2015 | Part 2 | Question: 9
A. B.
C. D.
ugcnetcse-june2015-paper2 mathematical-logic propositional-logic
Answer key ☟
3.9.57 Propositional Logic: UGC NET CSE | October 2020 | Part 2 | Question: 61
i.
ii.
iii.
iv.
Answer key ☟
3.9.58 Propositional Logic: UGC NET CSE | October 2022 | Part 1 | Question: 85
Consider as logical variables. Identify which of the following represents correct logical
equivalence :
(A)
(B)
(C)
(D)
Choose the correct answer from the options given below :
A. (A) and (D) only B. (B) and (C) only, C. (A) and (C) only D. (B) and (D) only
ugcnetcse-oct2022-paper1 propositional-logic
3.9.59 Propositional Logic: UGC NET CSE | September 2013 | Part 2 | Question: 24
The quantification denotes the proposition “There exists a unique x such that P(x) is true”,
express he quantification using universal and existential quantifications and logical operators?
A.
B.
C.
D.
Answer key ☟
i. Reflexive
ii. Antisymmetric
iii. Symmetric
Answer key ☟
Answer Keys
3.0.1 C 3.0.2 D 3.0.3 D 3.0.4 B 3.0.5 B
3.0.6 A 3.0.7 C 3.0.8 B 3.0.9 A 3.0.10 A
3.0.11 X 3.0.12 Q-Q 3.0.13 A;B 3.0.14 D 3.0.15 A
3.0.16 A 3.0.17 C 3.1.1 N/A 3.1.2 N/A 3.2.1 7
3.3.1 D 3.4.1 N/A 3.4.2 N/A 3.4.3 A 3.4.4 D
3.4.5 D 3.4.6 D 3.4.7 B 3.4.8 D 3.4.9 D
3.4.10 X 3.4.11 D 3.4.12 B 3.4.13 B 3.4.14 A
3.4.15 C 3.4.16 D 3.4.17 X 3.4.18 D 3.4.19 D
3.4.20 C 3.4.21 D 3.4.22 B 3.4.23 A 3.4.24 C
3.4.25 C 3.4.26 B;C 3.4.27 C 3.4.28 B 3.4.29 B
3.4.30 A 3.4.31 C 3.4.32 D 3.4.33 A;B 3.4.34 A
3.4.35 A;D 3.4.36 C 3.4.37 B 3.4.38 A 3.4.39 C
3.4.40 A 3.4.41 A 3.5.1 Q-Q 3.6.1 D 3.7.1 B
3.7.2 C 3.7.3 A 3.8.1 A 3.9.1 N/A 3.9.2 N/A
3.9.3 A;B;C 3.9.4 A 3.9.5 B 3.9.6 B 3.9.7 N/A
3.9.8 N/A 3.9.9 B 3.9.10 True 3.9.11 N/A 3.9.12 D
3.9.13 D 3.9.14 C 3.9.15 A 3.9.16 N/A 3.9.17 A
3.9.18 A 3.9.19 A 3.9.20 N/A 3.9.21 B 3.9.22 A
3.9.23 B 3.9.24 D 3.9.25 B 3.9.26 B 3.9.27 B
3.9.28 B 3.9.29 D 3.9.30 C 3.9.31 11 3.9.32 4
3.9.33 D 3.9.34 D 3.9.35 A 3.9.36 B 3.9.37 B;D
3.9.38 A 3.9.39 B;C;D 3.9.40 C 3.9.41 B;D 3.9.42 A
3.9.43 D 3.9.44 B;C 3.9.45 A;B;C;D 3.9.46 Q-Q 3.9.47 C
3.9.48 B;C 3.9.49 A;B;C;D 3.9.50 B 3.9.51 Q-Q 3.9.52 D
3.9.53 A 3.9.54 D 3.9.55 C 3.9.56 A 3.9.57 D
3.9.58 Q-Q 3.9.59 C 3.10.1 D
4 Engineering Mathematics: Calculus (66)
Answer key ☟
Find the values for the constants , , and so that is continuous and differentiable everywhere on the real
line.
gate1996 calculus continuity differentiation normal descriptive
Answer key ☟
Answer key ☟
Answer key ☟
B.
C.
D.
Answer key ☟
Answer key ☟
Let and denote the area of region bounded by and the X-axis, when varies from
to . Which of the following statements is/are TRUE?
I. is continuous in
II. is not bounded in
III. is nonzero and finite
Answer key ☟
Answer key ☟
The function
Answer key ☟
A. B.
C. D.
Answer key ☟
is: _____________
gate1993 calculus convergence normal out-of-gatecse-syllabus fill-in-the-blanks
Answer key ☟
A. B. C. D.
gatecse2024-set2 calculus definite-integral
Answer key ☟
4.3.3 Definite Integral: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 31
A. B. C. D.
go2025-mockgate-6 calculus definite-integral 1-mark
Answer key ☟
A. linear
B. non- linear
C. homogeneous
D. of degree two
Answer key ☟
The formula used to compute an approximation for the second derivative of a function at a point is
A. B.
C. D.
Answer key ☟
Answer key ☟
Answer key ☟
Answer key ☟
Answer key ☟
A. B. C. D.
gatecse2024-set1 calculus differentiation
Answer key ☟
A. B. C. D.
go-mockgate-1 limits calculus
Answer key ☟
Answer key ☟
a. Find the points of local maxima and minima, if any, of the following function defined in .
b. Integrate
Answer key ☟
Let , and .
Which of the following statements is true?
A. B.
C. and D.
gatecse-2000 calculus integration normal
Answer key ☟
A. B. C. D.
gatecse-2009 calculus integration normal
Answer key ☟
A. B. C. D.
gatecse-2011 calculus integration normal
Answer key ☟
Answer key ☟
Answer key ☟
Answer key ☟
A. B.
C. D.
gatecse-2015-set3 calculus integration normal
Answer key ☟
Answer key ☟
A. B. C. D.
gateit-2005 calculus integration normal
Answer key ☟
4.7.12 Integration: GATE Overflow Test Series | Mock GATE | Test 1 | Question: 12
A. B.
C. D.
go2025-mockgate-1 integration calculus
Answer key ☟
is __________
Answer key ☟
Answer key ☟
equals
A. B. C. D.
gatecse-2008 calculus limits easy
Answer key ☟
A. B. C. D.
gatecse-2010 calculus limits normal
Answer key ☟
is
A. B. C. D. Not defined
gatecse-2015-set1 calculus limits normal
Answer key ☟
The value of is
A. B. C. D.
gatecse-2015-set3 calculus limits normal
Answer key ☟
Answer key ☟
The value of
Answer key ☟
Compute
A. B.
C. D. Limit does not exist
gatecse-2019 engineering-mathematics calculus limits 1-mark
Answer key ☟
Answer key ☟
4.8.11 Limits: GATE CSE 2022 | Question: 24
Answer key ☟
Answer key ☟
4.8.13 Limits: GATE Data Science and Artificial Intelligence 2024 | Sample Paper | Question: 5
A. B. C. D.
gateda-sample-paper-2024 limits
Answer key ☟
If then
Answer key ☟
Answer key ☟
4.9.3 Maxima Minima: GATE CSE 1995 | Question: 25a
Answer key ☟
A. 6 B. 10 C. 12 D. 5.5
gate1997 calculus maxima-minima normal
Answer key ☟
A point on a curve is said to be an extremum if it is a local minimum or a local maximum. The number
of distinct extrema for the curve is
A. B. C. D.
gatecse-2008 calculus maxima-minima easy
Answer key ☟
Consider the function in the interval . The number and location(s) of the
local minima of this function are
A. One, at B. One, at
Answer key ☟
A. B. C. D.
gatecse-2015-set2 set-theory&algebra functions normal maxima-minima
Answer key ☟
I.
II.
III.
Answer key ☟
Let
be a real-valued function.
Which of the following statements is/are
Answer key ☟
Answer key ☟
A. B. C. D.
gateit-2008 calculus maxima-minima normal
Answer key ☟
4.9.12 Maxima Minima: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 18
A. B. C. D.
go2025-mockgate-2 maxima-minima multiple-selects
Answer key ☟
4.9.13 Maxima Minima: GATE Overflow Test Series | Mock GATE | Test 4 | Question: 21
occurs at
A. B. C. D.
go2025-mockgate-4 maxima-minima calculus
Answer key ☟
A. B. C. D.
gate1993 calculus normal out-of-gatecse-syllabus multiple-selects
Answer key ☟
Answer key ☟
Given and the surface of a unit cube with one corner at the origin
and edges parallel to the coordinate axes, the value of integral is __________.
Answer key ☟
Answer key ☟
If the cube roots of unity are and , then the roots of the following equation are
A. B.
C. D.
gate1995 calculus normal polynomials
Answer key ☟
Answer Keys
4.0.1 1.2 4.1.1 N/A 4.1.2 B 4.1.3 A 4.1.4 A
4.1.5 A 4.1.6 C 4.1.7 19 : 19 4.1.8 C 4.2.1 Q-Q
4.2.2 N/A 4.3.1 0 4.3.2 B 4.3.3 A 4.4.1 A
4.5.1 D 4.5.2 -2 4.5.3 C 4.5.4 9 4.5.5 C
4.5.6 D 4.6.1 B 4.7.1 N/A 4.7.2 N/A 4.7.3 A
4.7.4 D 4.7.5 D 4.7.6 A 4.7.7 4 4.7.8 -1
4.7.9 A 4.7.10 0.288 : 0.289 4.7.11 B 4.7.12 A 4.8.1 1
4.8.2 1 4.8.3 A 4.8.4 B 4.8.5 C 4.8.6 C
4.8.7 1 4.8.8 C 4.8.9 C 4.8.10 0.25 : 0.25 4.8.11 -0.5
4.8.12 0.5 4.8.13 C 4.9.1 A 4.9.2 B 4.9.3 1
4.9.4 B 4.9.5 B 4.9.6 D 4.9.7 C 4.9.8 A
4.9.9 B;D 4.9.10 A 4.9.11 B 4.9.12 B 4.9.13 B
4.10.1 C 4.10.2 A 4.10.3 N/A 4.10.4 C 4.11.1 B
4.11.2 C
5 Engineering Mathematics: Discrete Mathematics (37)
I.
II.
where and are real numbers. Then which of the following is valid?
Answer key ☟
How many relations are there on a set with n elements that are symmetric and a set with n elements that
are reflexive and symmetric?
A. B.
C. D.
ugcnetcse-june2012-paper3 discrete-mathematics set-theory&algebra
Answer key ☟
Consider a set .
How many members of A shall be divisible by or by or by both and ?
Answer key ☟
The objective of ____ procedure is to discover at least one ____ that causes two literals to match.
Answer key ☟
If then is
A. Z B. Q C. R D. C
ugcnetcse-july2018-paper2 discrete-mathematics
Answer key ☟
Let be a simple undirected graph, be a DFS tree on , and be the BFS tree on . Consider the
following statements.
Statement : No edge of is a cross with respect to
Statement : For every edge of , if is at depth and is at depth in then
In the light of the above statements, choose the correct answer from the options given below
Answer key ☟
If is my friend, and is perfect, then correct logical translation of the statement “some
of my friends are not perfect” is ______
A. B.
C. D.
ugcnetcse-oct2020-paper2 discrete-mathematics mathematical-logic
Answer key ☟
Let be a directed graph whose vertex set is the set of numbers from to . There is an edge from a
vertex to a vertex if and only if either or . The minimum number of edges in a path
in from vertex to vertex is ______
A. B. C. D.
ugcnetcse-oct2020-paper2 discrete-mathematics graph-theory
Answer key ☟
5.0.11 UGC NET CSE | October 2020 | Part 2 | Question: 3
A. and
B. and
C. and
D. and
Answer key ☟
5.1.1 Boolean Function: UGC NET CSE | August 2016 | Part 2 | Question: 1
A. B. C. D.
ugcnetcse-aug2016-paper2 discrete-mathematics boolean-function
Answer key ☟
where
A. B. C. D.
ugcnetcse-dec2012-paper3 discrete-mathematics combinatory
Answer key ☟
How many solutions are there for the equation subject to the constraints that
?
Answer key ☟
5.3.1 Equivalence Class: UGC NET CSE | July 2018 | Part 2 | Question: 89
Which of the following is an equivalence relation on the set of all functions from Z to Z?
A.
B.
C.
D.
ugcnetcse-july2018-paper2 discrete-mathematics equivalence-class
Answer key ☟
5.4.1 First Order Logic: UGC NET CSE | December 2012 | Part 3 | Question: 58
Answer key ☟
5.4.2 First Order Logic: UGC NET CSE | October 2020 | Part 2 | Question: 40
Answer key ☟
A. B.
C. D.
ugcnetcse-dec2011-paper2 discrete-mathematics functions
Answer key ☟
Answer key ☟
Answer key ☟
5.7.1 Group Theory: UGC NET CSE | June 2012 | Part 3 | Question: 67
Then,
Answer key ☟
5.8.1 Linear Programming: UGC NET CSE | July 2016 | Part 3 | Question: 70
Answer key ☟
Answer key ☟
5.10.1 Partial Order: UGC NET CSE | December 2010 | Part 2 | Question: 3
A partially ordered set is said to be a lattice if every two elements in the set have
Answer key ☟
5.10.2 Partial Order: UGC NET CSE | July 2018 | Part 2 | Question: 90
Answer key ☟
5.11.1 Propositional Logic: UGC NET CSE | August 2016 | Part 2 | Question: 2
Let us assume that you construct ordered tree to represent the compound proposition
.
Then, the prefix expression and post-fix expression determined using this ordered tree are given as _____ and
______ respectively.
A.
B.
C.
D.
Answer key ☟
5.11.2 Propositional Logic: UGC NET CSE | August 2016 | Part 3 | Question: 70
Let mean is a vegetarian, for is meat, and for eats . Based on these, consider
the following sentences :
I.
II.
III.
One can determine that
Answer key ☟
5.11.3 Propositional Logic: UGC NET CSE | August 2016 | Part 3 | Question: 74
Answer key ☟
5.11.4 Propositional Logic: UGC NET CSE | December 2011 | Part 2 | Question: 43
A. p q B. q p
C. p q D. p q
ugcnetcse-dec2011-paper2 discrete-mathematics propositional-logic
Answer key ☟
5.11.5 Propositional Logic: UGC NET CSE | December 2012 | Part 3 | Question: 75
Let be the statement “x+y=z” and let there be two quantification given as
I.
II.
where x, y, z are real numbers, then which one of the following is correct?
Answer key ☟
5.11.6 Propositional Logic: UGC NET CSE | December 2015 | Part 2 | Question: 8
A. B.
C. D.
ugcnetcse-dec2015-paper2 discrete-mathematics propositional-logic
Answer key ☟
5.11.7 Propositional Logic: UGC NET CSE | July 2018 | Part 2 | Question: 76
a. False True
b. If
Answer key ☟
5.11.8 Propositional Logic: UGC NET CSE | Junet 2015 | Part 3 | Question: 57
A. B.
C. D.
ugcnetcse-june2015-paper3 discrete-mathematics propositional-logic
Answer key ☟
The equivalence of is
A.
B.
C.
D.
Answer key ☟
Answer key ☟
5.14.1 Set Theory: UGC NET CSE | August 2016 | Part 2 | Question: 3
Let and be sets in a finite universal set . Given the following : and
Which of the following is in order of increasing size ?
A.
B.
C.
D.
Answer key ☟
5.14.2 Set Theory: UGC NET CSE | December 2012 | Part 3 | Question: 34
A. 256 B. 64 C. 16 D. 4
ugcnetcse-dec2012-paper3 engineering-mathematics discrete-mathematics set-theory
Answer key ☟
Answer Keys
5.0.1 B 5.0.2 D 5.0.3 C 5.0.4 B 5.0.5 B
5.0.6 Q-Q 5.0.7 C 5.0.8 A 5.0.9 B 5.0.10 D
5.0.11 D 5.1.1 Q-Q 5.2.1 D 5.2.2 B 5.3.1 Q-Q
5.4.1 C 5.4.2 B 5.5.1 Q-Q 5.5.2 C 5.6.1 8
5.7.1 C 5.8.1 A 5.9.1 Q-Q 5.10.1 Q-Q 5.10.2 Q-Q
5.11.1 Q-Q 5.11.2 Q-Q 5.11.3 Q-Q 5.11.4 Q-Q 5.11.5 B
5.11.6 A 5.11.7 Q-Q 5.11.8 B 5.12.1 Q-Q 5.13.1 Q-Q
5.14.1 D 5.14.2 B
6 Engineering Mathematics: Linear Algebra (107)
Which homogeneous matrix transforms the figure (a) on the left side to figure (b) on the right?
A.
B.
C.
D.
ugcnetcse-dec2018-paper2
Answer key ☟
is called :
Answer key ☟
Let be points in the plane such that no three of them are collinear. For every pair
of points and , let be the line passing through them. Let be the line with the steepest
gradient amongst all lines.
Which one of the following properties should necessarily be satisfied ?
gateit-2007 cartesian-coordinates
Answer key ☟
A. B. C. D.
gate1997 linear-algebra normal determinant
Answer key ☟
A. B. C. D.
gatecse-2000 linear-algebra easy determinant
Answer key ☟
A. B.
C. D.
Answer key ☟
6.2.4 Determinant: GATE CSE 2014 Set 2 | Question: 4
Answer key ☟
I. is invertible
II. Determinant of is non-zero
Answer key ☟
Let
and
A.
B.
C.
D.
Answer key ☟
6.2.7 Determinant: GATE CSE 2024 | Set 2 | Question: 37
Let be an matrix over the set of all real numbers . Let be a matrix obtained from by
swapping two rows. Which of the following statements is/are TRUE?
Answer key ☟
The determinant of is .
Answer key ☟
A.
B.
C.
D.
Answer key ☟
6.2.10 Determinant: GATE IT 2005 | Question: 3
A. B. C. D.
gateit-2005 linear-algebra normal determinant
Answer key ☟
6.2.11 Determinant: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 14
Answer key ☟
is (are)
A. B. C. D.
gate1993 eigen-value linear-algebra easy multiple-selects
Answer key ☟
Answer key ☟
Answer key ☟
Let A be a matrix with eigen values -5,-2,1,4. Which of the following is an eigen value of the
matrix , where is the identity matrix?
A. B. C. D.
gatecse-2007 eigen-value linear-algebra difficult
Answer key ☟
Answer key ☟
A. , B. , C. , D. ,
gatecse-2010 linear-algebra eigen-value easy
Answer key ☟
Which one of the following options provides the CORRECT values of the eigenvalues of the matrix?
A. B. C. D.
gatecse-2011 linear-algebra eigen-value easy
Answer key ☟
A. and B. and
C. and D. and
gatecse-2012 linear-algebra eigen-value
Answer key ☟
The value of the dot product of the eigenvectors corresponding to any pair of different eigenvalues of a
symmetric positive definite matrix is ___________
gatecse-2014-set1 linear-algebra eigen-value numerical-answers normal
Answer key ☟
Answer key ☟
Which one of the following statements is TRUE about every matrix with only real eigenvalues?
A. If the trace of the matrix is positive and the determinant of the matrix is negative, at least one of its
eigenvalues is negative.
B. If the trace of the matrix is positive, all its eigenvalues are positive.
C. If the determinant of the matrix is positive, all its eigenvalues are positive.
D. If the product of the trace and determinant of the matrix is positive, all its eigenvalues are positive.
Answer key ☟
Consider the following matrix where two elements are unknown and are marked by and .
The eigenvalues of this matrix are and What are the values of and ?
A. B. C. D.
gatecse-2015-set1 linear-algebra eigen-value easy
Answer key ☟
Answer key ☟
In the given matrix , one of the eigenvalues is The eigenvectors corresponding to the
eigenvalue are
A.
B.
C.
D.
Answer key ☟
Answer key ☟
Answer key ☟
Let be real valued square symmetric matrix of rank with Consider the
following statements.
Answer key ☟
6.3.18 Eigen Value: GATE CSE 2017 Set 2 | Question: 22
Answer key ☟
Answer key ☟
Answer key ☟
Answer key ☟
Answer key ☟
Answer key ☟
Which of the following is/are the eigenvector(s) for the matrix given below?
A. B.
C. D.
Answer key ☟
Let , and be the five eigenvalues of . Note that these eigenvalues need not be distinct.
The value of ____________
A. B. C. D.
gatecse2024-set1 linear-algebra eigen-value
Answer key ☟
Answer key ☟
6.3.28 Eigen Value: GATE Data Science and Artificial Intelligence 2024 | Sample Paper | Question: 17
A. B. C. D.
Answer key ☟
A. B. C. D.
gateit-2006 linear-algebra eigen-value normal
Answer key ☟
6.3.30 Eigen Value: GATE IT 2007 | Question: 2
Let be the matrix . What is the maximum value of where the maximum is taken over
all that are the unit eigenvectors of
A. B. C. D.
gateit-2007 linear-algebra eigen-value normal
Answer key ☟
6.3.31 Eigen Value: GATE Overflow Test Series | Mock GATE | Test 5 | Question: 24
Let be a matrix of order whose elements are real numbers. If , then the eigenvalues of
are ________
A. B. C. D.
go2025-mockgate-5 linear-algebra matrix eigen-value 1-mark
Answer key ☟
Which one of the following statements is NOT true for a square matrix A?
a. If A is real symmetric, the eigen values of A are the diagonal elements of it.
b. If all the principal minors of A are positive, all the eigen values of A are also positive.
Answer key ☟
6.4.1 Eigen Vector: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 35
A. B. C. D.
go2025-mockgate-6 linear-algebra eigen-value eigen-vector 1-mark
Answer key ☟
A. B. C. D.
go-mockgate-1 engineering-mathematics linear-algebra matrix
Answer key ☟
A. B. C. D.
gate1987 linear-algebra inequality out-of-gatecse-syllabus
Answer key ☟
A. The rows are linearly independent B. The columns are linearly independent
C. The row are linearly dependent D. None of the above
gate1987 linear-algebra matrix
Answer key ☟
Assume that the matrix given below, has factorization of the form , where is lower-
triangular with all diagonal elements equal to is upper-triangular, and is a permutation matrix.
For
Answer key ☟
otherwise, is _______
gate1993 linear-algebra normal matrix fill-in-the-blanks
Answer key ☟
Let and be real symmetric matrices of size . Then which one of the following is true?
A. B. C. D.
gate1994 linear-algebra normal matrix
Answer key ☟
Answer key ☟
Answer key ☟
A. if an integer B. always
C. never D. if
gate1996 linear-algebra normal matrix
Answer key ☟
Let be an -rowed square matrix and be the matrix obtained by interchanging the first and
second rows of the -rowed Identity matrix. Then is such that its first
A. Row is the same as its second row B. Row is the same as the second row of
Answer key ☟
A. B. C. D.
gate1998 linear-algebra matrix normal
Answer key ☟
Answer key ☟
The number of different symmetric matrices with each element being either 0 or 1 is: (Note:
is same as )
A. B.
C. D.
gatecse-2004 linear-algebra normal matrix
Answer key ☟
A. B.
C. D. Does not necessarily exist
gatecse-2004 linear-algebra normal matrix
Answer key ☟
In an matrix all non-zero entries are covered in rows and columns. Then the maximum
number of non-zero entries, such that no two are on the same row or column, is
A. B.
C. D.
gatecse-2004 linear-algebra normal matrix
Answer key ☟
is an real matrix. is an real vector. Suppose there are two vectors, and such
that, and . Which one of the following statements is false?
A. Determinant of is zero.
B. There are an infinite number of solutions to
C. There is an such that
D. must have two identical rows
gatecse-2006 linear-algebra normal matrix
Answer key ☟
In the LU decomposition of the matrix , if the diagonal elements of are both , then the lower
diagonal entry of is_________________.
gatecse-2015-set1 linear-algebra matrix numerical-answers
Answer key ☟
Answer key ☟
Consider the following two statements with respect to the matrices and
Statement
Statement
where represents the trace of a matrix. Which one of the following holds?
Answer key ☟
A. B.
C. D.
Answer key ☟
6.7.19 Matrix: GATE IT 2008 | Question: 29
If is a square matrix with a zero determinant, which of the following assertion (s) is (are) correct?
S1: Each row of can be represented as a linear combination of the other rows
S2: Each column of can be represented as a linear combination of the other columns
S3: has a nontrivial solution
S4: has an inverse
Answer key ☟
6.7.20 Matrix: GATE Overflow Test Series | Mock GATE | Test 1 | Question: 39
Alice is fond of doing programming, she usually takes part in different coding contest and mostly get
gold medal because of the efficiency of her codes. Out of curiosity to know whether Alice is as that
much capable in programming or not his sister has given her a program. She said “There are matrices and
both of order is lower triangular matrix and is upper triangular matrix, you have to find the
product of and i.e., and print the minimum number of algebraic operations used, but mind it, the
program has to be as efficient as possible”. What will be the value printed by Alice’s program?
A. B. C. D.
go2025-mockgate-1 linear-algebra matrix
Answer key ☟
6.7.21 Matrix: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 27
A. B. C. D.
go2025-mockgate-2 matrix
Answer key ☟
6.7.22 Matrix: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 35
A. B. C. D.
go2025-mockgate-2 matrix
Answer key ☟
6.7.23 Matrix: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 42
Alice is a programmer and his brother is a maths student. Both are very good in their field. One day his
brother was studying linear algebra and he learned to calculate inverse of matrix, he asked Alice to write
a C program for this. The problem was, to write a program to find the inverse of a matrix, but the
restriction is that the input elements can either be or . Alice has written whole program, the logic was similar
to that of written in maths book (i.e.,) calculate adjoint and determinant. What is the probability that his program
will throw run time error when given some input?
go2025-mockgate-2 numerical-answers matrix
Answer key ☟
6.7.24 Matrix: GATE Overflow Test Series | Mock GATE | Test 3 | Question: 22
Answer key ☟
6.7.25 Matrix: GATE Overflow Test Series | Mock GATE | Test 3 | Question: 36
Consider a matrix Type- such that The elements of matrix are also dependent on
their position as, if , then is even and else is odd. Calculate the number of non-
symmetric matrices of Type- ________
go2025-mockgate-3 numerical-answers linear-algebra matrix
Answer key ☟
6.7.26 Matrix: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 24
If then
A. B. C. D.
go2025-mockgate-6 linear-algebra matrix multiple-selects 1-mark
Answer key ☟
6.7.27 Matrix: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 34
Answer key ☟
x + y/2 = 9
3x + y = 10
The value of the Frobenius norm for the above system of equations is
A. B. C. D.
gateit-2006 linear-algebra normal numerical-methods non-gatecse
Answer key ☟
6.8.2 Numerical Methods: GATE IT 2006 | Question: 77
What can be said about the Gauss-Siedel iterative method for solving the above set of linear equations?
Answer key ☟
the corresponding matrix norm, calculate for the matrix using a known property
of this norm.
Although this norm is very easy to calculate for any matrix, explain why the condition number is difficult (i.e.
expensive) to calculate.
gate1988 descriptive matrix out-of-gatecse-syllabus
A. B. C. D.
gate1994 linear-algebra matrix rank-of-matrix easy
Answer key ☟
A. B.
C. D. Depends on the value of
gate1995 linear-algebra matrix normal rank-of-matrix
Answer key ☟
A. B. C. D.
gate1998 linear-algebra matrix normal rank-of-matrix
Answer key ☟
A. B. C. D.
gatecse-2002 linear-algebra easy rank-of-matrix
Answer key ☟
Let and be two matrices over real numbers. Let rank( ) and denote the rank and
determinant of a matrix , respectively. Consider the following statements.
I.
II.
III.
IV.
A. I and II only B. I and IV only C. II and III only D. III and IV only
gatecse-2020 linear-algebra matrix 2-marks rank-of-matrix
Answer key ☟
Suppose that is a matrix such that every solution of the equation is a scalar multiple of
. The rank of is __________
gatecse-2021-set2 numerical-answers linear-algebra matrix rank-of-matrix 1-mark
Answer key ☟
6.10.7 Rank of Matrix: GATE Overflow Test Series | Mock GATE | Test 4 | Question: 11
Mark all the correct statements given below. is and is matrices. (Mark all the
appropriate choices)
Answer key ☟
A.
B.
C.
D.
Answer key ☟
A. The system has a solution if and only if, both and the augmented matrix have the same rank.
B. If and is the zero vector, then the system has infinitely many solutions.
C. If and is a non-zero vector, then the system has a unique solution.
D. The system will have only a trivial solution when , is the zero vector and .
Answer key ☟
Answer key ☟
Derive the expressions for the number of operations required to solve a system of linear equations in
unknowns using the Gaussian Elimination Method. Assume that one operation refers to a multiplication
followed by an addition.
gate1998 linear-algebra system-of-equations descriptive
Answer key ☟
Notice that the second and the third columns of the coefficient matrix are linearly dependent. For how many
values of , does this system of equations have infinitely many solutions?
A. B. C. D.
gatecse-2003 linear-algebra system-of-equations normal
Answer key ☟
How many solutions does the following system of linear equations have?
Answer key ☟
Answer key ☟
Answer key ☟
Answer key ☟
A. B.
C. D.
gatecse-2015-set3 linear-algebra system-of-equations normal
Answer key ☟
Answer key ☟
Let be scalars, not all zero, such that = 0 where are column vectors in .
Answer key ☟
Which one of the following is the correct combination of values for and
A. B.
C. D.
gatecse-2022 linear-algebra matrix system-of-equations 2-marks
Answer key ☟
Let be any matrix, where . Which of the following statements is/are TRUE about the
system of linear equations ?
Answer key ☟
6.12.14 System of Equations: GATE IT 2004 | Question: 6
A. , , B. , ,
C. , , D. , ,
gateit-2004 linear-algebra system-of-equations easy
Answer key ☟
6.12.15 System of Equations: GATE Overflow Test Series | Mock GATE | Test 4 | Question: 36
A. B. C. D.
go2025-mockgate-4 linear-algebra system-of-equations
Answer key ☟
Answer key ☟
A. B. C. D.
gate1995 linear-algebra normal vector-space
Answer key ☟
Answer key ☟
If and are -dimensional subspaces of a -dimensional vector space , then the smallest possible
dimension of is _____.
gatecse-2014-set3 linear-algebra vector-space normal numerical-answers
Answer key ☟
Let and be two vectors in whose Euclidean norms satisfy . What is the value of
such that bisects the angle between and ?
A. B. C. D.
gatecse-2017-set1 linear-algebra normal vector-space
Answer key ☟
Answer Keys
6.0.1 Q-Q 6.0.2 Q-Q 6.1.1 A 6.2.1 B 6.2.2 A
6.2.3 A 6.2.4 0 6.2.5 D 6.2.6 B 6.2.7 A;B
6.2.8 0 6.2.9 D 6.2.10 A 6.2.11 0 6.3.1 B;D
6.3.2 N/A 6.3.3 B 6.3.4 C 6.3.5 A 6.3.6 D
6.3.7 A 6.3.8 D 6.3.9 0 6.3.10 6 6.3.11 A
6.3.12 D 6.3.13 6 6.3.14 B 6.3.15 15 6.3.16 0.125
6.3.17 B 6.3.18 2 6.3.19 5 6.3.20 3 6.3.21 D
6.3.22 12 6.3.23 3:3 6.3.24 A;C;D 6.3.25 2 6.3.26 B
6.3.27 B 6.3.28 B 6.3.29 A 6.3.30 B 6.3.31 A
6.3.32 Q-Q 6.4.1 C 6.5.1 B 6.6.1 C 6.7.1 C
6.7.2 N/A 6.7.3 N/A 6.7.4 D 6.7.5 N/A 6.7.6 N/A
6.7.7 A 6.7.8 C 6.7.9 B 6.7.10 A 6.7.11 C
6.7.12 B 6.7.13 D 6.7.14 D 6.7.15 5 6.7.16 0
6.7.17 C 6.7.18 B 6.7.19 D 6.7.20 C 6.7.21 B
7.1.1 Assignment Problem: UGC NET CSE | June 2014 | Part 3 | Question: 59
The given maximization assignment problem can be converted into a minimization problem by
A. Subtracting each entry in a column from the maximum value in that column.
B. Subtracting each entry in the table from the maximum value in that table.
C. Adding each entry in a column from the maximum value in that column.
D. Adding maximum value of the table to each entry in the table.
Answer key ☟
7.1.2 Assignment Problem: UGC NET CSE | Junet 2015 | Part 3 | Question: 67
In the Hungarian method for solving assignment problem, an optimal assignment requires that the
maximum number of lines that can be drawn through squares with zero opportunity cost be equal to the
number of
Answer key ☟
7.2.1 Dual Linear Programming: UGC NET CSE | December 2012 | Part 3 | Question: 24
Answer key ☟
7.3.1 Linear Programming: UGC NET CSE | October 2020 | Part 2 | Question: 4
A. B. C. D.
ugcnetcse-oct2020-paper2 non-gatecse linear-programming
Answer key ☟
If the primal Linear Programming pro blem has unbounded solution, then it's dual problem will have
Answer key ☟
In a Linear Programming Problem, suppose there are three basic variables and 2 non-basic variables,
then the possible number of basic solutions are
A. 6 B. 8 C. 10 D. 12
ugcnetcse-dec2012-paper3 optimization linear-programming
Answer key ☟
A.
B.
C.
D. All of these
Answer key ☟
Subject to
Answer key ☟
ugcnetcse-dec2015-paper3 optimization
Answer key ☟
A basic feasible solution of a linear programming problem is said to be ______ if at least one of the
basic variable is zero
Answer key ☟
Answer key ☟
Which of the following special cases does not require reformulation of the problem in order to obtain a
solution ?
Answer key ☟
Answer key ☟
7.6.1 Transportation Problem: UGC NET CSE | December 2012 | Part 3 | Question: 28
The initial basic feasible solution to the following transportation problem using Vogel’s approximation
method is
A. , Total cost
B. , Total cost
C. , Total cost
D. None of the above
Answer key ☟
7.6.2 Transportation Problem: UGC NET CSE | December 2015 | Part 3 | Question: 53
i. The solution must be feasible, i.e. it must satisfy all the supply and demand constraints
ii. The number of positive allocations must be equal to , where is the number of rows and is the
number of columns
iii. All the positive allocations must be in independent positions
The initial solution of a transportation problem is said to be non-degenerate basic feasible solution if it satisfies:
Answer key ☟
7.6.3 Transportation Problem: UGC NET CSE | December 2015 | Part 3 | Question: 54
Stores
I II III IV Supply
A 4 6 8 13 50
Factories B 13 11 10 8 70
C 14 4 10 13 30
D 9 11 13 8 50
Demand 25 35 105 20
The transportation cost in the initial basic feasible solution of the above transportation problem using Vogel's
Approximation method is
A. B. C. D.
ugcnetcse-dec2015-paper3 optimization transportation-problem
Answer key ☟
7.6.4 Transportation Problem: UGC NET CSE | June 2014 | Part 3 | Question: 60
is given as
5
8
7
2 2 10
then the minimum cost is
A. 76 B. 78 C. 80 D. 82
ugcnetjune2014iii optimization transportation-problem
Answer key ☟
7.6.5 Transportation Problem: UGC NET CSE | Junet 2015 | Part 3 | Question: 68
The initial basic feasible solution of the above transportation problem using Vogel's Approximation method
(VAM) is given below:
Answer key ☟
Answer Keys
7.1.1 B 7.1.2 A 7.2.1 A 7.3.1 D 7.4.1 C
7.5.1 C 7.5.2 D 7.5.3 B 7.5.4 A 7.5.5 A
7.5.6 B 7.5.7 A 7.5.8 D 7.6.1 D 7.6.2 A
7.6.3 B 7.6.4 A 7.6.5 B
8 Programming and DS (27)
When an array is passed as parameter to a function, which of the following statements is correct ?
Answer key ☟
A. n-subscripts B. two-subscripts
C. only one subscript D. three subscripts only
ugcnetcse-june2013-paper3 programming-in-c array
Answer key ☟
8.2.1 Array of Pointers: UGC NET CSE | August 2016 | Part 2 | Question: 12
int * f[]()
declares :
Answer key ☟
8.3.1 Dangling Pointers: UGC NET CSE | September 2013 | Part 3 | Question: 65
8.4.1 Data Types: UGC NET CSE | December 2011 | Part 2 | Question: 33
If an integer needs two bytes of storage, then the maximum value of unsigned integer is
A. B. C. D.
ugcnetcse-dec2011-paper2 programming-in-c data-types
Answer key ☟
Answer key ☟
8.6.1 Input Output Statement: UGC NET CSE | December 2009 | Part 2 | Question: 12
What would be the output of the following program, if run from the command line as “myprog 1 2 3” ?
{ int i ;
(A) 123
(B) 6
(C) Error
(D) “123”
ugcnetcse-dec2009-paper2 programming-in-c input-output-statement
Answer key ☟
8.7.1 Operator Precedence: UGC NET CSE | December 2010 | Part 2 | Question: 12
A. B. C. D.
ugcnetcse-dec2010-paper2 programming-in-c operator-precedence
Answer key ☟
8.7.2 Operator Precedence: UGC NET CSE | December 2011 | Part 2 | Question: 36
means
A. B.
C. D.
ugcnetcse-dec2011-paper2 programming-in-c operator-precedence
Answer key ☟
A. 1 B. 3 C. 2 D. 0
ugcnetcse-dec2012-paper2 programming-in-c operators
Answer key ☟
A. B. C. D.
ugcnetcse-june2010-paper2 programming-in-c operators
Answer key ☟
8.9.1 Parameter Passing: UGC NET CSE | December 2012 | Part 3 | Question: 44
Answer key ☟
8.10 Pointer Declaration (1)
8.10.1 Pointer Declaration: UGC NET CSE | September 2013 | Part 3 | Question: 51
Answer key ☟
Given
What is the output of given expression?
x * 3 & & 3 || j | k
A. B. C. D.
ugcnetcse-aug2016-paper2 programming-in-c
Answer key ☟
Answer key ☟
Which one of the following will set the value of to if has the value , but not otherwise ?
A. If B. If
C. If D. If
ugcnetcse-dec2010-paper2 programming-in-c
Answer key ☟
8.11.4 Programming In C: UGC NET CSE | December 2015 | Part 2 | Question: 11
A. B.
C. D.
ugcnetcse-dec2015-paper2 programming-in-c
Answer key ☟
A horn clause is
programming-in-c ugcnetcse-dec2015-paper3
Answer key ☟
A. B. C. D.
ugcnetcse-june2007-paper2 programming-in-c
Answer key ☟
Answer key ☟
Consider the following pseudo-code fragment, where and are integer variables that have been
initialized:
/* Pre-conditions : */
/* Assume that overflow never occurs */
int ; int ;
while
;
;
When the while loop terminates, what will be the value of in terms of and ?
A.
B.
C. /* means floor */
D. /* means ceil */
ugcnetcse-oct2020-paper2 programming-in-c
Answer key ☟
What is the size of the following union? Assume that the size of int=2, size of float =4, size of char=1
union tag {
int a;
float b;
char c;
};
A. 2 B. 4 C. 1 D. 7
ugcnetsep2013ii programming-in-c
Answer key ☟
A. 10 B. 16 C. 15 D. 14
ugcnetsep2013ii programming-in-c
Answer key ☟
8.11.11 Programming In C: UGC NET CSE | September 2013 | Part 2 | Question: 36
Answer key ☟
A. 15 B. 25 C. 45 D. 20
ugcnetcse-sep2013-paper3 programming-in-c
Answer key ☟
8.12.1 Storage Classes In C: UGC NET CSE | January 2017 | Part 2 | Question: 13
Answer key ☟
8.13.1 Three Dimensional Array: UGC NET CSE | December 2015 | Part 2 | Question: 16
A three dimensional array in 'C' is declared as int A[x][y][z]. Here, the address of an item at the location
A[p][q][r] can be computed as follows: (where w is the word length of an integer)
A. &A[0][0][0]+w(y*z*q+z*p+r) B. &A[0][0][0]+w(y*z*p+z*q+r)
C. &A[0][0][0]+w(x*y*p+z*q+r) D. &A[0][0][0]+w(x*y*q+z*p+r)
ugcnetcse-dec2015-paper2 programming-in-c three-dimensional-array
Answer key ☟
Answer Keys
8.1.1 A 8.1.2 C 8.2.1 Q-Q 8.3.1 B 8.4.1 A
8.5.1 729 8.6.1 Q-Q 8.7.1 Q-Q 8.7.2 D 8.8.1 D
8.8.2 Q-Q 8.9.1 A 8.10.1 D 8.11.1 Q-Q 8.11.2 Q-Q
8.11.3 Q-Q 8.11.4 B 8.11.5 B 8.11.6 Q-Q 8.11.7 C
8.11.8 X 8.11.9 B 8.11.10 C 8.11.11 C 8.11.12 D
8.12.1 B 8.13.1 B
9 Programming and DS: DS (354)
Answer key ☟
A binary tree is said to have heap property if the elements along any path :
ugcnetcse-june2009-paper2
Answer key ☟
A. 1/(⌈m/2⌉−1) B. ⌈m/2⌉−1
C. 1/(m/2) D. None
ugcnetcse-june2009-paper2
Answer key ☟
What operation is supported in constant time by the doubly linked list, but not by the singly linked list ?
ugcnetcse-dec2004-paper2
Answer key ☟
Suppose we are implementing quadratic probing with a Hash function, Hash mode . If an
element with key is inserted and the first three locations attempted are already occupied, then the
next cell that will be tried is :
A. B. C. D.
ugcnetcse-dec2004-paper2
Answer key ☟
What item is at the root after the following sequence of insertions into an empty splay tree :
A. B. C. D.
ugcnetcse-dec2004-paper2
Answer key ☟
Answer key ☟
Answer key ☟
1.
2.
3.
4. None of these
ugcnetcse-dec2006-paper2
Answer key ☟
A. are initialized during each execution of the function B. are retained from the last execution
C. are maintained in a stack D. are ignored
ugcnetcse-dec2006-paper2
Answer key ☟
A. B.
C. D.
ugcnetcse-dec2007-paper2
Answer key ☟
9.0.12 UGC NET CSE | December 2007 | Part 2 | Question: 22
ugcnetcse-dec2007-paper2
Answer key ☟
Consider a rooted tree in which every node has at least three children. What is the minimum number of
nodes at level i (i > ) of the tree ? Assume that the root is at level :
A. B. C. D.
ugcnetcse-dec2007-paper2
Answer key ☟
Which of the following piece of code will insert the node pointed to by at the end of the list ?
A.
B.
C.
D.
ugcnetcse-dec2007-paper2
Answer key ☟
Mark the balance factor of each node on the tree given in the below figure and state whether it is height-
balanced.
gate1988 data-structures normal descriptive avl-tree binary-tree
Answer key ☟
What is the maximum height of any AVL-tree with nodes? Assume that the height of a tree with a
single node is .
A. B. C. D.
gatecse-2009 data-structures binary-search-tree normal isrodec2017 avl-tree
Answer key ☟
What is the worst case time complexity of inserting elements into an AVL-tree with elements
initially?
A. B.
C. D.
gatecse-2020 binary-tree avl-tree 1-mark
Answer key ☟
A. The cost of searching an AVL tree is but that of a binary search tree is
B. The cost of searching an AVL tree is but that of a complete binary tree is
C. The cost of searching a binary search tree is but that of an AVL tree is
D. The cost of searching an AVL tree is but that of a binary search tree is
Answer key ☟
9.1.5 AVL Tree: GATE Overflow Test Series | Mock GATE | Test 3 | Question: 41
AVL tree is a self-balancing Binary Search Tree (BST) where the difference between heights of left and
right subtrees cannot be more than one for all nodes. What is the different shapes possible for an AVL
tree with minimum number of nodes and height Assume height of root as
go2025-mockgate-3 numerical-answers data-structures avl-tree
Answer key ☟
9.1.6 AVL Tree: UGC NET CSE | December 2012 | Part 2 | Question: 2
The worst case time complexity of AVL is tree is better in comparison to binary search tree for
Answer key ☟
9.1.7 AVL Tree: UGC NET CSE | June 2005 | Part 2 | Question: 23
In the balanced binary tree given below, how many nodes will become unbalanced when a node is
inserted as a child of the node “ ” ?
A. B. C. D.
ugcnetcse-june2005-paper2 data-structures avl-tree
Answer key ☟
The following Pascal program segments finds the largest number in a two-dimensional integer array
using a single loop. Fill up the boxes to complete the program and write
against in your answer book Assume that max is a variable to store the largest value and
are the indices to the array.
begin
max:=|A|, i:=0, j:=0;
while |B| do
begin
if A[i, j]>max then max:=A[i, j];
if |C| then j:=j+1;
else begin
j:=0;
i:=|D|
end
end
end
Answer key ☟
9.2.2 Array: GATE CSE 1994 | Question: 1.11
In a compact single dimensional array representation for lower triangular matrices (i.e all the elements
above the diagonal are zero) of size , non-zero elements, (i.e elements of lower triangle) of each
row are stored one after another, starting from the first row, the index of the element of the lower
triangular matrix in this new representation is:
A. B. C. D.
gate1994 data-structures array normal
Answer key ☟
Answer key ☟
Answer key ☟
Assuming that each integer takes one memory location, the array is stored in row-major order and the first
element of the array is stored at location , what is the address of the element ?
A. B. C. D.
gate1998 data-structures array easy
Answer key ☟
A. B. C. D.
gatecse-2000 data-structures array easy
Answer key ☟
Suppose you are given arrays and both uninitialized, that is, each location may
contain an arbitrary value), and a variable count, initialized to . Consider the following procedures
and :
set(i) {
count = count + 1;
q[count] = i;
p[i] = count;
}
is_set(i) {
if (p[i] ≤ 0 or p[i] > count)
return false;
if (q[p[i]] ≠ i)
return false;
return true;
}
Answer key ☟
Answer key ☟
9.2.9 Array: GATE CSE 2013 | Question: 50
The procedure given below is required to find and replace certain characters inside an input character
string supplied in array . The characters to be replaced are supplied in array , while their
respective replacement characters are supplied in array . Array has a fixed length of five characters,
while arrays and contain three characters each. However, the procedure is flawed.
void find_and_replace (char *A, char *oldc, char *newc) {
for (int i=0; i<5; i++)
for (int j=0; j<3; j++)
if (A[i] == oldc[j])
A[i] = newc[j];
}
1.
2.
3.
4.
The tester now tests the program on all input strings of length five consisting of characters ‘ ’, ‘ ’, ‘ ’, ‘ ’ and ‘
’ with duplicates allowed. If the tester carries out this testing with the four test cases given above, how many
test cases will be able to capture the flaw?
Answer key ☟
The procedure given below is required to find and replace certain characters inside an input character
string supplied in array . The characters to be replaced are supplied in array , while their
respective replacement characters are supplied in array . Array has a fixed length of five characters,
while arrays and contain three characters each. However, the procedure is flawed.
void find_and_replace (char *A, char *oldc, char *newc) {
for (int i=0; i<5; i++)
for (int j=0; j<3; j++)
if (A[i] == oldc[j])
A[i] = newc[j];
}
1.
2.
3.
4.
If array is made to hold the string “ ”, which of the above four test cases will be successful in exposing
the flaw in this procedure?
Answer key ☟
9.2.11 Array: GATE CSE 2014 Set 3 | Question: 42
Consider the C function given below. Assume that the array contains elements, sorted in
ascending order.
int ProcessArray(int *listA, int x, int n)
{
int i, j, k;
i = 0; j = n-1;
do {
k = (i+j)/2;
if (x <= listA[k]) j = k-1;
if (listA[k] <= x) i = k+1;
}
while (i <= j);
if (listA[k] == x) return(k);
else return -1;
}
Answer key ☟
A Young tableau is a 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.
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 with a ). The minimum number of
entries (other than ) to be shifted, to remove from the given Young tableau is _____.
gatecse-2015-set2 databases array normal numerical-answers
Answer key ☟
Let be an array containing integers. Let be the lowest upper bound on the number of comparisons
of the array elements, required to find the minimum and maximum values in an arbitrary array of
elements. Which one of the following choices is correct?
A. B.
C. D.
gatecse-2021-set1 data-structures array 1-mark
Answer key ☟
9.3 B Tree (1)
A. B.
C. D.
ugcnetcse-dec2012-paper2 b-tree databases
Answer key ☟
9.4.1 B and Bplus Trees: UGC NET CSE | June 2010 | Part 2 | Question: 25
In a tree of order , the following keys are inserted as follows : and How many
elements are present in the root of the tree ?
A. B. C. D.
ugcnetcse-june2010-paper2 data-structures b-and-bplus-trees
Answer key ☟
Answer key ☟
The minimum number of interchanges needed to convert the array into a max-heap is
A. B. C. D.
gate1996 data-structures binary-heap easy
Answer key ☟
A. In binary tree, a full node is defined to be a node with children. Use induction on the height of the binary
tree to prove that the number of full nodes plus one is equal to the number of leaves.
B. Draw the min-heap that results from insertion of the following elements in order into an initially empty min-
heap: . Show the result after the deletion of the root of this heap.
gate1999 data-structures binary-heap normal descriptive
Answer key ☟
Consider any array representation of an element binary heap where the elements are stored from index
to index of the array. For the element stored at index of the array , the index of the parent is
A. B. C. D.
gatecse-2001 data-structures binary-heap easy
Answer key ☟
In a min-heap with elements with the smallest element at the root, the smallest element can be
found in time
A. B.
C. D.
gatecse-2003 data-structures binary-heap
Answer key ☟
The elements are inserted one by one in the given order into a maxHeap. The
resultant maxHeap is
A.
B.
C. D.
gatecse-2004 data-structures binary-heap easy
Answer key ☟
A priority queue is implemented as a Max-Heap. Initially, it has elements. The level-order traversal of
the heap is: . Two new elements and are inserted into the heap in that order. The level-
order traversal of the heap after the insertion of the elements is:
A. B.
C. D.
gatecse-2005 data-structures binary-heap normal
Answer key ☟
9.5.8 Binary Heap: GATE CSE 2006 | Question: 10
In a binary max heap containing numbers, the smallest element can be found in time
A. B.
C. D.
gatecse-2006 data-structures binary-heap easy
Answer key ☟
A -ary max heap is like a binary max heap, but instead of children, nodes have children. A -ary heap can
be represented by an array as follows: The root is stored in the first location, , nodes in the next level, from
left to right, is stored from to . The nodes from the second level of the tree from left to right are stored
from location onward. An item can be inserted into a -ary heap containing items by placing in the
location and pushing it up the tree to satisfy the heap property.
76. Which one of the following is a valid sequence of elements in an array representing -ary max heap?
A. B.
C. D.
Answer key ☟
A -ary max heap is like a binary max heap, but instead of children, nodes have children. A -ary heap can
be represented by an array as follows: The root is stored in the first location, , nodes in the next level, from
left to right, is stored from to . The nodes from the second level of the tree from left to right are stored
from location onward. An item can be inserted into a -ary heap containing items by placing in the
location and pushing it up the tree to satisfy the heap property.
76. Which one of the following is a valid sequence of elements in an array representing ary max heap?
A. B.
C. D.
77. Suppose the elements and are inserted, in that order, into the valid -ary max heap found in the
previous question, Q.76. Which one of the following is the sequence of items in the array representing the
resultant heap?
A. B.
C. D.
gatecse-2006 data-structures binary-heap normal
Answer key ☟
A. B.
C. D.
gatecse-2007 data-structures binary-heap normal
Answer key ☟
A. B.
C. D.
gatecse-2009 data-structures binary-heap easy
Answer key ☟
A. B.
C. D.
gatecse-2009 data-structures binary-heap normal
Answer key ☟
A max-heap is a heap where the value of each parent is greater than or equal to the value of its children.
Which of the following is a max-heap?
B.
A.
C. D.
gatecse-2011 data-structures binary-heap easy
Answer key ☟
A priority queue is implemented as a Max-Heap. Initially, it has elements. The level-order traversal of
the heap is: . Two new elements and are inserted into the heap in that order. The level-
order traversal of the heap after the insertion of the elements is:
A. B.
C. D.
gatecse-2014-set2 data-structures binary-heap normal
Answer key ☟
9.5.16 Binary Heap: GATE CSE 2015 Set 1 | Question: 32
Now consider that a value is inserted into this heap. After insertion, the new heap is
A. B.
C. D.
gatecse-2015-set1 data-structures binary-heap easy
Answer key ☟
Consider a complete binary tree where the left and 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. B.
C. D.
gatecse-2015-set2 data-structures binary-heap normal
Answer key ☟
A. B. C. D.
gatecse-2015-set3 data-structures binary-heap easy
Answer key ☟
An operator for a binary heap data structure is to be designed to delete the item in the -th
node. Assume that the heap is implemented in an array and refers to the -th index of the array. If the
heap tree has depth (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. B. but not
C. but not D. but not
gatecse-2016-set1 data-structures binary-heap normal
Answer key ☟
A complete binary min-heap is made by including each integer in exactly once. The depth of a
node in the heap is the length of the path from the root of the heap to that node. Thus, the root is at depth
. The maximum depth at which integer can appear is _________.
gatecse-2016-set2 data-structures binary-heap normal numerical-answers
Answer key ☟
9.5.21 Binary Heap: GATE CSE 2018 | Question: 46
The number of possible min-heaps containing each value from exactly once is
_______
gatecse-2018 binary-heap numerical-answers combinatory 2-marks
Answer key ☟
Answer key ☟
Consider the array representation of a binary min-heap containing elements. The minimum number
of comparisons required to find the maximum in the heap is ___________.
gatecse-2020 numerical-answers binary-heap 2-marks
Answer key ☟
Let be a binary min-heap consisting of elements implemented as an array. What is the worst case
time complexity of an optimal algorithm to find the maximum element in ?
A. B.
C. D.
gatecse-2021-set2 data-structures binary-heap time-complexity 1-mark
Answer key ☟
Which one of the following sequences when stored in an array at locations forms a max-
heap?
A. B.
C. D.
gatecse-2023 data-structures binary-heap 1-mark
Answer key ☟
Consider a binary min-heap containing distinct elements. Let be the index (in the underlying
array) of the maximum element stored in the heap. The number of possible values of is
A. B. C. D.
gatecse2024-set1 data-structures binary-heap
Answer key ☟
An array of integers of size can be converted into a heap by adjusting the heaps rooted at each internal
node of the complete binary tree starting at the node , and doing this adjustment up to the
root node (root node is at index ) in the order , , ....., . The time required to construct
a heap in this manner is
A. B. C. D.
gateit-2004 data-structures binary-heap normal
Answer key ☟
A. B.
C. D.
gateit-2006 data-structures binary-heap easy
Answer key ☟
An array of distinct integers is interpreted as a complete binary tree. The index of the first element
of the array is . If only the root node does not satisfy the heap property, the algorithm to convert the
complete binary tree into a heap has the best asymptotic time complexity of
A. B. C. D.
gateit-2006 data-structures binary-heap easy
Answer key ☟
9.5.30 Binary Heap: GATE Overflow Test Series | Mock GATE | Test 4 | Question: 16
A. B.
C. D.
go2025-mockgate-4 binary-heap data-structures time-complexity
Answer key ☟
9.5.31 Binary Heap: UGC NET CSE | December 2008 | Part 2 | Question: 33
A. maximum
B. minimum
C. sum
D. product
Answer key ☟
9.5.32 Binary Heap: UGC NET CSE | January 2017 | Part 2 | Question: 23
a. b. c. d.
A. B. C. D.
ugcnetjan2017ii data-structures binary-heap
Answer key ☟
9.5.33 Binary Heap: UGC NET CSE | July 2018 | Part 2 | Question: 22
Consider the array A=<4, 1, 3, 2, 16, 9, 10, 14, 8, 7>. After building heap from the array A, the depth of
the heap and the right child of max-heap are ______ and _____ respectively (Root is at level 0).
A. 3, 14 B. 3, 10 C. 4, 14 D. 4, 10
ugcnetcse-july2018-paper2 data-structures binary-heap
Answer key ☟
9.5.34 Binary Heap: UGC NET CSE | June 2013 | Part 3 | Question: 13
Answer key ☟
9.5.35 Binary Heap: UGC NET CSE | Junet 2015 | Part 3 | Question: 36
A. B.
C. ceil D. ceil
Answer key ☟
9.5.36 Binary Heap: UGC NET CSE | November 2017 | Part 3 | Question: 20
Answer key ☟
9.5.37 Binary Heap: UGC NET CSE | October 2020 | Part 2 | Question: 24
In a binary max heap containing numbers, the smallest element can be found in ______
A. B. C. D.
ugcnetcse-oct2020-paper2 data-structures binary-heap
Answer key ☟
The number of nodes in the left subtree and right subtree of the root respectively is
A. B. C. D.
gate1996 data-structures binary-search-tree easy
Answer key ☟
A binary search tree is used to locate the number . Which of the following probe sequences are
possible and which are not? Explain.
Answer key ☟
A binary search tree contains the value . The tree is traversed in pre-order and the
values are printed out. Which of the following sequences is a valid output?
A. B.
C. D.
gate1997 data-structures binary-search-tree normal
Answer key ☟
A. Insert the following keys one by one into a binary search tree in the order specified.
Answer key ☟
9.6.5 Binary Search Tree: GATE CSE 2003 | Question: 19, ISRO2009-24
Suppose the numbers are inserted in that order into an initially empty binary
search tree. The binary search tree uses the usual ordering on natural numbers. What is the in-order
traversal sequence of the resultant tree?
A.
B.
C.
D.
Answer key ☟
A. B. C. D.
gatecse-2003 normal binary-search-tree
Answer key ☟
9.6.7 Binary Search Tree: GATE CSE 2003 | Question: 63, ISRO2009-25
A data structure is required for storing a set of integers such that each of the following operations can be
done in time, where is the number of elements in the set.
Which of the following data structures can be used for this purpose?
Answer key ☟
The following numbers are inserted into an empty binary search tree in the given order:
. What is the height of the binary search tree (the height is the maximum distance of
a leaf node from the root)?
A. B. C. D.
gatecse-2004 data-structures binary-search-tree easy isro2009
Answer key ☟
A program takes as input a balanced binary search tree with leaf nodes and computes the value of a
function for each node . If the cost of computing is:
A. B.
C. D.
gatecse-2004 binary-search-tree normal data-structures
Answer key ☟
Postorder traversal of a given binary search tree, produces the following sequence of keys
Which one of the following sequences of keys can be the result of an in-order traversal of the tree ?
A.
B.
C.
D.
Answer key ☟
How many distinct binary search trees can be created out of distinct keys?
A. B. C. D.
gatecse-2005 data-structures binary-search-tree counting normal
Answer key ☟
You are given the postorder traversal, , of a binary search tree on the elements . You have
to determine the unique binary search tree that has as its postorder traversal. What is the time
complexity of the most efficient algorithm for doing this?
A.
B.
C.
D. None of the above, as the tree cannot be uniquely determined
Answer key ☟
The worst case running time to search for an element in a balanced binary search tree with elements
is
A. B.
C. D.
gatecse-2012 data-structures normal binary-search-tree
Answer key ☟
A. B.
C. D.
gatecse-2013 data-structures binary-search-tree normal
Answer key ☟
Which one of the following is the tightest upper bound that represents the time complexity of inserting
an object into a binary search tree of nodes?
A. B. C. D.
gatecse-2013 data-structures easy binary-search-tree
Answer key ☟
Suppose we have a balanced binary search tree holding numbers. We are given two numbers and
and wish to sum up all the numbers in that lie between and . Suppose there are such
numbers in . If the tightest upper bound on the time to compute the sum is , the
value of is ______.
gatecse-2014-set3 data-structures binary-search-tree numerical-answers normal
Answer key ☟
9.6.17 Binary Search Tree: GATE CSE 2015 Set 1 | Question: 10
Which of the following is/are correct in order traversal sequence(s) of binary search tree(s)?
I.
II.
III.
IV.
Answer key ☟
What are the worst-case complexities of insertion and deletion of a key in a binary search tree?
Answer key ☟
While inserting the elements in an empty binary search tree (BST) in the sequence
shown, the element in the lowest level is
A. B. C. D.
gatecse-2015-set3 data-structures binary-search-tree easy
Answer key ☟
The number of ways in which the numbers can be inserted in an empty binary search
tree, such that the resulting tree has height , is _________.
Answer key ☟
Let be a binary search tree with nodes. The minimum and maximum possible heights of are:
Note: The height of a tree with a single node is .
Answer key ☟
9.6.22 Binary Search Tree: GATE CSE 2017 Set 2 | Question: 36
A.
B.
C.
D.
Answer key ☟
In a balanced binary search tree with elements, what is the worst case time complexity of reporting all
elements in range ? Assume that the number of reported elements is .
A. B.
C. D.
gatecse-2020 data-structures binary-search-tree 2-marks
Answer key ☟
The preorder traversal of a binary search tree is . Which one of the following
is the postorder traversal of the tree?
A. B.
C. D.
gatecse-2020 binary-search-tree 1-mark
Answer key ☟
A binary search tree contains distinct elements. What is the time complexity of picking an element
in that is smaller than the maximum element in ?
A. B. C. D.
gatecse-2021-set1 data-structures binary-search-tree time-complexity 1-mark
Answer key ☟
Suppose a binary search tree with distinct elements is also a complete binary tree. The tree is
stored using the array representation of binary heap trees. Assuming that the array indices start with
the largest element of the tree is stored at index ______________ .
gatecse-2022 numerical-answers data-structures binary-search-tree 1-mark
Answer key ☟
You are given a set of distinct integers. A binary search tree is created by inserting all elements of
one by one, starting with an empty tree. The tree follows the convention that, at each node, all
values stored in the left subtree of the node are smaller than the value stored at the node. You are not aware of
the sequence in which these values were inserted into , and you do not have access to .
Which one of the following statements is TRUE?
gatecse2024-set2 binary-search-tree
Answer key ☟
The numbers are inserted in a binary search tree in some order. In the resulting tree, the right
subtree of the root contains nodes. The first number to be inserted in the tree must be
A. B. C. D.
gateit-2005 data-structures normal binary-search-tree
Answer key ☟
A binary search tree contains the numbers When the tree is traversed in pre-order and
the values in each node printed out, the sequence of values obtained is If the tree is
traversed in post-order, the sequence obtained would be
A. B.
C. D.
gateit-2005 data-structures binary-search-tree normal
Answer key ☟
Suppose that we have numbers between and in a binary search tree and want to search for the
number . Which of the following sequences CANNOT be the sequence of nodes examined?
A. B.
C. D.
gateit-2006 data-structures binary-search-tree normal
Answer key ☟
When searching for the key value in a binary search tree, nodes containing the key values
are traversed, not necessarily in the order given. How many different orders are
possible in which these key values can occur on the search path from the root to the node containing the value
?
A. B. C. D.
gateit-2007 data-structures binary-search-tree normal
Answer key ☟
9.6.32 Binary Search Tree: GATE IT 2008 | Question: 71
A Binary Search Tree (BST) stores values in the range to . Consider the following sequence of
keys.
I.
II.
III.
IV.
Suppose the BST has been unsuccessfully searched for key . Which all of the above sequences list nodes in
the order in which we could have encountered them in the search?
A. II and III only B. I and III only C. III and IV only D. III only
gateit-2008 data-structures binary-search-tree normal
Answer key ☟
A Binary Search Tree (BST) stores values in the range to . Consider the following sequence of
keys.
I.
II.
III.
IV.
Answer key ☟
A. B. C. D.
gateit-2008 data-structures binary-search-tree normal
Answer key ☟
9.6.35 Binary Search Tree: GATE Overflow Test Series | Mock GATE | Test 3 | Question: 42
Answer key ☟
9.6.36 Binary Search Tree: GATE Overflow Test Series | Mock GATE | Test 5 | Question: 46
While searching the key value in a binary search tree, key values and are traversed
not necessarily in the order given. How many different orders are possible in which these key values can
occur on the search path from the root to the node containing value ?
go2025-mockgate-5 numerical-answers data-structures binary-search-tree 2-marks
Answer key ☟
9.6.37 Binary Search Tree: GATE Overflow Test Series | Mock GATE | Test 5 | Question: 47
Consider a C function print() which takes a root of binary search tree and a positive number as
arguments as given below:
struct node
{
int data;
struct node *left, *right;
};
int count = 0;
void print(struct node *root, int k)
{
if (root!=NULL && count < k)
{
print(root -> right, k);
count++;
if(count == k)
printf("%d", root -> data);
print(root -> left, k);
}
}
What is the sum of all the values output by print(root, ), where root represents root of the following Binary
Search Tree? (You can assume the binary search tree to be terminated properly by NULLs)
Answer key ☟
9.6.38 Binary Search Tree: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 16
What is the best time complexity for finding the lowest common ancestor for two keys and
in a height balanced binary search tree of ? You can assume that both and exist in the tree.
A. B. C. D.
go2025-mockgate-6 data-structures binary-search-tree 1-mark
Answer key ☟
9.6.39 Binary Search Tree: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 43
In a binary search tree, the following key values (not necessarily in the order given) are encountered
while searching for the key
The total number of possible orders in which the given keys of the binary search tree could have been visited is
_________
go2025-mockgate-6 numerical-answers data-structures binary-search-tree 2-marks
Answer key ☟
9.6.40 Binary Search Tree: UGC NET CSE | August 2016 | Part 2 | Question: 23
The runtime for traversing all the nodes of a binary search tree with nodes and printing them in an
order is
A. B. C. D.
ugcnetcse-aug2016-paper2 data-structures binary-search-tree
Answer key ☟
9.6.41 Binary Search Tree: UGC NET CSE | December 2005 | Part 2 | Question: 25
Which traversal techniques lists the nodes of a binary search tree in ascending order?
Answer key ☟
9.6.42 Binary Search Tree: UGC NET CSE | July 2016 | Part 2 | Question: 21
If we remove the root node which of the node from the left subtree will be the new root?
A. 11 B. 12 C. 13 D. 16
data-structures binary-tree binary-search-tree ugcnetcse-july2016-paper2
Answer key ☟
9.6.43 Binary Search Tree: UGC NET CSE | July 2016 | Part 3 | Question: 35
Suppose that we have numbers between 1 and 1,000 in a binary search tree and want to search for the
number 364. Which of the following sequences could not be the sequence of nodes examined?
A. 925, 221, 912, 245, 899, 259, 363, 364 B. 3, 400, 388, 220, 267, 383, 382, 279,
364
C. 926, 203, 912, 241, 913, 246, 364 D. 3, 253, 402, 399, 331, 345, 398, 364
ugcnetcse-july2016-paper3 data-structures binary-search-tree
Answer key ☟
9.6.44 Binary Search Tree: UGC NET CSE | July 2018 | Part 2 | Question: 26
A binary search tree in which every non-leaf node has non-empty left and right subtrees is called a
strictly binary tree. Such a tree with 19 leaves:
Answer key ☟
9.6.45 Binary Search Tree: UGC NET CSE | September 2013 | Part 3 | Question: 41
Given a binary search trees for a set of keys with the following probabilities
A. B. C. D.
ugcnetcse-sep2013-paper3 data-structures binary-search-tree
Answer key ☟
It is possible to construct a binary tree uniquely whose pre-order and post-order traversals are given?
gate1987 binary-tree data-structures normal true-false
Answer key ☟
If the number of leaves in a tree is not a power of then the tree is not a binary tree.
gate1987 data-structures binary-tree true-false
Answer key ☟
Answer key ☟
9.7.4 Binary Tree: GATE CSE 1988 | Question: 7i
Define the height of a binary tree or subtree and also define a height-balanced (AVL) tree.
gate1988 normal descriptive data-structures binary-tree
Answer key ☟
Consider the tree given in the below figure, insert and show the new balance factors that would arise
if the tree is not rebalanced. Finally, carry out the required rebalancing of the tree and show the new tree
with the balance factors on each mode.
Answer key ☟
A. Overlaying is used to run a program, which is longer than the address space of the computer.
B. Optimal binary search tree construction can be performed efficiently by using dynamic programming.
C. Depth first search cannot be used to find connected components of a graph.
D. Given the prefix and postfix walls over a binary tree, the binary tree can be uniquely constructed.
Answer key ☟
The total external path length, of a binary tree with external nodes is, , where
A. always. B. always.
C. Equal to always. D. for some special trees.
gate1990 normal data-structures binary-tree multiple-selects
Answer key ☟
The weighted external path length of the binary tree in figure is ______
gate1991 binary-tree data-structures normal numerical-answers
Answer key ☟
If the binary tree in figure is traversed in inorder, then the order in which the nodes will be visited is
______
Answer key ☟
Answer key ☟
Answer key ☟
Outline a procedure in Pseudo-code to delete an arbitrary node from such a binary tree with nodes that
preserves the structures. What is the worst-case time complexity of your procedure?
Answer key ☟
Prove by the principal of mathematical induction that for any binary tree, in which every non-leaf node
has -descendants, the number of leaves in the tree is one more than the number of non-leaf nodes.
gate1993 data-structures binary-tree normal descriptive
Answer key ☟
A rooted tree with nodes has its nodes numbered to in pre-order. When the tree is traversed in
post-order, the nodes are visited in the order .
Reconstruct the original tree from this information, that is, find the parent of each node, and show the tree
diagrammatically.
gate1994 data-structures binary-tree normal descriptive
Answer key ☟
A. B. C. D.
gate1995 data-structures binary-tree normal
Answer key ☟
What is the number of binary trees with nodes which when traversed in post-order give the sequence
Draw all these binary trees.
gate1995 data-structures binary-tree normal descriptive
Answer key ☟
In the balanced binary tree in the below figure, how many nodes will become unbalanced when a node is
inserted as a child of the node “g”?
A. B. C. D.
gate1996 data-structures binary-tree normal
Answer key ☟
Which of the following sequences denotes the post order traversal sequence of the below tree?
A. B.
C. D.
gate1996 data-structures binary-tree easy
Answer key ☟
A size-balanced binary tree is a binary tree in which for every node the difference between the number
of nodes in the left and right subtree is at most . The distance of a node from the root is the length of
the path from the root to the node. The height of a binary tree is the maximum distance of a leaf node from the
root.
A. Prove, by using induction on h, that a size-balance binary tree of height contains at least nodes.
B. In a size-balanced binary tree of height , how many nodes are at distance from the root? Write
only the answer without any explanations.
gate1997 data-structures binary-tree normal descriptive proof
Answer key ☟
Draw the binary tree with node labels for which the inorder and postorder traversals
result in the following sequences:
Inorder:
Postorder:
gate1998 data-structures binary-tree descriptive
Answer key ☟
Consider the following nested representation of binary trees: indicates and are the left and
right subtrees, respectively, of node . Note that and may be , or further nested. Which of
the following represents a valid binary tree?
A. B.
C. D.
gatecse-2000 data-structures binary-tree easy
Answer key ☟
Let LASTPOST, LASTIN and LASTPRE denote the last vertex visited `in a postorder, inorder and
preorder traversal respectively, of a complete binary tree. Which of the following is always true?
Answer key ☟
A weight-balanced tree is a binary tree in which for each node, the number of nodes in the left sub tree is
at least half and at most twice the number of nodes in the right sub tree. The maximum possible height
(number of nodes on the path from the root to the furthest leaf) of such a tree on n nodes is best described by
which of the following?
A. B. C. D.
gatecse-2002 data-structures binary-tree normal
Answer key ☟
Draw all binary trees having exactly three nodes labeled and on which preorder traversal gives
the sequence .
gatecse-2002 data-structures binary-tree easy descriptive
Answer key ☟
9.7.25 Binary Tree: GATE CSE 2004 | Question: 35
Consider the label sequences obtained by the following pairs of traversals on a labeled binary tree.
Which of these pairs identify a tree uniquely?
Answer key ☟
The value returned by the function when a pointer to the root of a non-empty tree is passed as
argument is
A. The number of leaf nodes in the tree B. The number of nodes in the tree
C. The number of internal nodes in the D. The height of the tree
tree
gatecse-2004 data-structures binary-tree normal
Answer key ☟
A scheme for storing binary trees in an array is as follows. Indexing of starts at instead of . the
root is stored at . For a node stored at , the left child, if any, is stored in and the right
child, if any, in . To be able to store any binary tree on n vertices the minimum size of should be
A. B. C. D.
gatecse-2006 data-structures binary-tree normal
Answer key ☟
The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum
number of nodes in a binary tree of height is:
A. B. C. D.
Answer key ☟
The maximum number of binary trees that can be formed with three unlabeled nodes is:
A. B. C. D.
gatecse-2007 data-structures binary-tree normal
Answer key ☟
A. B.
C. D.
gatecse-2007 data-structures binary-tree normal ugcnetcse-june2015-paper2
Answer key ☟
Consider the following C program segment where represents a node in a binary tree:
struct CellNode {
struct CellNode *leftChild;
int element;
struct CellNode *rightChild;
};
The value returned by when a pointer to the root of a binary tree is passed as its argument is:
A. the number of nodes in the tree B. the number of internal nodes in the tree
C. the number of leaf nodes in the tree D. the height of the tree
gatecse-2007 data-structures binary-tree normal
Answer key ☟
In a binary tree with nodes, every node has an odd number of descendants. Every node is considered
to be its own descendant. What is the number of nodes in the tree that have exactly one child?
A. B. C. D.
gatecse-2010 data-structures binary-tree normal
Answer key ☟
We are given a set of distinct elements and an unlabeled binary tree with nodes. In how many ways
can we populate the tree with the given set so that it becomes a binary search tree?
A. B. C. D.
gatecse-2011 binary-tree normal
Answer key ☟
The height of a tree is defined as the number of edges on the longest path in the tree. The function shown
in the pseudo-code below is invoked as height (root) to compute the height of a binary tree rooted at the
tree pointer root.
int height(treeptr n)
{ if(n == NULL) return -1;
if(n -> left == NULL)
if(n -> right == NULL) return 0;
else return B1; // Box 1
A. B1: ; B2:
B. B1: ; B2:
C. B1: ; B2:
D. B1: ; B2:
Answer key ☟
Consider a rooted n node binary tree represented using pointers. The best upper bound on the time
required to determine the number of subtrees having exactly nodes is . Then the value of
is __________.
gatecse-2014-set1 data-structures binary-tree numerical-answers normal
Answer key ☟
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 are
Answer key ☟
A binary tree T has leaves. The number of nodes in T having two children is ______.
gatecse-2015-set2 data-structures binary-tree normal numerical-answers
Answer key ☟
Consider a binary tree T that has leaf nodes. Then the number of nodes in T that have exactly two
children are ______.
gatecse-2015-set3 data-structures binary-tree normal numerical-answers
Answer key ☟
The New-order traversal of the expression tree corresponding to the reverse polish expression
3 4 * 5 - 2 ^ 6 7 * 1 + -
is given by:
A.
B.
C.
D.
Answer key ☟
The postorder traversal of a binary tree is . The inorder traversal of the same tree is
. The height of a tree is the length of the longest path from the root to any leaf. The
height of the binary tree above is _____
gatecse-2018 data-structures binary-tree numerical-answers 1-mark
Answer key ☟
Let be a full binary tree with leaves. (A full binary tree has every level full.) Suppose two leaves
and of are chosen uniformly and independently at random. The expected value of the distance
between and in (ie., the number of edges in the unique path between and ) is (rounded off to decimal
places) _________.
gatecse-2019 numerical-answers data-structures binary-tree 2-marks
Answer key ☟
Consider a complete binary tree with nodes. Let denote the set of first elements obtained by
performing Breadth-First Search starting from the root. Let denote the set of first elements
obtained by performing Depth-First Search starting from the root.
Answer key ☟
When is called with a pointer to the root node of the given binary tree, what will it print?
A. B.
C. D.
gatecse-2023 data-structures binary-tree 2-marks
Answer key ☟
i. Preorder
ii. Inorder
iii. Postorder
Which of the following traversal options is/are sufficient to uniquely reconstruct the full binary tree?
A. B. C. D.
gate-ds-ai-2024 data-structures binary-tree
Answer key ☟
9.7.45 Binary Tree: GATE DS&AI 2024 | Question: 42
Let , and represent height, number of internal nodes, number of leaf nodes, and the total
number of nodes respectively in a rooted binary tree.
Which of the following statements is/are always TRUE?
A. B.
C. D.
gate-ds-ai-2024 data-structures binary-tree
Answer key ☟
Which one of the following binary trees has its inorder and preorder traversals as and ,
respectively?
A.
B.
C. D.
gateit-2004 binary-tree easy data-structures
Answer key ☟
In a binary tree, for every node the difference between the number of nodes in the left and right subtrees
is at most . If the height of the tree is , then the minimum number of nodes in the tree is
A. B. C. D.
gateit-2005 data-structures binary-tree normal
Answer key ☟
An array of distinct integers is interpreted as a complete binary tree. The index of the first element
of the array is . The index of the parent of element , is?
A. B.
C. D.
Answer key ☟
An array of n distinct integers is interpreted as a complete binary tree. The index of the first element
of the array is . If the root node is at level , the level of element , , is
A. B.
C. D.
gateit-2006 data-structures binary-tree normal
Answer key ☟
In a binary tree, the number of internal nodes of degree is , and the number of internal nodes of
degree is . The number of leaf nodes in the binary tree is
A. B. C. D.
gateit-2006 data-structures binary-tree normal
Answer key ☟
The following three are known to be the preorder, inorder and postorder sequences of a binary tree. But
it is not known which is which.
I.
II.
III.
Answer key ☟
A binary tree with nodes has , and nodes of degree one, two and three respectively. The
degree of a node is defined as the number of its neighbours.
can be expressed as
A. B.
C. D.
gateit-2008 data-structures binary-tree normal
Answer key ☟
A binary tree with nodes has , and nodes of degree one, two and three respectively. The
degree of a node is defined as the number of its neighbours.
Starting with the above tree, while there remains a node of degree two in the tree, add an edge between the
two neighbours of and then remove from the tree. How many edges will remain at the end of the process?
A. B.
C. D.
gateit-2008 data-structures binary-tree normal
Answer key ☟
9.7.54 Binary Tree: GATE Overflow Test Series | Mock GATE | Test 1 | Question: 17
A perfect binary tree is a binary tree in which all interior nodes have two children and all leaves have the
same depth or same level. Let be a full binary tree with height containing nodes. Which
one of the following is the value of the sum of height of the nodes of the tree (assume height of a leaf node as
)?
A. B.
C. D.
go2025-mockgate-1 binary-tree data-structures
Answer key ☟
9.7.55 Binary Tree: UGC NET CSE | December 2009 | Part 2 | Question: 21
If the number of leaves in a strictly binary tree is an odd number, then what can you say with full
conviction about total number of nodes in the tree ?
(A) It is an odd number.
(B) It is an even number.
(C) It cannot be equal to the number of leaves.
(D) It is always greater than twice the number of leaves.
ugcnetcse-dec2009-paper2 data-structures binary-tree
Answer key ☟
9.7.56 Binary Tree: UGC NET CSE | June 2009 | Part 2 | Question: 27
A. 2k-1
B. 2k-1
C. 2k
D. 2k+1
Answer key ☟
9.7.57 Binary Tree: UGC NET CSE | June 2012 | Part 2 | Question: 27
The Inorder traversal of the tree will yield a sorted listing of elements of tree in
Answer key ☟
9.7.58 Binary Tree: UGC NET CSE | June 2012 | Part 2 | Question: 8
Answer key ☟
9.7.59 Binary Tree: UGC NET CSE | October 2020 | Part 2 | Question: 23
A complete -ary tree is a tree in which each node has children or no children. Let be the number of
internal nodes and be the number of leaves in a complete -ary tree. If , and , what is
the value of ?
A. B. C. D.
ugcnetcse-oct2020-paper2 data-structures binary-tree
Answer key ☟
9.7.60 Binary Tree: UGC NET CSE | September 2013 | Part 2 | Question: 11
A. B. C. D.
binary-tree data-structures ugcnetsep2013ii
Answer key ☟
9.7.61 Binary Tree: UGC NET CSE | September 2013 | Part 2 | Question: 21
A. a b f e j k n o p c d g l m h i B. a b c d e f j k n o p g l m h i
C. a b e j k n o p f c d g l m h i D. j e n o p k f b c l m g h I d a
ugcnetsep2013ii data-structures binary-tree
Answer key ☟
If is chosen from a universal collection of hash functions and is used to hash keys into a table of size
, where , the expected number of collisions involving a particular key is less than
__________.
A. B. C. D.
ugcnetjan2017ii cryptography hashing data-structures
Answer key ☟
Let be the graph with vertices numbered to . Two vertices and are adjacent if
or . The number of connected components in is
A. B. C. D.
gate1997 data-structures normal graph-theory
Answer key ☟
9.9.2 Data Structures: GATE CSE 2005 | Question: 2
Answer key ☟
Let be a directed graph where is the set of vertices and the set of edges. Then which
one of the following graphs has the same strongly connected components as ?
A. = where
B. = where
C. = where there is a path of length from to in
D. = where is the set of vertices in which are not isolated
Answer key ☟
Consider the weighted undirected graph with vertices, where the weight of edge is given by the
entry in the matrix .
W=
The largest possible integer value of , for which at least one shortest path between some pair of vertices will
contain the edge with weight is ___________.
gatecse-2016-set1 data-structures graph-theory normal numerical-answers
Answer key ☟
The value of is .
Answer key ☟
Match the items in Column with the items in Column in the following table:
A.
B.
C.
D.
Answer key ☟
9.9.7 Data Structures: UGC NET CSE | December 2011 | Part 2 | Question: 1
Answer key ☟
9.9.8 Data Structures: UGC NET CSE | July 2016 | Part 2 | Question: 2
The number of different spanning trees in complete graph, and bipartite graph, have ____ and
___ respectively.
Answer key ☟
9.9.9 Data Structures: UGC NET CSE | July 2016 | Part 2 | Question: 5
A clique in a simple undirected graph is a complete subgraph that is not contained in any larger
complete subgraph. How many cliques are there in a graph shown below?
A. 2 B. 4 C. 5 D. 6
ugcnetcse-july2016-paper2 data-structures graph-theory
Answer key ☟
9.9.10 Data Structures: UGC NET CSE | June 2012 | Part 2 | Question: 49
Answer key ☟
9.9.11 Data Structures: UGC NET CSE | June 2013 | Part 3 | Question: 49
Suppose you want to delete the name that occurs before ‘Vivek’ in an alphabetical listing. Which one of
the following data structures shall be most efficient for this operation?
Answer key ☟
9.9.12 Data Structures: UGC NET CSE | October 2020 | Part 2 | Question: 63
i. Minimax search is breadth-first; it processes all the nodes at a level before moving to a node in next level.
ii. The effectiveness of the alpha-beta pruning is highly dependent on the order in which the states are
examined
iii. The alpha-beta search algorithms computes the same optimal moves as minimax algorithm
iv. Optimal play in games of imperfect information does not require reasoning about the current and future
belief states of each player
Answer key ☟
9.9.13 Data Structures: UGC NET CSE | September 2013 | Part 3 | Question: 15
Which of the following is the minimum cost for an assignment problem given below?
A. B. C. D.
ugcnetcse-sep2013-paper3 data-structures
Answer key ☟
For a given -ary tree, the relationship between leaf nodes and internal nodes is represented by the
graph given below. What is the value of ? Take necessary approximations to nearest integer if
required (Integer type)
Answer key ☟
Ginmans Stack are a kind of special data structure in which if there are odd number of elements then the
middle most element is popped out and printed on the screen. In case of even number of elements the
recently popped out element is again pushed back either on the top or bottom of the stack randomly.
Assume initially Ginmans Stack has elements where is even, and denotes the bottom
and top of the stack respectively.
Consider the following printing sequences:
('*' here denotes repetitions zero or more number of times)
Which of the following printing sequence is not possible?
i.
ii.
iii.
iv.
The path length of a node is defined as the number of edges from root to that node. For a given full
binary tree, the sum of path length of all leaf nodes is equal to . The total number of internal nodes
present is equal to . What is the sum of path length of all internal nodes?
(Note: A full binary tree is a tree in which every node other than the leaves has 2 children)
go-mockgate-1 binary-tree data-structures
Answer key ☟
9.11.1 Graph Algorithms: UGC NET CSE | July 2018 | Part 2 | Question: 24
Answer key ☟
9.12.1 Graph Connectivity: UGC NET CSE | September 2013 | Part 2 | Question: 20
I. A graph in which there is a unique path between every pair of vertices is a tree.
II. A connected graph with e=v-1 is a tree
III. A connected graph with e=v-1 that has no circuit is a tree
Answer key ☟
An advantage of chained hash table (external hashing) over the open addressing scheme is
Answer key ☟
Answer key ☟
Consider a hash table with buckets, where external (overflow) chaining is used to resolve collisions.
The hash function is such that the probability that a key value is hashed to a particular bucket is . The
hash table is initially empty and distinct values are inserted in the table.
A. What is the probability that bucket number is empty after the insertion?
B. What is the probability that no collision has occurred in any of the insertions?
C. What is the probability that the first collision occurs at the insertion?
Answer key ☟
Answer key ☟
Consider a hash table of size seven, with starting index zero, and a hash function .
Assuming the hash table is initially empty, which of the following is the contents of the table when the
sequence is inserted into the table using closed hashing? Note that − denotes an empty location in the
table.
A. , −, −, −, −, −, B. , −, −, −,
C. , −, −, −, −, −, D. , −, −, −,
gatecse-2007 data-structures hashing easy
Answer key ☟
The keys and are inserted into an initially empty hash table of length using
open addressing with hash function and linear probing. What is the resultant hash
table?
A. B. C. D.
Answer key ☟
A hash table of length uses open addressing with hash function , and linear
probing. After inserting values into an empty hash table, the table is shown as below
Which one of the following choices gives a possible order in which the key values could have been inserted in
the table?
A. B.
C. D.
gatecse-2010 data-structures hashing normal
Answer key ☟
A hash table of length uses open addressing with hash function , and linear
probing. After inserting values into an empty hash table, the table is shown as below
How many different insertion sequences of the key values using the same hash function and linear probing will
result in the hash table shown above?
A. B. C. D.
data-structures hashing normal gatecse-2010
Answer key ☟
Consider a hash table with slots. The hash function is . The collisions are resolved
by chaining. The following keys are inserted in the order: . The
maximum, minimum, and average chain lengths in the hash table, respectively, are
Answer key ☟
Consider a hash table with slots. Collisions are resolved using chaining. Assuming simple uniform
hashing, what is the probability that the first slots are unfilled after the first insertions?
A. B.
C. D.
gatecse-2014-set3 data-structures hashing probability normal
Answer key ☟
Which one of the following hash functions on integers will distribute keys most uniformly over
buckets numbered to for ranging from to ?
A. B.
C. D.
gatecse-2015-set2 data-structures hashing normal
Answer key ☟
Given that hash table with slots that stores elements, the load factor for is _________.
gatecse-2015-set3 data-structures hashing easy numerical-answers
Answer key ☟
Consider performing uniform hashing on an open address hash table with load factor , where
elements are stored in the table with slots. The expected number of probes in an unsuccessful
search is at most .
Inserting an element in this hash table requires at most probes, on average.
A. B. C. D.
gate-ds-ai-2024 data-structures hashing uniform-hashing
Answer key ☟
I. A hash function takes a message of arbitrary length and generates a fixed length code.
II. A hash function takes a message of fixed length and generates a code of variable length.
III. A hash function may give the same hash value for distinct messages.
A. I only B. II and III only C. I and III only D. II only
gateit-2006 data-structures hashing normal
Answer key ☟
Consider a hash function that distributes keys uniformly. The hash table size is . After hashing of how
many keys will the probability that any new key hashed collides with an existing one exceed .
A. B. C. D.
gateit-2007 data-structures hashing probability normal
Answer key ☟
Consider a hash table of size that uses open addressing with linear probing. Let
be the hash function used. A sequence of records with keys
is inserted into an initially empty hash table, the bins of which are indexed from zero to ten. What is the index of
the bin into which the last record is inserted?
A. B. C. D.
gateit-2008 data-structures hashing normal
Answer key ☟
A. B. C. D.
ugcnetcse-aug2016-paper3 data-structures hashing
Answer key ☟
Answer key ☟
A hash function f defined as f(key) = key mod 7, with linear probing used to resolve collisions. Insert
the keys 37, 38, 72, 48, 98 and 11 into the table indexed from 0 to 6.
(A) 3
(B) 4
(C) 5
(D) 6
ugcnetcse-dec2009-paper2 data-structures hashing
Answer key ☟
A hash table has space for records, then the probability of collision before the table is % full.
A. B. C. D.
ugcnetcse-dec2011-paper2 data-structures hashing
Answer key ☟
A hash function defined as , with linear probing is used to insert keys 55, 58,
68, 91, 27, 145. What will be the location of 79?
A. 1 B. 2 C. 3 D. 4
ugcnetcse-dec2012-paper2 data-structures hashing
Answer key ☟
A. B.
C. D.
ugcnetcse-dec2015-paper2 data-structures hashing
Answer key ☟
9.13.23 Hashing: UGC NET CSE | July 2018 | Part 2 | Question: 23
A hash function h defined h(key)=key mod 7, with linear probing, is used to insert the keys 44, 45, 79,
55, 91, 18, 63 into a table indexed from 0 to 6. What will be the location of key 18?
A. 3 B. 4 C. 5 D. 6
ugcnetcse-july2018-paper2 data-structures hashing
Answer key ☟
Consider a hash table of sze seven, with starting index zero, and a hash function (7x+3) mod 4.
Assuming that the hash table is initially empty, which of the following is the contents of the table when
the sequence 1, 3, 8, 10 is inserted into the table using closed hashing? Here "____" denotes an empty location
in the table.
Answer key ☟
A chained hash table has an array size of . What is the maximum number of entries that can be
placed in the table ?
A. B.
C. D. There is no upper limit
ugcnetcse-june2010-paper2 data-structures hashing
Answer key ☟
Searching for an element in the hash table requires time for the _________time, whereas for direct
addressing it holds for the _______ time.
Answer key ☟
If is chosen from a universal collection of hash functions and is used to hash keys into a table of size
, where , the expected number of collisions involving a particular key is
Answer key ☟
Consider a hash table of size seven with starting index zero and a hash function .
Assuming the hash table is initially empty. Which of the following is the content of the table when the
sequence , is inserted into the table using closed hashing? Here " denotes an empty location in the
table.
A. _,_ B. _,
C. _, ,_, D. _ ,_
ugcnetcse-june2023-paper2 data-structures hashing
Answer key ☟
Consider a hash table of size m=100 and the hash function h(k)=floor (m(kA mod 1)) for
. Compute the location to which the key k=123456 is placed in hash table
A. 77 B. 82 C. 88 D. 89
ugcnetcse-june2015-paper3 data-structures hashing
Answer key ☟
9.14.1 Heaps: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 46
The number of possible min-heaps containing each value from exactly once is
__________
go2025-mockgate-2 numerical-answers heaps
Answer key ☟
9.14.2 Heaps: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 47
A. B. C. D.
go2025-mockgate-2 heaps
Answer key ☟
9.14.3 Heaps: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 48
A binary search tree is a binary tree with the further property that, for every node,
1. The value of the element in the left child is less than the value of the element at the node.
2. The value of the element in the right child is greater than the value of the element at the node.
3. A max-heap is a complete binary tree with the property that for every node other than the root,
Lets define a Unrestricted Max-heap as a Max-heap without the completeness requirement- that is it is just a
normal binary tree with every root having value greater than its child nodes. Suppose there is a binary search
tree with distinct nodes. If is the probability that this BST is also an Unrestricted Max-heap, the value of
________
Answer key ☟
9.14.4 Heaps: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 49
Suppose from the set of all possible distinct binary trees with nodes, one tree is chosen at random.
What is the probability that this chosen tree is a heap (either min or max)?
A. B. C. D.
go2025-mockgate-2 heaps binary-tree
Answer key ☟
Answer key ☟
Which of the following is essential for converting an infix expression to the postfix form efficiently?
Answer key ☟
Answer key ☟
Assume that the operators are left associative and is right associative. The order of precedence
(from highest to lowest) is . The postfix expression corresponding to the infix expression
is
A.
B.
C.
D.
Answer key ☟
The following postfix expression with single digit operands is evaluated using a stack:
Note that is the exponentiation operator. The top two elements of the stack after the first is evaluated are
A. B. C. D.
gatecse-2007 data-structures stack normal infix-prefix isro2016
Answer key ☟
9.15.6 Infix Prefix: UGC NET CSE | August 2016 | Part 2 | Question: 25
A. B. C. D.
ugcnetcse-aug2016-paper2 data-structures infix-prefix
Answer key ☟
9.15.7 Infix Prefix: UGC NET CSE | June 2012 | Part 2 | Question: 1
Answer key ☟
9.16.1 Linear Probing: UGC NET CSE | December 2005 | Part 2 | Question: 22
A hash function defined as , with linear probing it is used to insert the key
into a table index from to . What will be the locations of :
A. B. C. D.
ugcnetcse-dec2005-paper2 data-structures hashing linear-probing
Answer key ☟
Answer key ☟
a.
b.
Answer key ☟
Express the following list in terms of a linked list structure suitable for internal representation.
Answer key ☟
Consider a singly linked list having nodes. The data items are stored in these nodes.
Let be a pointer to the node in which is stored. A new data item stored in node
with address is to be inserted. Give an algorithm to insert into the list to obtain a list having items
in order without using the header.
gate1993 data-structures linked-list normal descriptive
Answer key ☟
Linked lists are not suitable data structures for which one of the following problems?
Answer key ☟
I. As the number of entries in a hash table increases, the number of collisions increases.
II. Recursive programs are efficient
III. The worst case complexity for Quicksort is
IV. Binary search using a linear linked list is efficient
Answer key ☟
9.17.7 Linked List: GATE CSE 1997 | Question: 1.4
The concatenation of two lists is to be performed on time. Which of the following implementations
of a list should be used?
Answer key ☟
Consider the following piece of 'C' code fragment that removes duplicates from an ordered list of
integers.
Node *remove-duplicates (Node* head, int *j)
{
Node *t1, *t2; *j=0;
t1 = head;
if (t1! = NULL)
t2 = t1 ->next;
else return head;
*j = 1;
if(t2 == NULL) return head;
while (t2 != NULL)
{
if (t1.val != t2.val) ----------------> (S1)
{
(*j)++;
t1 -> next = t2;
t1 = t2; -----> (S2)
}
t2 = t2 ->next;
}
t1 -> next = NULL;
return head;
}
Answer key ☟
Write a constant time algorithm to insert a node with data just before the node with address of a
singly linked list.
gate1999 data-structures linked-list descriptive
Answer key ☟
In the worst case, the number of comparisons needed to search a single linked list of length for a given
element is
A. B. C. D.
gatecse-2002 easy data-structures linked-list
Answer key ☟
Answer key ☟
A circularly linked list is used to represent a Queue. A single variable is used to access the Queue. To
which node should point such that both the operations and can be performed in
constant time?
Answer key ☟
Suppose each set is represented as a linked list with elements in arbitrary order. Which of the operations
among will be the slowest?
A. only B.
C. D.
gatecse-2004 data-structures linked-list normal
Answer key ☟
The following C function takes a single-linked list of integers as a parameter and rearranges the elements
of the list. The function is called with the list containing the integers in the given order.
What will be the contents of the list after function completes execution?
struct node {
int value;
struct node *next;
};
A. B.
C. D.
gatecse-2008 data-structures linked-list normal
Answer key ☟
The following C function takes a singly-linked list as input argument. It modifies the list by moving the
last element to the front of the list and returns the modified list. Some part of the code is left blank.
typedef struct node
{
int value;
struct node *next;
} Node;
Node *move_to-front(Node *head)
{
Node *p, *q;
if ((head == NULL) || (head -> next == NULL))
return head;
q = NULL;
p = head;
while (p->next != NULL)
{
q=p;
p=p->next;
}
_______________
return head;
A. ;
B. ;
C. ;
D. ;
Answer key ☟
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: delete, insert,
find, and decrease-key. What is the time complexity of all these operations put together?
A. B. C. D.
gatecse-2016-set2 data-structures linked-list time-complexity normal algorithms
Answer key ☟
Assuming that m and n point to valid NULL-terminated linked lists, invocation of join will
Answer key ☟
What is the worst case time complexity of inserting elements into an empty linked list, if the linked list
needs to be maintained in sorted order?
A. B. C. D.
gatecse-2020 linked-list 1-mark
Answer key ☟
Consider the problem of reversing a singly linked list. To take an example, given the linked list below,
Which one of the following statements is about the time complexity of algorithms that solve the above
problem in space?
A. The best algorithm for the problem takes time in the worst case.
B. The best algorithm for the problem takes time in the worst case.
C. The best algorithm for the problem takes time in the worst case.
D. It is not possible to reverse a singly linked list in space.
Answer key ☟
Let be a function that deletes a node in a singly-linked list given a pointer to the node and a
pointer to the head of the list. Similarly, let be another function that deletes a node in a doubly-
linked list given a pointer to the node and a pointer to the head of the list.
Let denote the number of nodes in each of the linked lists. Which one of the following choices is
about the worst-case time complexity of and
Answer key ☟
Let be a singly linked list. Let be the pointer to an intermediate node in the list. What is the
worst-case time complexity of the best-known algorithm to delete the node from the list ?
A. B. C. D.
gateit-2004 data-structures linked-list normal ambiguous
Answer key ☟
The following C function takes a singly-linked list of integers as a parameter and rearranges the
elements of the list. The list is represented as pointer to a structure. The function is called with the list
containing the integers in the given order. What will be the contents of the list after the function
completes execution?
struct node {int value; struct node *next;);
void rearrange (struct node *list) {
struct node *p, *q;
int temp;
if (!list || !list -> next) return;
p = list; q = list -> next;
while (q) {
temp = p -> value;
p -> value = q -> value;
q -> value = temp;
p = q -> next;
q = p ? p -> next : 0;
}
}
A. B.
C. D.
gateit-2005 data-structures linked-list normal
Answer key ☟
9.17.24 Linked List: UGC NET CSE | August 2016 | Part 2 | Question: 21
Consider an implementation of unsorted single linked list. Suppose it has its representation with a head
and a tail pointer (i.e. pointers to the first and last nodes of the linked list). Given the representation,
which of the following operation can not be implemented in time ?
Answer key ☟
9.17.25 Linked List: UGC NET CSE | December 2009 | Part 2 | Question: 24
(A) An algorithm to search for an element in a singly linked list requires 0(n)
operations in the worst case.
(B) An algorithm for deleting the first element in a singly linked list requires 0(n)
operations in the worst case.
(C) An algorithm for finding the maximum value in a circular linked list requires 0(n)
operations.
(D) An algorithm for deleting the middle node of a circular linked list requires 0(n)
operations.
ugcnetcse-dec2009-paper2 data-structures linked-list time-complexity
Answer key ☟
9.18.1 Max Heap: UGC NET CSE | July 2016 | Part 3 | Question: 33
A. [26, 13, 17, 14, 11, 9, 15] B. [26, 15, 14, 17, 11, 9, 13]
C. [26, 15, 17, 14, 11, 9, 13] D. [26, 15, 13, 14, 11, 9, 17]
ugcnetcse-july2016-paper3 data-structures max-heap
Answer key ☟
Consider a weighted complete graph on the vertex set such that the weight of the
edge is . The weight of minimum cost spanning tree of is :
A. B. C. D.
ugcnetcse-aug2016-paper3 data-structures minimum-spanning-tree
Answer key ☟
9.19.2 Minimum Spanning Tree: UGC NET CSE | December 2008 | Part 2 | Question: 3
The total number of spanning trees that can be drawn using five labeled vertices is:
1. 125
2. 64
3. 36
4. 16
Answer key ☟
Answer key ☟
A priority queue is used to implement a stack that stores characters. PUSH (C) is implemented as
INSERT where is an appropriate integer key chosen by the implementation. POP is
implemented as DELETEMIN . For a sequence of operations, the keys chosen are in
Answer key ☟
Let be a priority queue for maintaining a set of elements. Suppose is implemented using a max-
heap data structure. The operation extracts and deletes the maximum element
from . The operation inserts a new element in . The properties of a max-heap are
preserved at the end of each of these operations.
When contains elements, which one of the following statements about the worst case running time of these
two operations is
Answer key ☟
9.21.3 Priority Queue: UGC NET CSE | August 2016 | Part 3 | Question: 34
A priority queue is implemented as a max-heap. Initially, it has five elements. The levelorder traversal of
the heap is as follows :
20, 18, 15, 13, 12
Two new elements ‘10’ and ‘17’ are inserted in the heap in that order. The level-order traversal of the heap after
the insertion of the element is :
A. 20, 18, 17, 15, 13, 12, 10 B. 20, 18, 17, 12, 13, 10, 15
C. 20, 18, 17, 10, 12, 13, 15 D. 20, 18, 17, 13, 12, 10, 15
ugcnetcse-aug2016-paper3 data-structures priority-queue
Answer key ☟
9.21.4 Priority Queue: UGC NET CSE | June 2010 | Part 2 | Question: 22
Answer key ☟
9.22.1 Pseudocode: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 45
If the root of the below tree is passed as the first parameter and the second parameter has the value then the
value returned by the function will be _________
go2025-mockgate-2 numerical-answers binary-tree pseudocode
Answer key ☟
Suggest a data structure for representing a subset of integers from to . Following operations on the
set are to be performed in constant time (independent of cardinality of ).
Give pictorial examples of your data structure. Give routines for these operations in an English like language.
You may assume that the data structure has been suitable initialized. Clearly state your assumptions regarding
initialization.
gate1992 data-structures normal descriptive queue
Answer key ☟
A queue containing items and an empty stack are given. It is required to transfer all the items
from the queue to the stack, so that the item at the front of queue is on the TOP of the stack, and the
order of all other items are preserved. Show how this can be done in time using only a constant amount of
additional storage. Note that the only operations which can be performed on the queue and stack are Delete,
Insert, Push and Pop. Do not assume any implementation of the queue or stack.
gate1994 data-structures queue stack normal descriptive
Answer key ☟
Answer key ☟
What is the minimum number of stacks of size required to implement a queue of size ?
Answer key ☟
Let insert and delete operations be performed in an arbitrary order on an empty queue . Let and
be the number of push and pop operations performed respectively in the process. Which one of the following
is true for all and ?
A. and
B. and
C. and
D. and
Answer key ☟
A. f u l l : B. full:
empty: e m p t y :
C. full: D. full:
e m p t y :
empty:
Consider the following operation along with Enqueue and Dequeue operations on queues, where is a
global parameter.
MultiDequeue(Q){
m = k
while (Q is not empty) and (m > 0) {
Dequeue(Q)
m = m – 1
}
}
What is the worst case time complexity of a sequence of queue operations on an initially empty
queue?
A. B. C. D.
gatecse-2013 data-structures algorithms normal queue
Answer key ☟
A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed
efficiently. Which one of the following statements is CORRECT ( refers to the number of items in the
queue) ?
Answer key ☟
Let denote a queue containing sixteen numbers and be an empty stack. returns the
element at the head of the queue without removing it from . Similarly returns the element
at the top of without removing it from . 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 _______.
Answer key ☟
9.23.10 Queue: GATE CSE 2017 Set 2 | Question: 13
A circular queue has been implemented using a singly linked list where each node consists of a value
and a single pointer pointing to the next node. We maintain exactly two external pointers FRONT and
REAR pointing to the front node and the rear node of the queue, respectively. Which of the following
statements is/are CORRECT for such a circular queue, so that insertion and deletion operations can be
performed in time?
Answer key ☟
A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail
pointer, as shown in the figure. Let denote the number of nodes in the queue. Let 'enqueue' be
implemented by inserting a new node at the head, and 'dequeue' be implemented by deletion of a node from the
tail.
Which one of the following is the time complexity of the most time-efficient implementation of 'enqueue' and
'dequeue, respectively, for this data structure?
A. B.
C. D.
gatecse-2018 algorithms data-structures queue normal linked-list 1-mark
Answer key ☟
Consider the queues containing four elements and containing none (shown as the in
the figure). The only operations allowed on these two queues are and
The minimum number of operations on required to place the elements of in
in reverse order (shown as the in the figure) without using any additional storage
is________________.
Answer key ☟
9.23.13 Queue: GATE IT 2007 | Question: 30
Suppose you are given an implementation of a queue of integers. The operations that can be performed
on the queue are:
Answer key ☟
Answer key ☟
The initial configuration of quaue is . is at the front. To get the configuration how
many deletions and additions required:
Answer key ☟
At a hill station, the parking lot is one long drive way snaking up a hill side. Cars drive in and park right
behind the car in front of them, one behind another. A car can’t leave until all the cars in front of it have
left. Is the parking lot more like
(A) An array
(B) A stack
(C) A queue
Answer key ☟
A. B.
C. D.
ugcnetcse-june2009-paper2 data-structures queue easy
Answer key ☟
Answer key ☟
9.24.1 Quick Sort: UGC NET CSE | September 2013 | Part 2 | Question: 10
Suppose that the splits at every level of Quicksort are in proportion , where is a
constant. The number of elements in an array is n. The maximum depth is approximately
Answer key ☟
9.25.1 Radix Sort: UGC NET CSE | August 2016 | Part 3 | Question: 35
If there are integers to sort, each integer has d digits, and each digit is in the set , radix
sort can sort the numbers in :
A. B.
C. D.
ugcnetcse-aug2016-paper3 data-structures radix-sort
Answer key ☟
9.25.2 Radix Sort: UGC NET CSE | July 2018 | Part 2 | Question: 28
The maximum number of comparisons needed to sort 9 items using radix sort is (assume each item is 5
digit octal number):
A. 45 B. 72 C. 360 D. 450
ugcnetcse-july2018-paper2 data-structures radix-sort
Answer key ☟
A. B. C. D.
ugcnetcse-jan2017-paper3 data-structures recursion
Answer key ☟
9.27.1 Relational Algebra: UGC NET CSE | October 2020 | Part 2 | Question: 64
Match with
Let and
A. B.
C. D.
ugcnetcse-oct2020-paper2 data-structures relational-algebra
Answer key ☟
A. B.
C. D.
gate1991 data-structures stack easy
Answer key ☟
9.28.2 Stack: GATE CSE 1994 | Question: 1.14
Which of the following permutations can be obtained in the output (in the same order) using a stack
assuming that the input is the sequence in that order?
A. B.
C. D.
gate1994 data-structures stack normal
Answer key ☟
A. B.
C. D.
gate1995 data-structures stack easy
Answer key ☟
Suppose a stack implementation supports, in addition to PUSH and POP, an operation REVERSE,
which reverses the order of the elements on the stack.
A. To implement a queue using the above stack implementation, show how to implement ENQUEUE using a
single operation and DEQUEUE using a sequence of operations.
B. The following post fix expression, containing single digit operands and arithmetic operators and , is
evaluated using a stack.
Answer key ☟
Let S be a stack of size . Starting with the empty stack, suppose we push the first n natural
numbers in sequence, and then perform pop operations. Assume that Push and Pop operations take
seconds each, and seconds elapse between the end of one such stack operation and the start of the next
operation. For , define the stack-life of as the time elapsed from the end of to the start of the
pop operation that removes from S. The average stack-life of an element of this stack is
A. B. C. D.
gatecse-2003 data-structures stack normal
Answer key ☟
A single array is used to implement two stacks. The two stacks grow from opposite
ends of the array. Variables and point to the location of the topmost element in
each of the stacks. If the space is to be used efficiently, the condition for is
A. and B.
C. or D.
gatecse-2004 data-structures stack easy
Answer key ☟
The best data structure to check whether an arithmetic expression has balanced parentheses is a
Answer key ☟
Answer key ☟
Answer key ☟
9.28.10 Stack: GATE CSE 2015 Set 3 | Question: 12
A. B. C. D.
gatecse-2015-set3 data-structures stack normal
Answer key ☟
Answer key ☟
Answer key ☟
Let and be two stacks. has capacity of elements. has capacity of elements. already
has elements: , and , whereas is empty, as shown below.
Stack S1
400
(Top)
300
200
100
Stack S2
Only the following three operations are available:
Note that the pop operation is not allowed on an empty stack and the push operation is not allowed on a full
stack.
Which of the following output sequences can be generated by using the above operations?
A. B.
C. D.
gatecse2024-set2 data-structures stack multiple-selects
Answer key ☟
A program attempts to generate as many permutations as possible of the string, ' ' by pushing the
characters in the same order onto a stack, but it may pop off the top character at any time.
Which one of the following strings CANNOT be generated using this program?
A. B. C. D.
gateit-2004 data-structures normal stack
Answer key ☟
A. B. C. D.
gateit-2005 data-structures stack normal
Answer key ☟
A. B. C. D.
gateit-2007 stack normal
Answer key ☟
What is the time required to insert an element in a stack with linked implementation ?
A. B. C. D.
ugcnetcse-dec2006-paper2 stack
Answer key ☟
Given an empty stack, after performing push(1), push(2), pop, push(3), push(4), pop, pop, push(5), pop,
what is the value of the top of the stack?
A. 4 B. 3 C. 2 D. 1
ugcnetcse-dec2012-paper2 data-structures stack
Answer key ☟
Which of the following permutations can be obtained in the output using a stack of size 3 elements
assuming that input, sequence is 1, 2, 3, 4, 5?
A. 3, 2, 1, 5, 4 B. 5, 4, 3, 2, 1
C. 3, 4, 5, 2, 1 D. 3, 4, 5, 1, 2
ugcnetcse-dec2012-paper3 data-structures stack
Answer key ☟
How many PUSH and POP operations will be needed to evaluate the following expression by reverse
polish notation in a stack machine ?
Answer key ☟
Convert the following infix expression into its equivalent post fix expression ^
A. ^ B. ^
C. ^ D. ^
ugcnetcse-dec2014-paper2 data-structures stack
Answer key ☟
The seven elements and are pushed onto a stack in reverse order, i.e., starting from
. The stack is popped five times and each element is inserted into a queue. Two elements are deleted
from the queue and pushed back onto the stack. Now, one element is popped from the stack. The popped item is
___________.
A. B. C. D.
ugcnetjan2017ii data-structures stack
Answer key ☟
Answer key ☟
Answer key ☟
What is the time required to insert an element in a stack with linked implementation?
A. B. C. D.
ugcnetcse-june2005-paper2 data-structures linked-list stack
Answer key ☟
If we have six stack operationspushing and popping each of and -such that push must occur
before push which must occur before push , then is a possible order for the pop
operations, since this could be our sequence : push , pop , push , push , pop , pop . Which
one of the following orders could not be the order the pop operations are run, if we are to satisfy the
requirements described above?
A. B. C. D.
ugcnetcse-june2010-paper2 data-structures stack
Answer key ☟
The following postfix expression is evaluated using a stack. 823^/23*+51*- . The top two elements of
the stack after first * is evaluated
A. 6,1 B. 5, 7 C. 3,2 D. 1, 5
ugcnetcse-june2012-paper3 data-structures stack
Answer key ☟
A.
B.
C.
D.
Answer key ☟
A. B.
C. D.
ugcnetjune2014iii data-structures stack
Answer key ☟
Consider the height-balanced tree with values stored at only the leaf nodes, shown in Fig
(i) Show how to merge to the tree, elements from tree shown in Fig using node D of tree .
(ii) What is the time complexity of a merge operation of balanced trees and where and are of height
and respectively, assuming that rotation schemes are given. Give reasons.
Answer key ☟
A.
B.
C.
D.
Answer key ☟
A tree is a tree in which every internal node has exactly three children. Use induction to prove
that the number of leaves in a tree with internal nodes is .
gate1994 data-structures tree proof descriptive
Answer key ☟
Answer key ☟
A complete -ary tree is one in which every node has or sons. If is the number of internal nodes of
a complete -ary tree, the number of leaves in it is given by
A. B. C. D.
gate1998 data-structures tree normal
Answer key ☟
A. Derive a recurrence relation for the size of the smallest AVL tree with height .
B. What is the size of the smallest AVL tree with height ?
Answer key ☟
The number of leaf nodes in a rooted tree of n nodes, with each node having or children is:
A. B. C. D.
gatecse-2002 data-structures tree normal
Answer key ☟
Level order traversal of a rooted tree can be done by starting from the root and performing
Answer key ☟
In a complete -ary tree, every internal node has exactly children. The number of leaves in such a tree
with internal node is:
A. B. C. D.
gatecse-2005 data-structures tree normal
Answer key ☟
A complete tree is a tree in which each node has children or no children. Let be the number
of internal nodes and be the number of leaves in a complete tree. If and , what
is the value of ?
A. B. C. D.
gatecse-2007 data-structures tree normal
Answer key ☟
Consider the following rooted tree with the vertex labeled as the root:
The order in which the nodes are visited during an in-order traversal of the tree is
A. B. C. D.
gatecse-2014-set3 data-structures tree easy
Answer key ☟
Consider the pseudocode given below. The function takes as argument a pointer to the
root of an arbitrary tree represented by the representation. Each node of
the tree is of type .
typedef struct treeNode* treeptr;
struct treeNode
{
treeptr leftMostChild, rightSibling;
};
When the pointer to the root of a tree is passed as the argument to , the value returned by the
function corresponds to the
Answer key ☟
Let be a tree with vertices. The sum of the degrees of all the vertices in is ________
gatecse-2017-set1 data-structures tree easy numerical-answers
Answer key ☟
An in a connected graph is a vertex such that removing the vertex and its incident
edges disconnects the graph into two or more connected components.
Let be a tree obtained by doing in a connected undirected graph .
Which of the following options is/are correct?
Answer key ☟
9.29.15 Tree: GATE Overflow Test Series | Mock GATE | Test 1 | Question: 18
Which one of the following is the postorder traversal of the same tree?
A.
B.
C.
D.
Answer key ☟
9.29.16 Tree: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 44
A new kind of tree, type- tree, is defined as a binary tree such that all the levels except the last level is
completely filled. Let is the number of type- tree structure of level leaf level being such that
their preorder and postorder traversal matches exactly at indices , then what is the value of ________
go2025-mockgate-2 numerical-answers tree
Answer key ☟
9.29.17 Tree: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 15
Given two sorted lists of and elements respectively, the best case time complexity to make a
binary search tree out of the combined elements is (Mark all the appropriate choices)
A. B.
C. D.
go2025-mockgate-6 data-structures tree multiple-selects 1-mark
Answer key ☟
In which tree, for every node the height of its left subtree and right subtree differ almost by 1?
Answer key ☟
9.29.19 Tree: UGC NET CSE | December 2012 | Part 2 | Question: 25
Suppose that someone starts with a chain letter. Each person who receives the letter is asked to send it
on to other people. Some people do this, while some do not send any letter. How many people have
seen the letter, including the first person, if none receives more than one letter and if the chain letter ends after
there have been 100 people who read it but did not send it out? Also find out how many people sent out the
letter?
Answer key ☟
A certain tree has two vertices of degree , one vertex of degree and one vertex of degree . If the
other vertices have degree , how many vertices are there in the graph ?
A. B. C. D.
ugcnetcse-dec2014-paper2 data-structures tree
Answer key ☟
A tree with n vertices is called graceful, if its vertices can be labelled with integers 1, , ..., n such that the
absolute value of the difference of the labels of adjacent vertices are all different. Which of the following
trees are graceful?
a.
c.
b.
Answer key ☟
Suppose you are given a binary tree with n nodes, such that each node has exactly eiter zero or two
children. The maximum height of the tree will be
A. B. C. D.
ugcnetcse-july2016-paper2 data-structures tree
Answer key ☟
A 5-ary tree in which every internal node has exactly 5 children. The number of left nodes in such a tree
with 8 internal nodes will be:
A. 30 B. 33 C. 45 D. 125
ugcnetcse-july2018-paper2 data-structures tree
Answer key ☟
9.29.24 Tree: UGC NET CSE | June 2010 | Part 2 | Question: 23
In a complete binary tree of n nodes, how far are the two most distant nodes ? Assume each edge in the
path counts as !
A. About B. About
C. About D. About
ugcnetcse-june2010-paper2 data-structures tree
Answer key ☟
A. B. C. D.
ugcnetcse-june2010-paper2 data-structures tree
Answer key ☟
A. Binary tree
B. B-tree
C. AVL-tree
D. Expression tree
ugcnetcse-june2012-paper2 programming tree
Answer key ☟
Answer key ☟
A. 32 B. 36 C. 120 D. 42
ugcnetcse-june2012-paper3 data-structures tree
Answer key ☟
A.
B.
C.
D.
Answer key ☟
Answer Keys
9.0.1 B 9.0.2 Q-Q 9.0.3 Q-Q 9.0.4 Q-Q 9.0.5 Q-Q
9.0.6 Q-Q 9.0.7 Q-Q 9.0.8 Q-Q 9.0.9 Q-Q 9.0.10 Q-Q
9.0.11 Q-Q 9.0.12 Q-Q 9.0.13 Q-Q 9.0.14 Q-Q 9.1.1 N/A
9.1.2 B 9.1.3 C 9.1.4 A 9.1.5 128 9.1.6 D
9.1.7 Q-Q 9.2.1 N/A 9.2.2 C 9.2.3 N/A 9.2.4 N/A
9.2.5 A 9.2.6 A 9.2.7 N/A 9.2.8 A 9.2.9 B
9.2.10 C 9.2.11 B 9.2.12 5 9.2.13 C 9.3.1 X
9.4.1 Q-Q 9.5.1 N/A 9.5.2 C 9.5.3 N/A 9.5.4 B
9.5.5 D 9.5.6 A 9.5.7 D 9.5.8 A 9.5.9 D
9.5.10 A 9.5.11 B 9.5.12 C 9.5.13 D 9.5.14 B
9.5.15 A 9.5.16 B 9.5.17 A 9.5.18 D 9.5.19 B
9.5.20 8 9.5.21 80 9.5.22 A 9.5.23 511 9.5.24 C
9.5.25 B 9.5.26 A 9.5.27 B 9.5.28 C 9.5.29 B
9.5.30 D 9.5.31 Q-Q 9.5.32 B 9.5.33 Q-Q 9.5.34 D
9.5.35 X 9.5.36 B 9.5.37 A 9.6.1 B 9.6.2 N/A
9.6.3 D 9.6.4 N/A 9.6.5 C 9.6.6 B 9.6.7 B
9.6.8 B 9.6.9 B 9.6.10 A 9.6.11 B 9.6.12 B
9.6.13 C 9.6.14 D 9.6.15 C 9.6.16 110 9.6.17 A
9.6.18 B 9.6.19 B 9.6.20 64 9.6.21 B 9.6.22 B
9.6.23 B 9.6.24 B 9.6.25 D 9.6.26 509 9.6.27 A
9.6.28 C 9.6.29 D 9.6.30 C 9.6.31 A 9.6.32 D
9.6.33 C 9.6.34 B 9.6.35 44 9.6.36 56 9.6.37 6
9.6.38 C 9.6.39 84 9.6.40 Q-Q 9.6.41 Q-Q 9.6.42 D
9.6.43 C 9.6.44 Q-Q 9.6.45 C 9.7.1 False 9.7.2 False
9.7.3 N/A 9.7.4 N/A 9.7.5 N/A 9.7.6 A;C;D 9.7.7 B
9.7.8 144 9.7.9 N/A 9.7.10 N/A 9.7.11 N/A 9.7.12 N/A
9.7.13 N/A 9.7.14 N/A 9.7.15 B 9.7.16 N/A 9.7.17 B
9.7.18 C 9.7.19 N/A 9.7.20 N/A 9.7.21 C 9.7.22 D
9.7.23 D 9.7.24 N/A 9.7.25 B 9.7.26 D 9.7.27 D
9.7.28 C 9.7.29 B 9.7.30 A 9.7.31 C 9.7.32 A
9.7.33 B 9.7.34 A 9.7.35 1 9.7.36 A 9.7.37 19
9.7.38 199 9.7.39 C 9.7.40 4 9.7.41 4.25 9.7.42 1:1
9.7.43 C 9.7.44 A;B;C 9.7.45 A;B;C 9.7.46 D 9.7.47 B
9.7.48 D 9.7.49 C 9.7.50 B 9.7.51 D 9.7.52 B
9.7.53 A 9.7.54 D 9.7.55 Q-Q 9.7.56 Q-Q 9.7.57 B
9.7.58 D 9.7.59 C 9.7.60 C 9.7.61 C 9.8.1 A
9.9.1 B 9.9.2 C 9.9.3 B 9.9.4 12 9.9.5 17
9.9.6 A 9.9.7 Q-Q 9.9.8 C 9.9.9 C 9.9.10 D
9.9.11 B 9.9.12 C 9.9.13 C 9.10.1 5 9.10.2 C
9.10.3 6 9.11.1 Q-Q 9.12.1 D 9.13.1 C 9.13.2 N/A
9.13.3 N/A 9.13.4 C 9.13.5 B 9.13.6 C 9.13.7 C
9.13.8 C 9.13.9 A 9.13.10 A 9.13.11 B 9.13.12 80
9.13.13 B 9.13.14 C 9.13.15 B 9.13.16 D 9.13.17 Q-Q
9.13.18 Q-Q 9.13.19 Q-Q 9.13.20 Q-Q 9.13.21 X 9.13.22 C
9.13.23 Q-Q 9.13.24 Q-Q 9.13.25 Q-Q 9.13.26 C 9.13.27 A
9.13.28 Q-Q 9.13.29 C 9.14.1 210 9.14.2 B 9.14.3 0.5
9.14.4 B 9.15.1 N/A 9.15.2 A 9.15.3 N/A 9.15.4 A
9.15.5 A 9.15.6 Q-Q 9.15.7 A 9.16.1 Q-Q 9.17.1 B
9.17.2 N/A 9.17.3 N/A 9.17.4 N/A 9.17.5 B 9.17.6 D
9.17.7 C 9.17.8 N/A 9.17.9 N/A 9.17.10 N/A 9.17.11 D
9.17.12 B 9.17.13 A 9.17.14 D 9.17.15 B 9.17.16 D
9.17.17 C 9.17.18 B 9.17.19 C 9.17.20 A 9.17.21 D
9.17.22 A 9.17.23 B 9.17.24 Q-Q 9.17.25 Q-Q 9.18.1 C
9.19.1 Q-Q 9.19.2 Q-Q 9.20.1 D 9.21.1 D 9.21.2 B
9.21.3 Q-Q 9.21.4 Q-Q 9.22.1 19 9.23.1 N/A 9.23.2 N/A
9.23.3 A 9.23.4 B 9.23.5 A 9.23.6 A 9.23.7 A
9.23.8 A 9.23.9 256 9.23.10 B 9.23.11 B 9.23.12 0
9.23.13 B 9.23.14 Q-Q 9.23.15 Q-Q 9.23.16 Q-Q 9.23.17 Q-Q
9.23.18 C 9.24.1 D 9.25.1 B 9.25.2 Q-Q 9.26.1 C
9.27.1 D 9.28.1 B 9.28.2 B 9.28.3 B 9.28.4 N/A
9.28.5 C 9.28.6 D 9.28.7 B 9.28.8 C 9.28.9 15
9.28.10 C 9.28.11 86 : 86 9.28.12 8 9.28.13 B;C;D 9.28.14 D
9.28.15 C 9.28.16 B 9.28.17 Q-Q 9.28.18 D 9.28.19 A;C
9.28.20 B 9.28.21 A 9.28.22 B 9.28.23 B 9.28.24 C
9.28.25 Q-Q 9.28.26 Q-Q 9.28.27 A 9.28.28 B 9.28.29 A
9.29.1 N/A 9.29.2 A;D 9.29.3 N/A 9.29.4 B;C 9.29.5 A
9.29.6 N/A 9.29.7 D 9.29.8 D 9.29.9 C 9.29.10 C
9.29.11 A 9.29.12 D 9.29.13 18 9.29.14 B 9.29.15 D
9.29.16 12 9.29.17 B;D 9.29.18 B 9.29.19 C 9.29.20 D
9.29.21 D 9.29.22 C 9.29.23 Q-Q 9.29.24 Q-Q 9.29.25 Q-Q
9.29.26 B 9.29.27 C 9.29.28 D 9.30.1 D
10 Programming: Programming in Python (2)
What does this Python function fun ( ) do? Select the ONE appropriate option below.
gate-ds-ai-2024 programming
Answer key ☟
A. B. C. D.
gate-ds-ai-2024 programming
Answer key ☟
Answer Keys
10.0.1 C 10.0.2 D