0% found this document useful (0 votes)
5 views

Gate(Da Pyq Book)

The document is a comprehensive table of contents for a collection of topics related to algorithms, artificial intelligence, discrete mathematics, engineering mathematics, and programming. It includes detailed sections on various algorithms, data structures, and mathematical concepts, along with contributors' information. Each section is organized with subtopics and page numbers for easy navigation.

Uploaded by

Vinay Chhabra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Gate(Da Pyq Book)

The document is a comprehensive table of contents for a collection of topics related to algorithms, artificial intelligence, discrete mathematics, engineering mathematics, and programming. It includes detailed sections on various algorithms, data structures, and mathematical concepts, along with contributors' information. Each section is organized with subtopics and page numbers for easy navigation.

Uploaded by

Vinay Chhabra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 333

Table of Contents

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)

1.0.1 UGC NET CSE | June 2012 | Part 2 | Question: 2

The post order traversal of a binary tree is DEBFCA. Find out the pre-order traversal

A. ABFCDE B. ADBFEC C. ABDECF D. None of the above


ugcnetcse-june2012-paper2 algorithms

Answer key ☟

1.0.2 UGC NET CSE | August 2016 | Part 3 | Question: 36

Match the following :

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 ☟

1.0.3 UGC NET CSE | July 2018 | Part 2 | Question: 30

Consider a Boolean function of 'n' variables. The order of an algorithm that determines whether the
Boolean function produces a output 1 is

A. Logarithmic B. Linear C. Quadratic D. Exponential


ugcnetcse-july2018-paper2 algorithms

Answer key ☟

1.0.4 UGC NET CSE | July 2018 | Part 2 | Question: 27

Match the following with respect to algorithm paradigms :

A. B.
C. D.
ugcnetcse-july2018-paper2 algorithms
Answer key ☟

1.0.5 UGC NET CSE | January 2017 | Part 3 | Question: 36

Match the following with respect to algorithm paradigms :

A. B.
C. D.
ugcnetcse-jan2017-paper3 algorithms easy match-the-following

Answer key ☟

1.0.6 UGC NET CSE | December 2004 | Part 2 | Question: 25

How much extra space is used by heapsort ?

A. B. C. D.
algorithms heap-sort ugcnetcse-dec2004-paper2

Answer key ☟

1.0.7 UGC NET CSE | October 2020 | Part 2 | Question: 90

Given below are two statements:


Statement : A genetic algorithm is a stochastic hill-climbing search in which a large population of states
is maintained
Statement : In nondeterministic environments, agents can apply AND-OR search to generate contingent plans
that reach the goal regardless of which outcomes occur during execution.
In the light of the above statements, choose the correct answer from the options given below

A. Both Statement and Statement are true


B. Both Statement and Statement are false
C. Statement is correct but Statement is false
D. Statement is incorrect but Statement is true

algorithms ugcnetcse-oct2020-paper2

Answer key ☟

1.0.8 GATE Overflow Test Series | Mock GATE | Test 1 | Question: 65

Consider the following C program:


#include<stdio.h>
int A[100][100],B[100][100];
void Dosomething(int x,int y);
int main()
{
int a,b;
scanf("%d%d",&a,&b);
int i, j;
for(i = 0; i < a; i++)
{
for(j = 0; j < b; j++)
{
scanf("%d",&A[i][j]);
}
}

Dosomething(a,b);

for (i = 0; i < a; i++)


{
for (j = 0; j < b; j++)
{
printf("%d", B[i][j]);
}
}

void Dosomething(int a, int b)


{
int i,j;
for(i = 0; i < a; i++)
{
for(j = 0; j < b; j++)
{
B[i][b - 1 - j] = A[i][j];
}
}
}

What will be the output of the above code if and and

A. B.
C. D.
go2025-mockgate-1 algorithms

Answer key ☟

1.0.9 GATE Overflow Test Series | Mock GATE | Test 1 | Question: 48

Consider the following C function:


float func(int a , int n)
{
int i,j,k,b=1;
for(i=0,j=1,k=1;k<n;k++)
{
j*=a/k;

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 ☟

1.0.10 GATE Overflow Test Series | Mock GATE | Test 1 | Question: 46

Consider the following C function.


int func(int n)
{
int i , j , k , p , q=1;
for(i=1 ; i<= n ; i++)
{
p=0;
for(k=1 ; k<= n ; k<<=1)
p++;
for(j=p ; j>= 1 ; j>>=1);
q=q<<=1;
}
return q;
}

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 Activity Selection Problem (1)

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 ☟

1.2 Algorithm Design (8)

1.2.1 Algorithm Design: GATE CSE 1992 | Question: 8

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

An array contains integers in locations . It is required to shift the elements of


the array cyclically to the left by places, where . An incomplete algorithm for doing
this in linear time, without using another array is given below. Complete the algorithm by filling in the blanks.
Assume all variables are suitably declared.
min:=n;
i=0;
while _____ do
begin
temp:=A[i];
j:=i;
while ____ do
begin
A[j]:=____;
j:=(j+K) mod n;
if j<min then
min:=j;
end;
A[(n+i-K)mod n]:=____;
i:=______;
end;

gate1994 algorithms normal algorithm-design fill-in-the-blanks

Answer key ☟

1.2.3 Algorithm Design: GATE CSE 2006 | Question: 17

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

A. solves it in linear time using a left to right pass of the array


B. solves it in linear time using a right to left pass of the array
C. solves it using divide and conquer in time
D. solves it in time

gatecse-2006 algorithms normal algorithm-design

Answer key ☟

1.2.4 Algorithm Design: GATE CSE 2006 | Question: 54

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,

A. Takes and time if hashing is permitted


B. Takes and time in the key comparison mode
C. Takes time and space
D. Takes time only if the sum of the elements is an even number

gatecse-2006 algorithms normal algorithm-design time-complexity

Answer key ☟

1.2.5 Algorithm Design: GATE CSE 2014 Set 1 | Question: 37

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 ☟

1.2.6 Algorithm Design: GATE CSE 2019 | Question: 25

Consider a sequence of elements: . The


sequence sum . Determine the maximum of , where . (Divide
and conquer approach may be used.)

Answer: ___________
gatecse-2019 numerical-answers algorithms algorithm-design 1-mark

Answer key ☟

1.2.7 Algorithm Design: GATE CSE 2021 Set 1 | Question: 40

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:

Which of the following statements is/are correct about ?

A.
B.
C. is achieved by three different solutions
D. cannot be achieved by a solution consisting of three pieces

gatecse-2021-set1 multiple-selects algorithms algorithm-design 2-marks

Answer key ☟

1.2.8 Algorithm Design: GATE CSE 2024 | Set 2 | Question: 32

Consider an array that contains positive integers. A subarray of is defined to be a sequence of


array locations with consecutive indices.

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.

gatecse2024-set2 algorithms algorithm-design

Answer key ☟

1.3 Algorithm Design Technique (10)

1.3.1 Algorithm Design Technique: GATE CSE 1990 | Question: 12b

Consider the following problem. Given positive integers it is required to partition them

in to two parts and such that, is minimised

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 ☟

1.3.2 Algorithm Design Technique: GATE CSE 1990 | Question: 2-vii

Match the pairs in the following questions:

gate1990 match-the-following algorithms algorithm-design-technique easy

Answer key ☟

1.3.3 Algorithm Design Technique: GATE CSE 1994 | Question: 1.19, ISRO2016-31

Algorithm design technique used in quicksort algorithm is?

A. Dynamic programming B. Backtracking


C. Divide and conquer D. Greedy method
gate1994 algorithms algorithm-design-technique quick-sort easy isro2016

Answer key ☟

1.3.4 Algorithm Design Technique: GATE CSE 1995 | Question: 1.5

Merge sort uses:

A. Divide and conquer strategy B. Backtracking approach


C. Heuristic search D. Greedy approach
gate1995 algorithms sorting easy algorithm-design-technique merge-sort

Answer key ☟

1.3.5 Algorithm Design Technique: GATE CSE 1997 | Question: 1.5

The correct matching for the following pairs is

A. B. C. D.

gate1997 algorithms normal algorithm-design-technique easy match-the-following

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?

A. Dynamic programming B. Backtracking


C. Greedy D. Divide and Conquer
gate1998 algorithms algorithm-design-technique easy isro2008

Answer key ☟

1.3.7 Algorithm Design Technique: GATE CSE 2015 Set 1 | Question: 6

Match the following:

A. B.
C. D.
gatecse-2015-set1 algorithms normal match-the-following algorithm-design-technique

Answer key ☟

1.3.8 Algorithm Design Technique: GATE CSE 2015 Set 2 | Question: 36

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 ☟

1.3.9 Algorithm Design Technique: GATE CSE 2017 Set 1 | Question: 05

Consider the following table:

Match the algorithms to the design paradigms they are based on.

A.
B.
C.
D.

gatecse-2017-set1 algorithms algorithm-design-technique easy match-the-following

Answer key ☟

1.3.10 Algorithm Design Technique: UGC NET CSE | December 2006 | Part 2 | Question: 22

Binary search tree is an example of :

A. Divide and conquer technique B. Greedy algorithm


C. Back tracking D. Dynamic Programming
ugcnetcse-dec2006-paper2 algorithms easy algorithm-design-technique

Answer key ☟

1.4 Algorithm Efficiency (1)

1.4.1 Algorithm Efficiency: UGC NET CSE | Junet 2015 | Part 2 | Question: 25

To determine the efficiency of an algorithm the time factor is measured by

A. Counting micro seconds B. Counting number of key operations


C. Counting number of statements D. Counting kilobytes of algorithm
ugcnetcse-june2015-paper2 algorithm-efficiency

Answer key ☟

1.5 Algorithms Sorting (1)

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?

A. Selection sort B. Bubble sort


C. Radix sort D. Insertion sort
ugcnetcse-june2015-paper2 algorithms-sorting
Answer key ☟

1.6 Array (2)

1.6.1 Array: UGC NET CSE | January 2017 | Part 2 | Question: 21

Which of the following is true for computation time in insertion, deletion and finding maximum and
minimum element in a sorted array ?

A. Insertion – , Deletion – , Maximum – , Minimum –


B. Insertion – , Deletion – , Maximum – , Minimum –
C. Insertion – , Deletion – , Maximum – , Minimum –
D. Insertion – , Deletion – , Maximum – , Minimum –

ugcnetjan2017ii algorithms array

Answer key ☟

1.6.2 Array: UGC NET CSE | July 2016 | Part 3 | Question: 32

Let be an array of n distinct numbers. If and , then the pair is called


an inversion of . What is the expected number of inversions in any permutation on elements?

A. B. C. D.
ugcnetcse-july2016-paper3 algorithms array

Answer key ☟

1.7 Artificial Intelligence (2)

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.

A. Best first search B. Goal stack planning


C. Alpha-beta pruning procedure D. Min-max search
ugcnetjune2014iii artificial-intelligence algorithms

Answer key ☟

1.8 Asymptotic Notation (29)

1.8.1 Asymptotic Notation: GATE CSE 1994 | Question: 1.23

Consider the following two functions:


Which of the following is true?

A. B.
C. D.
gate1994 algorithms asymptotic-notation normal multiple-selects

Answer key ☟

1.8.2 Asymptotic Notation: GATE CSE 1996 | Question: 1.11

Which of the following is false?

A. B.
C. If D.
gate1996 algorithms asymptotic-notation normal

Answer key ☟

1.8.3 Asymptotic Notation: GATE CSE 1999 | Question: 2.21

If , give the correct matching for the following pairs:

A. B.
C. D.
gate1999 algorithms recurrence-relation asymptotic-notation normal match-the-following

Answer key ☟

1.8.4 Asymptotic Notation: GATE CSE 2000 | Question: 2.17

Consider the following functions

Which of the following is true?

A. is B. is
C. is not D. is
gatecse-2000 algorithms asymptotic-notation normal

Answer key ☟

1.8.5 Asymptotic Notation: GATE CSE 2001 | Question: 1.16

Let and be two positive functions of . Which of the following


statements is correct?
A. B.
C. D.
gatecse-2001 algorithms asymptotic-notation time-complexity normal

Answer key ☟

1.8.6 Asymptotic Notation: GATE CSE 2003 | Question: 20

Consider the following three claims:

I. where and are constants


II.
III.

Which of the following claims are correct?

A. I and II B. I and III C. II and III D. I, II, and III


gatecse-2003 algorithms asymptotic-notation normal

Answer key ☟

1.8.7 Asymptotic Notation: GATE CSE 2005 | Question: 37

Suppose ,
Which one of the following is FALSE?

A. B.
C. D.
gatecse-2005 algorithms asymptotic-notation recurrence-relation normal

Answer key ☟

1.8.8 Asymptotic Notation: GATE CSE 2008 | Question: 39

Consider the following functions:

Which of the following statements about the asymptotic behavior of , and is true?

A.
B.
C.
D.

gatecse-2008 algorithms asymptotic-notation normal

Answer key ☟

1.8.9 Asymptotic Notation: GATE CSE 2011 | Question: 37

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 ☟

1.8.10 Asymptotic Notation: GATE CSE 2012 | Question: 18

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 ☟

1.8.11 Asymptotic Notation: GATE CSE 2015 Set 3 | Question: 4

Consider the equality and the following choices for :

I.
II.
III.
IV.

The equality above remains correct if is replaced by

A. Only I B. Only II
C. I or III or IV but not II D. II or III or IV but not I
gatecse-2015-set3 algorithms asymptotic-notation normal

Answer key ☟

1.8.12 Asymptotic Notation: GATE CSE 2015 Set 3 | Question: 42

Let and , where is a positive integer. Which of the following statements


is/are correct?

I.
II.

A. Only I B. Only II C. Both I and II D. Neither I nor II


gatecse-2015-set3 algorithms asymptotic-notation normal

Answer key ☟

1.8.13 Asymptotic Notation: GATE CSE 2017 Set 1 | Question: 04

Consider the following functions from positive integers to real numbers:

, , , , .
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 ☟

1.8.14 Asymptotic Notation: GATE CSE 2021 Set 1 | Question: 3

Consider the following three functions.

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 ☟

1.8.15 Asymptotic Notation: GATE CSE 2022 | Question: 1

Which one of the following statements is for all positive functions

A. when is a polynomial
B.
C. when is an exponential function
D.

gatecse-2022 algorithms asymptotic-notation 1-mark

Answer key ☟

1.8.16 Asymptotic Notation: GATE CSE 2023 | Question: 19

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 ☟

1.8.17 Asymptotic Notation: GATE CSE 2023 | Question: 44

Consider functions and expressed in pseudocode as follows:


Function_1 | Function_2
while n > 1 do | for i = 1 to 100 * n do
for i = 1 to n do | x = x + 1;
x = x + 1; | end for
end for |
n = ⌊n/2⌋; |
end while |

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

​Let be the recurrence relation defined as follows:

Which one of the following statements is TRUE?

A. B.
C. D.
gatecse2024-set2 algorithms recurrence-relation asymptotic-notation

Answer key ☟

1.8.19 Asymptotic Notation: GATE IT 2004 | Question: 55

Let , and be functions defined for positive integers such that


, , , and .
Which one of the following statements is FALSE?

A. B.
C. D.
gateit-2004 algorithms asymptotic-notation normal

Answer key ☟

1.8.20 Asymptotic Notation: GATE IT 2008 | Question: 10

Arrange the following functions in increasing asymptotic order:

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

Big-O estimate for is given as

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

The recurrence relation is satisfied by

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

The asymptotic upper bound solution of the recurrence relation given by is

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

An algorithm is made up of modules and . If time complexity of modules and are


and respectively, the time complexity of the algorithm is

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

Given the following equalities : for all fixed and and


. . Which of the following is true ?

1. is correct and is correct.


2. is correct and is not correct.
3. is not correct and is correct.
4. is not correct and is not correct.

asymptotic-notation ugcnetjune2014iii

Answer key ☟

1.8.29 Asymptotic Notation: UGC NET CSE | Junet 2015 | Part 3 | Question: 35

Let and be asymptotically non-negative functions. Which of the following is correct?

A. B.
C. D.
asymptotic-notation algorithms ugcnetcse-june2015-paper3

Answer key ☟

1.9 B Tree (2)

1.9.1 B Tree: UGC NET CSE | December 2010 | Part 2 | Question: 21

What is the maximum number of nodes in a B-tree of order of depth (root at depth ) ?

A. B. C. D. None of the above


ugcnetcse-dec2010-paper2 algorithms b-tree

Answer key ☟

1.9.2 B Tree: UGC NET CSE | December 2013 | Part 2 | Question: 24

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.

A. t-1, 2t+1 B. t+1, 2t+1 C. t-1, 2t-1 D. t+1, 2t-1


ugcnetcse-dec2013-paper2 algorithms b-tree

Answer key ☟

1.10 Bellman Ford (3)

1.10.1 Bellman Ford: GATE CSE 2009 | Question: 13

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.

A. only B. only C. Both and D. Neither nor


gatecse-2009 algorithms graph-algorithms normal bellman-ford

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

Choose the correct answer from the options given below:

A. B.
C. D.

ugcnetcse-oct2020-paper2 topological-sort bellman-ford algorithms match-the-following

Answer key ☟

1.11 Binary Heap (1)

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 ☟

1.12 Binary Search (2)

1.12.1 Binary Search: GATE CSE 2021 Set 2 | Question: 8

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.

Which ONE of the following options is TRUE?

A. B.
C. D.
gate-ds-ai-2024 algorithms binary-search

Answer key ☟

1.13 Binary Search Tree (1)

1.13.1 Binary Search Tree: UGC NET CSE | January 2017 | Part 2 | Question: 25

Which of the following statements is false?

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.

ugcnetjan2017ii algorithms binary-tree binary-search-tree

Answer key ☟

1.14 Binary Tree (4)

1.14.1 Binary Tree: UGC NET CSE | December 2010 | Part 2 | Question: 22

A binary tree with nodes has _______ null branches.

A. B. C. D. None of the above


ugcnetcse-dec2010-paper2 algorithms binary-tree

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.

A. ABFCDE B. ADBFEC C. ABDECF D. ABDCEF


ugcnetcse-dec2011-paper2 algorithms binary-tree

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 full binary tree with leaves contains

A. nodes B. nodes
C. nodes D. nodes
ugcnetcse-dec2014-paper2 algorithms binary-tree

Answer key ☟

1.15 Branch and Bound (1)

1.15.1 Branch and Bound: GATE CSE 1990 | Question: 12a

Consider the following instance of the Knapsack problem:

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.

gate1990 descriptive algorithms branch-and-bound unsolved

1.16 Decision Tree (1)

1.16.1 Decision Tree: UGC NET CSE | December 2014 | Part 3 | Question: 31

Any decision tree that sorts elements has height

A. B. C. D.
ugcnetcse-dec2014-paper3 algorithms decision-tree

Answer key ☟

1.17 Depth First Search (4)

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.

go2025-mockgate-6 algorithms depth-first-search multiple-selects 2-marks

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.

It shows which of the following depth first forest?

A. {a,b,e} {c,d,f,g,h} B. {a,b,e} {c,d,h} {f,g}


C. {a,b,e} {f,g} {c,d} {h} D. {a,b,c,d} {e,f,g} {h}
ugcnetcse-dec2015-paper2 algorithms depth-first-search

Answer key ☟

1.17.3 Depth First Search: UGC NET CSE | June 2013 | Part 3 | Question: 68

Which one of the following is not an informed search technique?

A. Hill climbing search B. Best first search


C. A* search D. Depth first search
ugcnetcse-june2013-paper3 algorithms depth-first-search

Answer key ☟

1.17.4 Depth First Search: UGC NET CSE | June 2019 | Part 2 | Question: 65

Which of the following is application of depth-first search?

A. Only topological sort


B. Only strongly connected components
C. Both topological sort and strongly connected components
D. Neither topological sort nor strongly connected components

ugcnetcse-june2019-paper2 depth-first-search

Answer key ☟

1.18 Dijkstras Algorithm (8)

1.18.1 Dijkstras Algorithm: GATE CSE 1996 | Question: 17

Let be the directed, weighted graph shown in below figure


We are interested in the shortest paths from .

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 ?

gate1996 algorithms graph-algorithms normal dijkstras-algorithm descriptive

Answer key ☟

1.18.2 Dijkstras Algorithm: GATE CSE 2004 | Question: 44

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 ☟

1.18.3 Dijkstras Algorithm: GATE CSE 2005 | Question: 38

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 ☟

1.18.4 Dijkstras Algorithm: GATE CSE 2006 | Question: 12

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 ☟

1.18.5 Dijkstras Algorithm: GATE CSE 2008 | Question: 45

Dijkstra's single source shortest path algorithm when run from vertex in the above graph, computes the correct
shortest path distance to

A. only vertex B. only vertices


C. only vertices D. all the vertices
gatecse-2008 algorithms graph-algorithms normal dijkstras-algorithm

Answer key ☟

1.18.6 Dijkstras Algorithm: GATE CSE 2012 | Question: 40

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

Dijkstra’s algorithm is based on


A. Divide and conquer paradigm B. Dynamic programming
C. Greedy approach D. Backtracking paradigm
ugcnetcse-jan2017-paper3 algorithms dijkstras-algorithm

Answer key ☟

1.19 Double Hashing (1)

1.19.1 Double Hashing: UGC NET CSE | June 2019 | Part 2 | Question: 66

Consider double hashing of the form


where where
and . For , what is the difference between first and second probes in terms of
slots?

A. B. C. D.
ugcnetcse-june2019-paper2 double-hashing

Answer key ☟

1.20 Dynamic Programming (11)

1.20.1 Dynamic Programming: GATE CSE 2008 | Question: 80

The subset-sum problem is defined as follows. Given a set of positive integers,


, and positive integer , is there a subset of whose elements sum to ? A
dynamic program for solving this problem uses a Boolean array, , with rows and
columns. , is TRUE, if and only if there is a subset of whose
elements sum to .
Which of the following is valid for , and ?

A.
B.
C.
D.

gatecse-2008 algorithms normal dynamic-programming

Answer key ☟

1.20.2 Dynamic Programming: GATE CSE 2008 | Question: 81

The subset-sum problem is defined as follows. Given a set of positive integers,


, and positive integer , is there a subset of whose elements sum to ? A
dynamic program for solving this problem uses a Boolean array, , with rows and
columns. , is TRUE, if and only if there is a subset of whose
elements sum to .
Which entry of the array , if TRUE, implies that there is a subset whose elements sum to ?

A. B. C. D.
gatecse-2008 algorithms normal dynamic-programming

Answer key ☟

1.20.3 Dynamic Programming: GATE CSE 2009 | Question: 53

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]

Which one of the following options is correct?

A. B.
C. D.
gatecse-2009 algorithms normal dynamic-programming recursion

Answer key ☟

1.20.4 Dynamic Programming: GATE CSE 2009 | Question: 54

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 ?

A. All elements of should be initialized to 0 for the values of to be properly computed.


B. The values of may be computed in a row major order or column major order of .
C. The values of cannot be computed in either row major order or column major order of .
D. needs to be computed before if either or .

gatecse-2009 normal algorithms dynamic-programming recursion

Answer key ☟

1.20.5 Dynamic Programming: GATE CSE 2010 | Question: 34

The weight of a sequence of real numbers is defined as .


A subsequence of a sequence is obtained by deleting some elements from the sequence, keeping the
order of the remaining elements the same. Let denote the maximum possible weight of a subsequence of
and the maximum possible weight of a subsequence of . Then is equal to

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

Finally, the length of the longest monotonically increasing sequence is


Which of the following statements is TRUE?

A. The algorithm uses dynamic programming paradigm


B. The algorithm has a linear complexity and uses branch and bound paradigm
C. The algorithm has a non-linear polynomial complexity and uses branch and bound paradigm
D. The algorithm uses divide and conquer paradigm

gatecse-2011 algorithms easy dynamic-programming

Answer key ☟

1.20.7 Dynamic Programming: GATE CSE 2014 Set 2 | Question: 37

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 ___.

gatecse-2014-set2 algorithms normal numerical-answers dynamic-programming

Answer key ☟

1.20.8 Dynamic Programming: GATE CSE 2014 Set 3 | Question: 37

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 _____.

gatecse-2014-set3 algorithms normal numerical-answers dynamic-programming

Answer key ☟

1.20.9 Dynamic Programming: GATE CSE 2016 Set 2 | Question: 14

The Floyd-Warshall algorithm for all-pair shortest paths computation is based on

A. Greedy paradigm.
B. Divide-and-conquer paradigm.
C. Dynamic Programming paradigm.
D. Neither Greedy nor Divide-and-Conquer nor Dynamic Programming paradigm.

gatecse-2016-set2 algorithms dynamic-programming easy

Answer key ☟
1.20.10 Dynamic Programming: UGC NET CSE | December 2013 | Part 3 | Question: 37

The longest common subsequence of the sequences and


has length

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 ☟

1.21 GO Mockgate 1 (6)

1.21.1 GO Mockgate 1: GATE Overflow | Mock GATE | Test 1 | Question: 26

Consider the two given functions:


int fun1(int x, int y)
{
if (y==0) return 0;
return (x+fun2(x, y-1));
}

int fun2(int x, int y)


{
if (x==0)
return y;
return fun2(x-1, x+y);
}

What will be the value returned by ____

go-mockgate-1 numerical-answers identify-function recursion algorithms

Answer key ☟

1.21.2 GO Mockgate 1: GATE Overflow | Mock GATE | Test 1 | Question: 29

Consider the following piece of code:


int function(int a[], int n, int x)
{
int i;
for (i=0; i<n && a[i]!=x;i++);
if (i==n) return -1;
else return i;
}

A function call is made with the arguments as follows:


What will be the value returned by the above code?

go-mockgate-1 numerical-answers identify-function algorithms

Answer key ☟

1.21.3 GO Mockgate 1: GATE Overflow | Mock GATE | Test 1 | Question: 45

Consider the following modified Heapify and Build_heap procedure.


void Heapify(int* A, int i, int n) {

int left=2*i+1;
int right=2*i+2;
int mid=i;

if (left<=n && right <=n) {


if ((A[left] > A[right] && A[left]< A[i]) || A[left]<A[right] && A[left] >A[i])
mid=left;
else if((A[left<A[right] && A[right]<A[i]) || A[left] >A[right] && A[right]>A[i])
mid=right;
else mid=i;
}

if (mid!=i) {
swap(A[i], A[mid]);
Heapify(A, mid, n);
}

void Build_heap (int *A, int n) {


int i=0;

for (i=n; i>=0;i--) {


Heapify(A, i, n);
}
}

Now consider the following binary tree.

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 ☟

1.21.4 GO Mockgate 1: GATE Overflow | Mock GATE | Test 1 | Question: 47

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.

A. Only P, Q, S and T are correct B. Only P, Q, S, T and U are correct


C. Only Q, R, T are correct D. Only Q, R, S, T and U are correct
go-mockgate-1 greedy-algorithm dijkstras-algorithm shortest-path algorithms graph-algorithms

Answer key ☟

1.21.5 GO Mockgate 1: GATE Overflow | Mock GATE | Test 1 | Question: 48

Consider the following piece of pseudo-code:


A(n){
if(n==0) return 1;
return A(√n) + B(n) + C(n) + D(n);
}
B(n){
if (n==0) return n;
return B(n-1);
}
C(n){
return A (√n);
}
D(n){
return n;
}

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 ☟

1.21.6 GO Mockgate 1: GATE Overflow | Mock GATE | Test 1 | Question: 62

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 ☟

1.22 Graph Algorithms (14)


1.22.1 Graph Algorithms: GATE CSE 1990 | Question: 14

The following algorithm (written in pseudo-pascal) work on an undirected graph


program Explore (G)
procedure Visit (u)
begin
if Adj (u) is not empty
{comment:Adj (u) is the list of edges incident to u}
then
begin
Select an edge from Adj (u);
Let edge be e=(u, v)
remove e from Adj (u) and Adj (v);
Visit (v);
end
else
mark u as a finished vertex and remove u from LIST
{Comment: LIST is the set of vertices in the graph}
end;
begin
While LIST is not empty
do
begin
Let v ∊ LIST;
Visit (v);
end
end.

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.

gate1990 descriptive graph-algorithms unsolved

1.22.2 Graph Algorithms: GATE CSE 1994 | Question: 1.22

Which of the following statements is false?

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 ☟

1.22.3 Graph Algorithms: GATE CSE 2003 | Question: 70

Let be a directed graph with vertices. A path from to in is a sequence of vertices (


) such that for all in through . A simple path is a path in which no
vertex appears more than once.
Let be an array initialized as follows:

Consider the following algorithm:


for i=1 to n
for j=1 to n
for k=1 to n
A[j,k] = max(A[j,k], A[j,i] + A[i,k]);

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

gatecse-2003 algorithms graph-algorithms normal

Answer key ☟

1.22.4 Graph Algorithms: GATE CSE 2005 | Question: 82a

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 ☟

1.22.5 Graph Algorithms: GATE CSE 2005 | Question: 82b

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?

A. a path from to in the minimum weighted spanning tree


B. a weighted shortest path from to
C. an Euler walk from to D. a Hamiltonian path from to
gatecse-2005 algorithms graph-algorithms normal

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 ☟

1.22.7 Graph Algorithms: GATE CSE 2017 Set 1 | Question: 26

Let be connected, undirected, edge-weighted graph. The weights of the edges in are
positive and distinct. Consider the following statements:

I. Minimum Spanning Tree of is always unique.


II. Shortest path between any two vertices of is always unique.

Which of the above statements is/are necessarily true?

A. I only B. II only C. both I and II D. neither I nor II


gatecse-2017-set1 algorithms graph-algorithms normal

Answer key ☟

1.22.8 Graph Algorithms: GATE CSE 2021 Set 2 | Question: 46

Consider the following directed graph:

Which of the following is/are correct about the graph?

A. The graph does not have a topological order


B. A depth-first traversal starting at vertex classifies three directed edges as back edges
C. The graph does not have a strongly connected component
D. For each pair of vertices and , there is a directed path from to

gatecse-2021-set2 multiple-selects algorithms graph-algorithms 2-marks

Answer key ☟

1.22.9 Graph Algorithms: GATE CSE 2021 Set 2 | Question: 55

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 _______

gatecse-2021-set2 algorithms graph-algorithms directed-acyclic-graph numerical-answers 2-marks

Answer key ☟

1.22.10 Graph Algorithms: GATE IT 2005 | Question: 15

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 ☟

1.22.11 Graph Algorithms: GATE IT 2005 | Question: 84a

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");

Choose the correct expressions for and

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");

Choose the correct expression for

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

A. Greedy algorithm, B. Greedy algorithm,


C. Dynamic programming, D. Dynamic programming,
ugcnetcse-dec2015-paper3 graph-algorithms algorithms

Answer key ☟

1.22.14 Graph Algorithms: UGC NET CSE | June 2019 | Part 2 | Question: 61

Match List-I with List-II:

Choose the correct option from those options given below:

A. (a) – (ii); (b)-(iv); (c)-(i); (d)-(iii)


B. (a) – (iii); (b)-(iv); (c)-(i); (d)-(ii)
C. (a) – (ii); (b)-(i); (c)-(iv); (d)-(iii)
D. (a) – (iii); (b)-(i); (c)-(iv); (d)-(ii)

ugcnetcse-june2019-paper2 graph-algorithms

Answer key ☟

1.23 Graph Search (23)


1.23.1 Graph Search: GATE CSE 1989 | Question: 4-vii

In the graph shown above, the depth-first spanning tree edges are marked with a . Identify the forward,
backward, and cross edges.

gate1989 descriptive algorithms graph-algorithms depth-first-search graph-search

Answer key ☟

1.23.2 Graph Search: GATE CSE 2000 | Question: 1.13

The most appropriate matching for the following pairs

is:

A. B.
C. D.
gatecse-2000 algorithms easy graph-algorithms graph-search match-the-following

Answer key ☟

1.23.3 Graph Search: GATE CSE 2000 | Question: 2.19

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?

A. must be an edge in , and is a descendant of in


B. must be an edge in , and is a descendant of in
C. If is not an edge in then is a leaf in
D. If is not an edge in then and must have the same parent in

gatecse-2000 algorithms graph-algorithms normal graph-search

Answer key ☟

1.23.4 Graph Search: GATE CSE 2001 | Question: 2.14

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 ☟

1.23.5 Graph Search: GATE CSE 2003 | Question: 21

Consider the following graph:

Among the following sequences:

I. abeghf
II. abfehg
III. abfhge
IV. afghbe

Which are the depth-first traversals of the above graph?

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 ☟

1.23.6 Graph Search: GATE CSE 2006 | Question: 48

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?

A. There must exist a vertex adjacent to both and in


B. There must exist a vertex whose removal disconnects and in
C. There must exist a cycle in containing and
D. There must exist a cycle in containing and all its neighbours in

gatecse-2006 algorithms graph-algorithms normal graph-search

Answer key ☟

1.23.7 Graph Search: GATE CSE 2008 | Question: 19

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 ☟

1.23.8 Graph Search: GATE CSE 2014 Set 1 | Question: 11

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 ☟

1.23.9 Graph Search: GATE CSE 2014 Set 2 | Question: 14

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

A. the shortest path between every pair of vertices.


B. the shortest path from to every vertex in the graph.
C. the shortest paths from to only those nodes that are leaves of .
D. the longest path in the graph.

gatecse-2014-set2 algorithms graph-algorithms normal graph-search

Answer key ☟

1.23.10 Graph Search: GATE CSE 2014 Set 3 | Question: 13

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 _________.

gatecse-2014-set3 algorithms graph-algorithms numerical-answers normal graph-search

Answer key ☟

1.23.11 Graph Search: GATE CSE 2015 Set 1 | Question: 45

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 ☟

1.23.13 Graph Search: GATE CSE 2017 Set 2 | Question: 15

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 ☟

1.23.14 Graph Search: GATE CSE 2018 | Question: 30

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 .

Which of the statements above must necessarily be true?

A. I only B. II only C. Both I and II D. Neither I nor II


gatecse-2018 algorithms graph-algorithms graph-search normal 2-marks

Answer key ☟

1.23.15 Graph Search: GATE CSE 2023 | Question: 46

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 .

If denotes the empty set, then the cardinality of is ______________.


gatecse-2023 algorithms breadth-first-search numerical-answers 2-marks graph-search

Answer key ☟

1.23.16 Graph Search: GATE CSE 2024 | Set 1 | Question: 35

​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

gatecse2024-set1 algorithms multiple-selects graph-search

Answer key ☟

1.23.17 Graph Search: GATE CSE 2024 | Set 1 | Question: 50

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 ☟

1.23.18 Graph Search: GATE DS&AI 2024 | Question: 4

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.

A. tree B. cross C. back D. gray


gate-ds-ai-2024 graph-search depth-first-search algorithms

Answer key ☟

1.23.19 Graph Search: GATE IT 2005 | Question: 14

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 ☟

1.23.20 Graph Search: GATE IT 2006 | Question: 47

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

Which one of the following statements is TRUE about the graph?

A. There is only one connected component


B. There are two connected components, and and are connected
C. There are two connected components, and and are connected
D. There are two connected components, and and are connected
gateit-2006 algorithms graph-algorithms normal graph-search depth-first-search

Answer key ☟

1.23.21 Graph Search: GATE IT 2007 | Question: 24

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 ☟

1.23.22 Graph Search: GATE IT 2008 | Question: 47

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)?

A. and only B. and only C. and only D. and only


gateit-2008 algorithms graph-algorithms normal graph-search depth-first-search

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

A. Minmax strategy B. Alpha-beta pruning strategy


C. Constraint satisfaction strategy D. Static max strategy
ugcnetcse-june2012-paper3 algorithms graph-search tree-traversal

Answer key ☟

1.24 Greedy Algorithm (5)

1.24.1 Greedy Algorithm: GATE CSE 1999 | Question: 2.20

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 ☟

1.24.2 Greedy Algorithm: GATE CSE 2003 | Question: 69

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 ☟

1.24.3 Greedy Algorithm: GATE CSE 2005 | Question: 84a

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?

A. All tasks are completed B. and are left out


C. and are left out D. and are left out
gatecse-2005 algorithms greedy-algorithm process-scheduling normal

Answer key ☟

1.24.4 Greedy Algorithm: GATE CSE 2005 | Question: 84b

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.

What is the maximum profit earned?

A. B. C. D.
gatecse-2005 algorithms greedy-algorithm process-scheduling normal

Answer key ☟

1.24.5 Greedy Algorithm: GATE CSE 2018 | Question: 48

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 .

The value of is ____


gatecse-2018 algorithms greedy-algorithm numerical-answers 2-marks

Answer key ☟

1.25 Greedy Algorithms (1)

1.25.1 Greedy Algorithms: UGC NET CSE | Junet 2015 | Part 3 | Question: 64

Given the symbols A, B, C, D, E, F, G and H with the probabilities and


respectively. The average Huffman code size in bits per symbol is

A. B. C. D.
ugcnetcse-june2015-paper3 algorithms greedy-algorithms huffman-code

Answer key ☟

1.26 Hashing (10)

1.26.1 Hashing: GATE CSE 1989 | Question: 1-vii, ISRO2015-14

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

Consider a hash table with chaining scheme for overflow handling:

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?

gate1990 hashing algorithms descriptive

Answer key ☟

1.26.3 Hashing: GATE CSE 2020 | Question: 23

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 ☟

1.26.4 Hashing: GATE CSE 2021 Set 1 | Question: 47

Consider a hashing approach for -bit integer keys:

1. There is a main hash table of size .


2. The least significant bits of a key is used to index into the main hash table.
3. Initially, the main hash table entries are empty.
4. Thereafter, when more keys are hashed into it, to resolve collisions, the set of all keys corresponding to a
main hash table entry is organized as a binary tree that grows on demand.
5. First, the least significant bit is used to divide the keys into left and right subtrees.
6. To resolve more collisions, each node of the binary tree is further sub-divided into left and right subtrees
based on the least significant bit.
7. A split is done only if it is needed, i.e., only when there is a collision.

Consider the following state of the hash table.

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 ☟

1.26.5 Hashing: GATE CSE 2022 | Question: 6

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 ☟

1.26.6 Hashing: GATE CSE 2023 | Question: 10

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?

A. Division method, i.e., use the hash function .


B. Multiplication method, i.e., use the hash function , where is a carefully chosen
constant.
C. Universal hashing method.
D. If is a prime number, use Division method. Otherwise, use Multiplication method.

gatecse-2023 algorithms hashing 1-mark

Answer key ☟

1.26.7 Hashing: GATE IT 2005 | Question: 16

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 ☟

1.27 Huffman Code (8)

1.27.1 Huffman Code: GATE CSE 1989 | Question: 13a

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 ☟

1.27.2 Huffman Code: GATE CSE 2007 | Question: 76

Suppose the letters have probabilities , respectively.


Which of the following is the Huffman code for the letter ?

A. , , , , , B. , , , , ,
C. , , , , , D. , , , , ,
gatecse-2007 algorithms greedy-algorithm normal huffman-code

Answer key ☟

1.27.3 Huffman Code: GATE CSE 2007 | Question: 77

Suppose the letters have probabilities , respectively.


What is the average length of the Huffman code for the letters ?

A. B. C. D.
gatecse-2007 algorithms greedy-algorithm normal huffman-code

Answer key ☟

1.27.4 Huffman Code: GATE CSE 2017 Set 2 | Question: 50

A message is made up entirely of characters from the set . The table of


probabilities for each of the characters is shown below:
If a message of characters over is encoded using Huffman coding, then the expected length of the
encoded message in bits is ______.
gatecse-2017-set2 huffman-code numerical-answers algorithms

Answer key ☟

1.27.5 Huffman Code: GATE CSE 2021 Set 2 | Question: 26

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 ☟

1.27.6 Huffman Code: GATE IT 2006 | Question: 48

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

Match the following :


A. B.
C. D.
ugcnetcse-july2016-paper3 algorithms huffman-code

Answer key ☟

1.27.8 Huffman Code: UGC NET CSE | July 2016 | Part 3 | Question: 59

Consider a source with symbols with probabilities respectively. What is


the average number of bits per symbol for the Huffman code generated from above information?

A. bits per symbol B. bits per symbol


C. bits per symbol D. bits per symbol
ugcnetcse-july2016-paper3 algorithms huffman-code probability

Answer key ☟

1.28 Identify Function (40)

1.28.1 Identify Function: GATE CSE 1989 | Question: 8a

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 .

gate1989 descriptive algorithms identify-function

Answer key ☟

1.28.2 Identify Function: GATE CSE 1990 | Question: 11b

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 ☟

1.28.3 Identify Function: GATE CSE 1991 | Question: 03-viii

Consider the following Pascal function:


Function X(M:integer):integer;
Var i:integer;
Begin
i := 0;
while i*i < M
do i:= i+1
X := i
end

The function call , if is positive, will return

A. B.
C. D.
E. None of the above
gate1991 algorithms easy identify-function multiple-selects

Answer key ☟

1.28.4 Identify Function: GATE CSE 1993 | Question: 7.4

What does the following code do?


var a, b: integer;
begin
a:=a+b;
b:=a-b;
a:=a-b;
end;

A. exchanges and B. doubles and stores in


C. doubles and stores in D. leaves and unchanged
E. none of the above

gate1993 algorithms identify-function easy

Answer key ☟

1.28.5 Identify Function: GATE CSE 1994 | Question: 6

What function of , is computed by this program?


Function what(x, n:integer): integer:
Var
value : integer
begin
value := 1
if n > 0 then
begin
if n mod 2 =1 then
value := value * x;
value := value * what(x*x, n div 2);
end;
what := value;
end;

gate1994 algorithms identify-function normal descriptive

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 ☟

1.28.7 Identify Function: GATE CSE 1995 | Question: 2.3

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 ☟

1.28.8 Identify Function: GATE CSE 1995 | Question: 4

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 ☟

1.28.9 Identify Function: GATE CSE 1998 | Question: 2.12

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 ☟

1.28.10 Identify Function: GATE CSE 1999 | Question: 2.24

Consider the following function definition


int Trial (int a, int b, int c)
{
if ((a>=b) && (c<b)) return b;
else if (a>=b) return Trial(a, c, b);
else return Trial(b, a, c);
}

The functional Trial:

A. Finds the maximum of , , and B. Finds the minimum of , , and


C. Finds the middle number of , , D. None of the above
gate1999 algorithms identify-function normal

Answer key ☟

1.28.11 Identify Function: GATE CSE 2000 | Question: 2.15

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);

A. Rotates left by positions B. Leaves unchanged


C. Reverses all elements of D. None of the above
gatecse-2000 algorithms normal identify-function

Answer key ☟

1.28.12 Identify Function: GATE CSE 2003 | Question: 1

Consider the following function.


For large values of , the return value of the function best approximates
float f,(float x, int y) {
float p, s; int i;
for (s=1,p=1,i=1; i<y; i++) {
p *= x/i;
s += p;
}
return s;
}

A. B. C. D.
gatecse-2003 algorithms identify-function normal

Answer key ☟

1.28.13 Identify Function: GATE CSE 2003 | Question: 88

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

for (k = 3; k <= n; k++)


A[k] = 0;
for (k = 2; k <= TwoLog_n; k++)
for (j = k+1; j <= n; j++)
A[j] = A[j] || (j%k);
for (j = 3; j <= n; j++)
if (!A[j]) printf("%d", j);

The set of numbers printed by this program fragment is

A. B.
C. D. { }
gatecse-2003 algorithms identify-function normal

Answer key ☟

1.28.14 Identify Function: GATE CSE 2004 | Question: 41

Consider the following C program


main()
{
int x, y, m, n;
scanf("%d %d", &x, &y);
/* Assume x>0 and y>0*/
m = x; n = y;
while(m != n)
{
if (m > n)
m = m-n;
else
n = n-m;
}
printf("%d", n);
}

The program computes

A. using repeated subtraction B. using repeated subtraction


C. the greatest common divisor of and D. the least common multiple of and
gatecse-2004 algorithms normal identify-function

Answer key ☟

1.28.15 Identify Function: GATE CSE 2004 | Question: 42

What does the following algorithm approximate? (Assume ).


x = m;
y = 1;
While (x-y > ϵ)
{
x = (x+y)/2;
y = m/x;
}
print(x);

A. B. C. D.
gatecse-2004 algorithms identify-function normal

Answer key ☟

1.28.16 Identify Function: GATE CSE 2005 | Question: 31

Consider the following C-program:


void foo (int n, int sum) {
int k = 0, j = 0;
if (n == 0) return;
k = n % 10; j = n/10;
sum = sum + k;
foo (j, sum);
printf ("%d,",k);
}

int main() {
int a = 2048, sum = 0;
foo(a, sum);
printf("%d\n", sum);
}

What does the above program print?

A. B.
C. D.
gatecse-2005 algorithms identify-function recursion normal

Answer key ☟

1.28.17 Identify Function: GATE CSE 2006 | Question: 50

A set can be represented by an array as follows:

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]);
}

The set computed by the algorithm is:

A. B. C. D.
gatecse-2006 algorithms identify-function normal

Answer key ☟

1.28.18 Identify Function: GATE CSE 2006 | Question: 53

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

A. only (i) B. only (ii)


C. either (i) or (ii) but not both D. neither (i) nor (ii)
gatecse-2006 algorithms identify-function normal

Answer key ☟

1.28.19 Identify Function: GATE CSE 2009 | Question: 18

Consider the program below:


#include <stdio.h>
int fun(int n, int *f_p) {
int t, f;
if (n <= 1) {
*f_p = 1;
return 1;
}
t = fun(n-1, f_p);
f = t + *f_p;
*f_p = t;
return f;
}

int main() {
int x = 15;
printf("%d/n", fun(5, &x));
return 0;
}

The value printed is:

A. B. C. D.
gatecse-2009 algorithms recursion identify-function normal

Answer key ☟

1.28.20 Identify Function: GATE CSE 2010 | Question: 35

What is the value printed by the following C program?


#include<stdio.h>

int f(int *a, int n)


{
if (n <= 0) return 0;
else if (*a % 2 == 0) return *a+f(a+1, n-1);
else return *a - f(a+1, n-1);
}

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 ☟

1.28.21 Identify Function: GATE CSE 2011 | Question: 48

Consider the following recursive C function that takes two arguments.


unsigned int foo(unsigned int n, unsigned int r) {
if (n>0) return ((n%r) + foo(n/r, r));
else return 0;
}

What is the return value of the function when it is called as ?

A. B. C. D.
gatecse-2011 algorithms recursion identify-function normal

Answer key ☟

1.28.22 Identify Function: GATE CSE 2011 | Question: 49

Consider the following recursive C function that takes two arguments.


unsigned int foo(unsigned int n, unsigned int r) {
if (n>0) return ((n%r) + foo(n/r, r));
else return 0;
}

What is the return value of the function when it is called as ?

A. B. C. D.
gatecse-2011 algorithms recursion identify-function normal

Answer key ☟

1.28.23 Identify Function: GATE CSE 2013 | Question: 31

Consider the following function:


int unknown(int n){

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);

The return value of the function is

A. B.
C. D.
gatecse-2013 algorithms identify-function normal

Answer key ☟

1.28.24 Identify Function: GATE CSE 2014 Set 1 | Question: 41

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;

for(i = 0; i< size; i++)


Y = Y + E[i];

for(i=0; i < size; i++)


for(j = i; j < size; j++)
{
Z = 0;
for(k = i; k <= j; k++)
Z = Z + E[k];
if(Z > Y)
Y = Z;
}
return Y;
}

The value returned by the function MyX is the

A. maximum possible sum of elements in any sub-array of array E.


B. maximum element in any sub-array of array E.
C. sum of the maximum elements in all possible sub-arrays of array E.
D. the sum of all the elements in the array E.

gatecse-2014-set1 algorithms identify-function normal

Answer key ☟

1.28.25 Identify Function: GATE CSE 2014 Set 2 | Question: 10

Consider the function func shown below:


int func(int num) {
int count = 0;
while (num) {
count++;
num>>= 1;
}
return (count);
}

The value returned by func( ) is ________

gatecse-2014-set2 algorithms identify-function numerical-answers easy

Answer key ☟

1.28.26 Identify Function: GATE CSE 2014 Set 3 | Question: 10

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]);

A. The matrix itself


B. Transpose of the matrix
C. Adding to the upper diagonal elements and subtracting from lower diagonal elements of
D. None of the above

gatecse-2014-set3 algorithms identify-function easy

Answer key ☟

1.28.27 Identify Function: GATE CSE 2015 Set 1 | Question: 31

Consider the following C function.


int fun1 (int n) {
int i, j, k, p, q = 0;
for (i = 1; i < n; ++i)
{
p = 0;
for (j = n; j > 1; j = j/2)
++p;
for (k = 1; k < p; k = k * 2)
++q;
}
return q;
}

Which one of the following most closely approximates the return value of the function ?

A. B. C. D.
gatecse-2015-set1 algorithms normal identify-function

Answer key ☟

1.28.28 Identify Function: GATE CSE 2015 Set 2 | Question: 11

Consider the following C function.


int fun(int n) {
int x=1, k;
if (n==1) return x;
for (k=1; k<n; ++k)
x = x + fun(k) * fun (n-k);
return x;
}

The return value of is ______.

gatecse-2015-set2 algorithms identify-function recurrence-relation normal numerical-answers

Answer key ☟

1.28.29 Identify Function: GATE CSE 2015 Set 3 | Question: 49

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 _______.

gatecse-2015-set3 algorithms identify-function normal numerical-answers


Answer key ☟

1.28.30 Identify Function: GATE CSE 2019 | Question: 26

Consider the following C function.


void convert (int n ) {
if (n<0)
printf{“%d”, n);
else {
convert(n/2);
printf(“%d”, n%2);
}
}

Which one of the following will happen when the function convert is called with any positive integer as
argument?

A. It will print the binary representation of and terminate


B. It will print the binary representation of in the reverse order and terminate
C. It will print the binary representation of but will not terminate
D. It will not print anything and will not terminate

gatecse-2019 algorithms identify-function 2-marks

Answer key ☟

1.28.31 Identify Function: GATE CSE 2020 | Question: 48

Consider the following C functions.

int tob (int b, int* arr) { int pp(int a, int b) {


int i; int arr[20];
for (i = 0; b>0; i++) { int i, tot = 1, ex, len;
if (b%2) arr [i] = 1; ex = a;
else arr[i] = 0; len = tob(b, arr);
b = b/2; for (i=0; i<len ; i++) {
} if (arr[i] ==1)
return (i); tot = tot * ex;
} ex= ex*ex;
}
return (tot) ;
}

The value returned by is _______.

gatecse-2020 numerical-answers identify-function 2-marks

Answer key ☟

1.28.32 Identify Function: GATE CSE 2021 Set 1 | Question: 48

Consider the following function:


int SimpleFunction(int Y[], int n, int x)
{
int total = Y[0], loopIndex;
for (loopIndex=1; loopIndex<=n-1; loopIndex++)
total=x*total +Y[loopIndex];
return total;
}

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 ☟

1.28.33 Identify Function: GATE CSE 2021 Set 2 | Question: 23

Consider the following function:


int SomeFunction (int x, int y)
{
if ((x==1) || (y==1)) return 1;
if (x==y) return x;
if (x > y) return SomeFunction(x-y, y);
if (y > x) return SomeFunction (x, y-x);

The value returned by is __________

gatecse-2021-set2 numerical-answers algorithms identify-function output 1-mark

Answer key ☟

1.28.34 Identify Function: GATE IT 2005 | Question: 53

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;
}

Choose the correct alternative for statements and .

A. A: count [a[j]]++ and B: count[b[j]]--


B. A: count [a[j]]++ and B: count[b[j]]++
C. A: count [a[j++]]++ and B: count[b[j]]--
D. A: count [a[j]]++ and B: count[b[j++]]--

gateit-2005 normal identify-function

Answer key ☟

1.28.35 Identify Function: GATE IT 2005 | Question: 57

What is the output printed by the following program?


#include <stdio.h>

int f(int n, int k) {


if (n == 0) return 0;
else if (n % 2) return f(n/2, 2*k) + k;
else return f(n/2, 2*k) - k;
}

int main () {
printf("%d", f(20, 1));
return 0;
}
A. B. C. D.
gateit-2005 algorithms identify-function normal

Answer key ☟

1.28.36 Identify Function: GATE IT 2006 | Question: 52

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 ☟

1.28.37 Identify Function: GATE IT 2008 | Question: 82

Consider the code fragment written in C below :


void f (int n)
{
if (n <=1) {
printf ("%d", n);
}
else {
f (n/2);
printf ("%d", n%2);
}
}

What does f(173) print?

A. B. C. D.
gateit-2008 algorithms recursion identify-function normal

Answer key ☟

1.28.38 Identify Function: GATE IT 2008 | Question: 83

Consider the code fragment written in C below :

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);
}
}
}

A. Both and B. only C. only D. Neither nor


gateit-2008 algorithms recursion identify-function normal

Answer key ☟

1.28.39 Identify Function: GATE Overflow Test Series | Mock GATE | Test 3 | Question: 40

Consider the following pseudocode:


struct node {
int data;
struct node* left;
struct node* right;
};
struct node* Dosomething(struct node* root, int key)
{
struct node* temp;
if(root == NULL)
return root;
if(root -> data == key)
return root;
if( key < root -> data)
{
if(root -> left == NULL)
return root;
temp = Dosomething(root -> left,key);
if( abs(temp -> data - key) > abs(root -> data - key))
return root;
else if( abs(temp -> data - key) < abs(root -> data - key))
return temp;
}
else
{
if(root -> right==NULL)
return root;
temp = Dosomething(root -> right,key);
if( abs(temp -> data - key) > abs(root -> data - key))
return root;
else if( abs(temp data - key) < abs(root -> data - key))
return temp;
}
}

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

Consider the following C program:


#include <stdio.h>
int foo(int A[], int n, int s)
{
for (int i = 0; i < n - 2; i++)
for (int j = i + 1; j < n - 1; j++)
for (int k = j + 1; k < n; k++)
if (A[i] + A[j] + A[k] == s)
return i+j+k+3;
return 0;
}
int main()
{
int A[] = { 6, 14, 15, 3, 1, 10, 10 };
int n = sizeof(A) / sizeof(A[0]);
printf("%d", foo(A, n, 24));
return 0;
}

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 ________

go2025-mockgate-5 numerical-answers identify-function algorithms time-complexity 2-marks

Answer key ☟

1.29 In Place Algo (1)

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

A. Merge sort, Quick sort B. Quick sort, insertion sort


C. Insertion sort, Quick sort D. Insertion sort, Merge sort
ugcnetcse-june2019-paper2 in-place-algo quicksort-mergesort-insertion-sort

Answer key ☟

1.30 Insertion Sort (3)

1.30.1 Insertion Sort: GATE CSE 2003 | Question: 22

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 ☟

1.30.2 Insertion Sort: GATE CSE 2003 | Question: 62

In a permutation , of distinct integers, an inversion is a pair such that and

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 Knapsack Problem (2)

1.31.1 Knapsack Problem: UGC NET CSE | June 2014 | Part 3 | Question: 62

Consider the fractional knapsack instance


and .
The maximum profit is given by (Assume and denotes profit and weight of objects respectively)

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?

A. is correct and is not correct B. Both and are correct


C. Both and are not correct D. is not correct and is correct
ugcnetcse-sep2013-paper3 algorithms knapsack-problem

Answer key ☟

1.32 Linear Search (1)

1.32.1 Linear Search: UGC NET CSE | Junet 2015 | Part 2 | Question: 24

The average case occurs in Linear Search Algorithm when

A. The item to be searched is in some where middle of the Array


B. The item to be searched is not in the array
C. The item to be searched is in the last of t he array
D. The item to be searched is either in the last or not in the array

ugcnetcse-june2015-paper2 algorithms linear-search

Answer key ☟

1.33 Longest Common Subsequence (1)


1.33.1 Longest Common Subsequence: UGC NET CSE | December 2015 | Part 3 | Question: 17

Given two sequences and :

The longest common subsequence of X and Y is:

A. B.
C. D.
ugcnetcse-dec2015-paper3 algorithms longest-common-subsequence

Answer key ☟

1.34 Matrix Chain Ordering (7)

1.34.1 Matrix Chain Ordering: GATE CSE 2011 | Question: 38

Four Matrices and of dimensions and respectively can be


multiplied in several ways with different number of total scalar multiplications. For example when
multiplied as , the total number of scalar multiplications is . When
multiplied as , the total number of scalar multiplications is .

If and , then the minimum number of scalar multiplications needed is

A. B. C. D.
gatecse-2011 algorithms dynamic-programming normal matrix-chain-ordering

Answer key ☟

1.34.2 Matrix Chain Ordering: GATE CSE 2016 Set 2 | Question: 38

Let and be four matrices of dimensions and , respectively.


The minimum number of scalar multiplications required to find the product using the basic
matrix multiplication method is _________.
gatecse-2016-set2 dynamic-programming algorithms matrix-chain-ordering normal numerical-answers

Answer key ☟

1.34.3 Matrix Chain Ordering: GATE CSE 2018 | Question: 31

Assume that multiplying a matrix of dimension with another matrix of dimension


requires scalar multiplications. Computing the product of matrices can be done
by parenthesizing in different ways. Define as an explicitly computed pair for a given
paranthesization if they are directly multiplied. For example, in the matrix multiplication chain
using parenthesization and are only explicitly
computed pairs.
Consider a matrix multiplication chain , where matrices and are of dimensions
and , respectively. In the parenthesization of that
minimizes the total number of scalar multiplications, the explicitly computed pairs is/are

A. and only B. only


C. only D. and only
gatecse-2018 algorithms dynamic-programming 2-marks matrix-chain-ordering

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

The number of possible paranthesizations of a sequence of n matrices is

A. O(n) B. (n Ig n) C. D. None of the above


ugcnetcse-sep2013-paper3 algorithms dynamic-programming matrix-chain-ordering

Answer key ☟

1.35 Merge Sort (5)

1.35.1 Merge Sort: GATE CSE 1999 | Question: 1.14, ISRO2015-42

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.

gate1999 algorithms merge-sort normal isro2015 sorting


Answer key ☟

1.35.2 Merge Sort: GATE CSE 2012 | Question: 39

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 ☟

1.35.3 Merge Sort: GATE CSE 2015 Set 3 | Question: 27

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

A. m n B. max(m, n) C. min(m, n) D. m+n-1


ugcnetcse-dec2013-paper2 algorithms merge-sort

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 ?

A. The array elements form a heap.


B. Elements in each half of the array are sorted amongst themselves.
C. Elements in the first half of the array are less than or equal to elements in second half of the array.
D. All of the above

ugcnetcse-june2014-paper2 algorithms sorting merge-sort

Answer key ☟

1.36 Merging (2)

1.36.1 Merging: GATE CSE 1995 | Question: 1.16

For merging two sorted lists of sizes and into a sorted list of size , we require comparisons of

A. B. C. D.

gate1995 algorithms sorting normal merging

Answer key ☟
1.36.2 Merging: GATE CSE 2014 Set 2 | Question: 38

Suppose are sorted sequences having lengths respectively. They are to


be merged into a single sequence by merging together two sequences at a time. The number of
comparisons that will be needed in the worst case by the optimal algorithm for doing this is ____.
gatecse-2014-set2 algorithms sorting normal numerical-answers merging

Answer key ☟

1.37 Minimum Spanning Tree (40)

1.37.1 Minimum Spanning Tree: GATE CSE 1991 | Question: 03,vi

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 ☟

1.37.2 Minimum Spanning Tree: GATE CSE 1992 | Question: 01,ix

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 ☟

1.37.3 Minimum Spanning Tree: GATE CSE 1995 | Question: 22

How many minimum spanning trees does the following graph have? Draw them. (Weights are assigned
to edges).

gate1995 algorithms graph-algorithms minimum-spanning-tree easy descriptive

Answer key ☟

1.37.4 Minimum Spanning Tree: GATE CSE 1996 | Question: 16

A complete, undirected, weighted graph is given on the vertex for any fixed ‘n’.
Draw the minimum spanning tree of if

A. the weight of the edge is


B. the weight of the edge is

gate1996 algorithms graph-algorithms minimum-spanning-tree normal descriptive


Answer key ☟

1.37.5 Minimum Spanning Tree: GATE CSE 1997 | Question: 9

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.

gate1997 algorithms minimum-spanning-tree normal descriptive

Answer key ☟

1.37.6 Minimum Spanning Tree: GATE CSE 2000 | Question: 2.18

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?

A. Every minimum spanning tree of must contain


B. If is in a minimum spanning tree, then its removal must disconnect
C. No minimum spanning tree contains
D. has a unique minimum spanning tree

gatecse-2000 algorithms minimum-spanning-tree normal

Answer key ☟

1.37.7 Minimum Spanning Tree: GATE CSE 2001 | Question: 15

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.

A. List the edges of a minimum spanning tree of the graph.


B. How many distinct minimum spanning trees does this graph have?
C. Is the minimum among the edge weights of a minimum spanning tree unique over all possible minimum
spanning trees of a graph?
D. Is the maximum among the edge weights of a minimum spanning tree unique over all possible minimum
spanning tree of a graph?

gatecse-2001 algorithms minimum-spanning-tree normal descriptive

Answer key ☟

1.37.8 Minimum Spanning Tree: GATE CSE 2003 | Question: 68

What is the weight of a minimum spanning tree of the following graph?


A. B. C. D.
gatecse-2003 algorithms minimum-spanning-tree normal

Answer key ☟

1.37.9 Minimum Spanning Tree: GATE CSE 2005 | Question: 6

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?

A. Graph has no minimum spanning tree (MST)


B. Graph has unique MST of cost
C. Graph has multiple distinct MSTs, each of cost
D. Graph has multiple spanning trees of different costs

gatecse-2005 algorithms minimum-spanning-tree normal

Answer key ☟

1.37.10 Minimum Spanning Tree: GATE CSE 2006 | Question: 11

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.

gatecse-2006 algorithms minimum-spanning-tree normal

Answer key ☟

1.37.11 Minimum Spanning Tree: GATE CSE 2006 | Question: 47

Consider the following graph:


Which one of the following cannot be the sequence of edges added, in that order, to a minimum spanning tree
using Kruskal’s algorithm?

A. B.
C. D.
gatecse-2006 algorithms graph-algorithms minimum-spanning-tree normal

Answer key ☟

1.37.12 Minimum Spanning Tree: GATE CSE 2007 | Question: 49

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?

A. There is a minimum spanning tree containing


B. If is not in a minimum spanning tree , then in the cycle formed by adding to , all edges have the
same weight.
C. Every minimum spanning tree has an edge of weight
D. is present in every minimum spanning tree

gatecse-2007 algorithms minimum-spanning-tree normal

Answer key ☟

1.37.13 Minimum Spanning Tree: GATE CSE 2009 | Question: 38

Consider the following graph:

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.

gatecse-2009 algorithms minimum-spanning-tree normal

Answer key ☟

1.37.14 Minimum Spanning Tree: GATE CSE 2010 | Question: 50

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 ☟

1.37.15 Minimum Spanning Tree: GATE CSE 2010 | Question: 51

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 ☟

1.37.16 Minimum Spanning Tree: GATE CSE 2011 | Question: 54

An undirected graph contains nodes named . Two nodes are


connected if and only if . Each edge is assigned a weight . A sample graph
with is shown below.

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 ☟

1.37.17 Minimum Spanning Tree: GATE CSE 2011 | Question: 55

An undirected graph contains nodes named . Two nodes are


connected if and only if . Each edge is assigned a weight . A sample graph
with is shown below.
The length of the path from to in the MST of previous question with is

A. B. C. D.
gatecse-2011 algorithms graph-algorithms minimum-spanning-tree normal

Answer key ☟

1.37.18 Minimum Spanning Tree: GATE CSE 2012 | Question: 29

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?

A. with total weight B. with total weight


C. but total weight D. None of the above
gatecse-2012 algorithms minimum-spanning-tree normal marks-to-all

Answer key ☟

1.37.19 Minimum Spanning Tree: GATE CSE 2014 Set 2 | Question: 52

The number of distinct minimum spanning trees for the weighted graph below is _____

gatecse-2014-set2 algorithms minimum-spanning-tree numerical-answers normal

Answer key ☟

1.37.20 Minimum Spanning Tree: GATE CSE 2015 Set 1 | Question: 43

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_______________.

gatecse-2015-set1 algorithms minimum-spanning-tree normal numerical-answers

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 ☟

1.37.22 Minimum Spanning Tree: GATE CSE 2016 Set 1 | Question: 14

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?

: Minimum spanning tree of does not change.


: Shortest path between any pair of vertices does not change.

A. only B. only C. Neither nor D. Both and


gatecse-2016-set1 algorithms minimum-spanning-tree normal

Answer key ☟

1.37.23 Minimum Spanning Tree: GATE CSE 2016 Set 1 | Question: 39

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 ☟

1.37.24 Minimum Spanning Tree: GATE CSE 2016 Set 1 | Question: 40

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?

I. If is the lightest edge of some cycle in , then every MST of includes .


II. If is the heaviest edge of some cycle in , then every MST of excludes .

A. I only. B. II only. C. Both I and II. D. Neither I nor II.


gatecse-2016-set1 algorithms minimum-spanning-tree normal

Answer key ☟

1.37.25 Minimum Spanning Tree: GATE CSE 2018 | Question: 47

Consider the following undirected graph :

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 ____.

gatecse-2018 algorithms graph-algorithms minimum-spanning-tree numerical-answers 2-marks

Answer key ☟

1.37.26 Minimum Spanning Tree: GATE CSE 2020 | Question: 31

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.

gatecse-2020 algorithms minimum-spanning-tree graph-algorithms 2-marks

Answer key ☟

1.37.27 Minimum Spanning Tree: GATE CSE 2020 | Question: 49

Consider a graph , where , , and


weight of the edge is . The weight of minimum spanning tree of is _________
gatecse-2020 numerical-answers algorithms graph-algorithms 2-marks minimum-spanning-tree

Answer key ☟

1.37.28 Minimum Spanning Tree: GATE CSE 2021 Set 1 | Question: 17

Consider the following undirected graph with edge weights as shown:

The number of minimum-weight spanning trees of the graph is ___________.

gatecse-2021-set1 algorithms graph-algorithms minimum-spanning-tree numerical-answers 1-mark

Answer key ☟

1.37.29 Minimum Spanning Tree: GATE CSE 2021 Set 2 | Question: 1

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.

Which one of the following options is correct?

A. Both and are true B. is true and is false


C. is false and is true D. Both and are false
gatecse-2021-set2 algorithms graph-algorithms minimum-spanning-tree 1-mark
Answer key ☟

1.37.30 Minimum Spanning Tree: GATE CSE 2022 | Question: 39

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.

gatecse-2022 algorithms minimum-spanning-tree multiple-selects 2-marks

Answer key ☟

1.37.31 Minimum Spanning Tree: GATE CSE 2022 | Question: 48

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

indicates a directed edge from node to node A of rooted at


is defined as a subgraph of such that the undirected version of is a tree, and contains a directed path
from to every other vertex in The number of such directed spanning trees rooted at vertex is
__________________.
gatecse-2022 numerical-answers algorithms minimum-spanning-tree 2-marks

Answer key ☟

1.37.32 Minimum Spanning Tree: GATE CSE 2024 | Set 2 | Question: 49

The number of distinct minimum-weight spanning trees of the following graph is

gatecse2024-set2 numerical-answers algorithms minimum-spanning-tree

Answer key ☟

1.37.33 Minimum Spanning Tree: GATE IT 2005 | Question: 52

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?

A. There exists a cutset in having all edges of maximum weight.


B. There exists a cycle in having all edges of maximum weight.
C. Edge cannot be contained in a cycle.
D. All edges in have the same weight.

gateit-2005 algorithms minimum-spanning-tree normal

Answer key ☟

1.37.34 Minimum Spanning Tree: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 61

Consider the following graph:

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.

go2025-mockgate-2 minimum-spanning-tree multiple-selects

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 __________

go2025-mockgate-3 numerical-answers algorithms minimum-spanning-tree

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.

go2025-mockgate-4 algorithms graph-algorithms minimum-spanning-tree multiple-selects

Answer key ☟

1.37.37 Minimum Spanning Tree: GATE Overflow Test Series | Mock GATE | Test 4 | Question: 47

An undirected graph contains nodes named as . Two vertices are


adjacent if All the edge weights is unity. How many MST are possible for ?
go2025-mockgate-4 numerical-answers algorithms minimum-spanning-tree

Answer key ☟

1.37.38 Minimum Spanning Tree: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 46

A cut of an undirected graph is a partition of We say that an edge


crosses the cut if one of its endpoints is in and the other is in An edge
is a light edge crossing a cut if its weight is the minimum of any edge crossing the cut. Considering
undirected graphs with all distinct edge weights mark all the correct options given below.

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.

go2025-mockgate-6 algorithms minimum-spanning-tree multiple-selects 2-marks

1.37.39 Minimum Spanning Tree: UGC NET CSE | November 2017 | Part 2 | Question: 5

Consider the graph given below:

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.37.40 Minimum Spanning Tree: UGCNET CSE December 2022: 28

Consider the Graph below:


How many spanning trees can be found?

1.
2.
3.
4.

(Option
(Option
(Option
(Option
Answer Given by Candidate :

ugcnetcse-dec2022 algorithms minimum-spanning-tree

Answer key ☟

1.38 Non Gatecse (1)

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)

Choose the correct answer from the options given below:

A. B.
C. D.
ugcnetcse-oct2020-paper2 non-gatecse algorithms

Answer key ☟

1.39 Open Addressing (1)

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 Optimal Search Tree (1)

1.40.1 Optimal Search Tree: UGC NET CSE | December 2015 | Part 3 | Question: 21

Let and =(do, if, int, while). Let and

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.

ugcnetcse-dec2015-paper3 algorithms optimal-search-tree


Answer key ☟

1.41 Optimal Solution (1)

1.41.1 Optimal Solution: UGC NET CSE | June 2019 | Part 2 | Question: 68

Consider the following steps:


: Characterize the structure of an optimal solution
: Compute the value of an optimal solution in bottom-up fashion
Which of the following step(s) is/are common to both dynamic programming and greedy algorithms?

A. Only B. Only C. Both and D. Neither nor


ugcnetcse-june2019-paper2 optimal-solution dynamic-programming greedy-algorithm

Answer key ☟

1.42 Out of Gatecse Syllabus (1)

1.42.1 Out of Gatecse Syllabus: GATE CSE 1987 | Question: 11c

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 ☟

1.43 P NP NPC NPH (10)

1.43.1 P NP NPC NPH: GATE CSE 1992 | Question: 02,vi

Which of the following problems is not -hard?

a. Hamiltonian circuit problem b. The Knapsack problem


c. Finding bi-connected components of a d. The graph coloring problem
graph
gate1992 p-np-npc-nph algorithms multiple-selects out-of-gatecse-syllabus

Answer key ☟

1.43.2 P NP NPC NPH: GATE CSE 2003 | Question: 12

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?

A. is NP-hard but not NP-complete B. is in NP, but is not NP-complete


C. is NP-complete D. is neither NP-hard, nor in NP
gatecse-2003 algorithms p-np-npc-nph normal out-of-gatecse-syllabus
Answer key ☟

1.43.3 P NP NPC NPH: GATE CSE 2004 | Question: 30, ISRO2017-10

The problem and are

A. both in B. both complete


C. -complete and in respectively D. undecidable and complete respectively
gatecse-2004 algorithms p-np-npc-nph easy isro2017 out-of-gatecse-syllabus

Answer key ☟

1.43.4 P NP NPC NPH: GATE CSE 2006 | Question: 16, ISRO-DEC2017-27

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 ☟

1.43.5 P NP NPC NPH: GATE CSE 2008 | Question: 44

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

gatecse-2008 algorithms p-np-npc-nph normal out-of-gatecse-syllabus

Answer key ☟

1.43.6 P NP NPC NPH: GATE IT 2006 | Question: 10

A problem in NP is NP-complete if

A. it can be reduced to the 3-SAT problem in polynomial time


B. the 3-SAT problem can be reduced to it in polynomial time
C. it can be reduced to any other problem in NP in polynomial time
D. some problem in NP can be reduced to it in polynomial time

gateit-2006 algorithms p-np-npc-nph easy out-of-syllabus-now

Answer key ☟

1.43.7 P NP NPC NPH: GATE IT 2008 | Question: 11

For problems X and Y, Y is NP-complete and X reduces to Y in polynomial time. Which of the
following is TRUE?

A. If X can be solved in polynomial time, B. X is NP-complete


then so can Y
C. X is NP-hard D. X is in NP, but not necessarily NP-
complete
gateit-2008 algorithms p-np-npc-nph normal out-of-syllabus-now

Answer key ☟

1.43.8 P NP NPC NPH: UGC NET CSE | December 2014 | Part 3 | Question: 33

We can show that the clique problem is -hard by proving that

A. CLIQUE P 3-CNF_SAT B. CLIQUE P VERTEX_COVER


C. CLIQUE P SUBSET_SUM D. None of the above
ugcnetcse-dec2014-paper3 algorithms p-np-npc-nph

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:

Which of the following is/are correct?

A. Only B. Only C. Both and D. Neither nor


ugcnetcse-june2019-paper2 p-np-npc-nph

Answer key ☟

1.43.10 P NP NPC NPH: UGC NET CSE | Junet 2015 | Part 3 | Question: 32

The travelling salesman problem can be solved in

A. Polynomial time using dynamic programming algorithm


B. Polynomial time using branch-and-bound algorithm
C. Exponential time using dynamic programming algorithm or branch-and-bound algorithm
D. Polynomial time using back tracking algorithm

algorithms p-np-npc-nph ugcnetcse-june2015-paper3

Answer key ☟

1.44 Prims Algorithm (3)

1.44.1 Prims Algorithm: GATE IT 2004 | Question: 56

Consider the undirected graph below:

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.

gateit-2004 algorithms graph-algorithms normal prims-algorithm

Answer key ☟

1.44.2 Prims Algorithm: GATE IT 2008 | Question: 45

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 Span​ning Tree?

A.
B.
C.
D.

gateit-2008 algorithms graph-algorithms minimum-spanning-tree normal prims-algorithm

Answer key ☟

1.44.3 Prims Algorithm: UGC NET CSE | October 2020 | Part 2 | Question: 78

Consider the undirected graph below:

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.

prims-algorithm algorithms minimum-spanning-tree ugcnetcse-oct2020-paper2

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;
}

Which of the following is computer by the above pseudocode?

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 ☟

1.46 Quick Sort (16)

1.46.1 Quick Sort: GATE CSE 1987 | Question: 1-xviii

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 ☟

1.46.2 Quick Sort: GATE CSE 1989 | Question: 9

An input files has records with keys as given below:

This is to be sorted in non-decreasing order.

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.

gate1989 descriptive algorithms sorting quick-sort

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 ☟

1.46.4 Quick Sort: GATE CSE 1996 | Question: 2.15

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 ☟

1.46.5 Quick Sort: GATE CSE 2001 | Question: 1.14

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 ☟

1.46.6 Quick Sort: GATE CSE 2006 | Question: 52

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 ☟

1.46.7 Quick Sort: GATE CSE 2008 | Question: 43

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 ☟

1.46.8 Quick Sort: GATE CSE 2009 | Question: 39

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 ☟

1.46.9 Quick Sort: GATE CSE 2014 Set 1 | Question: 14

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 ☟

1.46.10 Quick Sort: GATE CSE 2014 Set 3 | Question: 14

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 ☟

1.46.11 Quick Sort: GATE CSE 2015 Set 1 | Question: 2

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 ☟

1.46.12 Quick Sort: GATE CSE 2015 Set 2 | Question: 45

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 (___________);
}
}

The missing arguments lists are respectively

A. left_end and left_end B. left_end and left_end


left_end left_end left_end
C. left_end left_end D. left_end left_end and
left_end and left_end left_end

gatecse-2015-set2 algorithms normal sorting quick-sort

Answer key ☟

1.46.13 Quick Sort: GATE CSE 2019 | Question: 20

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 ☟

1.46.14 Quick Sort: GATE DS&AI 2024 | Question: 20

Consider sorting the following array of integers in ascending order using an inplace Quicksort algorithm
that uses the last element as the pivot.

The minimum number of swaps performed during this Quicksort is .


gate-ds-ai-2024 numerical-answers algorithms quick-sort

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)

1.47.1 Recurrence Relation: GATE CSE 1987 | Question: 10a

Solve the recurrence equations:

gate1987 algorithms recurrence-relation descriptive

Answer key ☟

1.47.2 Recurrence Relation: GATE CSE 1988 | Question: 13iv

Solve the recurrence equations:

gate1988 descriptive algorithms recurrence-relation

Answer key ☟

1.47.3 Recurrence Relation: GATE CSE 1989 | Question: 13b

Find a solution to the following recurrence equation:

gate1989 descriptive algorithms recurrence-relation

Answer key ☟

1.47.4 Recurrence Relation: GATE CSE 1990 | Question: 17a

Express in terms of the harmonic number , where satisfies the

recurrence relation,

, for and

What is the asymptotic behaviour of as a function of ?


gate1990 descriptive algorithms recurrence-relation

Answer key ☟

1.47.5 Recurrence Relation: GATE CSE 1992 | Question: 07a

Consider the function for which the pseudocode is given below :


Function F(n)
begin
F1 ← 1
if(n=1) then F ← 3
else
For i = 1 to n do
begin
C ← 0
For j = 1 to n – 1 do
begin C ← C + 1 end
F1 = F1 * C
end
F = F1
end

[ is a positive integer greater than zero]

A. Derive a recurrence relation for .

gate1992 algorithms recurrence-relation descriptive

Answer key ☟

1.47.6 Recurrence Relation: GATE CSE 1992 | Question: 07b

Consider the function for which the pseudocode is given below :


Function F(n)
begin
F1 ← 1
if(n=1) then F ← 3
else
For i = 1 to n do
begin
C ← 0
For j = 1 to n – 1 do
begin C ← C + 1 end
F1 = F1 * C
end
F = F1
end

[ is a positive integer greater than zero]

B. Solve the recurrence relation for a closed form solution of .

gate1992 algorithms recurrence-relation descriptive

Answer key ☟

1.47.7 Recurrence Relation: GATE CSE 1993 | Question: 15

Consider the recursive algorithm given below:


procedure bubblesort (n);
var i,j: index; temp : item;
begin
for i:=1 to n-1 do
if A[i] > A[i+1] then
begin
temp := A[i];
A[i] := A[i+1];
A[i+1] := temp;
end;
bubblesort (n-1)
end

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 .

gate1993 algorithms recurrence-relation normal descriptive

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 ☟

1.47.9 Recurrence Relation: GATE CSE 1996 | Question: 2.12

The recurrence relation

has the solution equal to

A. B. C. D. None of the above

gate1996 algorithms recurrence-relation normal

Answer key ☟

1.47.10 Recurrence Relation: GATE CSE 1997 | Question: 15

Consider the following function.


Function F(n, m:integer):integer;
begin
if (n<=0) or (m<=0) then F:=1
else
F:F(n-1, m) + F(n-1, m-1);
end;

Use the recurrence relation to answer the following questions. Assume that
are positive integers. Write only the answers without any explanation.

a. What is the value of ?


b. What is the value of ?
c. How many recursive calls are made to the function , including the original call, when evaluating .

gate1997 algorithms recurrence-relation descriptive

Answer key ☟

1.47.11 Recurrence Relation: GATE CSE 1997 | Question: 4.6

Let be the function defined by for .


Which of the following statements is true?

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

Solve the following recurrence relation

gate1998 algorithms recurrence-relation descriptive

Answer key ☟

1.47.13 Recurrence Relation: GATE CSE 2002 | Question: 1.3

The solution to the recurrence equation is

A. B. C. D.
gatecse-2002 algorithms recurrence-relation normal

Answer key ☟

1.47.14 Recurrence Relation: GATE CSE 2002 | Question: 2.11

The running time of the following algorithm


Procedure
If return ( ) else return ;
is best described by

A. B. C. D.
gatecse-2002 algorithms recurrence-relation normal

Answer key ☟

1.47.15 Recurrence Relation: GATE CSE 2003 | Question: 35

Consider the following recurrence relation

for all
The value of for is

A. B.
C. D.
gatecse-2003 algorithms time-complexity recurrence-relation difficult

Answer key ☟

1.47.16 Recurrence Relation: GATE CSE 2004 | Question: 83, ISRO2015-40

The time complexity of the following C function is (assume )


int recursive (int n) {
if(n == 1)
return (1);
else
return (recursive (n-1) + recursive (n-1));
}

A. B. C. D.
gatecse-2004 algorithms recurrence-relation time-complexity normal isro2015
Answer key ☟

1.47.17 Recurrence Relation: GATE CSE 2004 | Question: 84

The recurrence equation

evaluates to

A. B. C. D.
gatecse-2004 algorithms recurrence-relation normal

Answer key ☟

1.47.18 Recurrence Relation: GATE CSE 2006 | Question: 51, ISRO2016-34

Consider the following recurrence:

Which one of the following is true?

A. B.
C. D.
algorithms recurrence-relation isro2016 gatecse-2006

Answer key ☟

1.47.19 Recurrence Relation: GATE CSE 2008 | Question: 78

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 ☟

1.47.20 Recurrence Relation: GATE CSE 2008 | Question: 79

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 ☟

1.47.21 Recurrence Relation: GATE CSE 2009 | Question: 35

The running time of an algorithm is represented by the following recurrence relation:

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 ☟

1.47.22 Recurrence Relation: GATE CSE 2012 | Question: 16

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 ☟

1.47.23 Recurrence Relation: GATE CSE 2014 Set 2 | Question: 13

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 ☟

1.47.24 Recurrence Relation: GATE CSE 2015 Set 1 | Question: 49

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 ☟

1.47.25 Recurrence Relation: GATE CSE 2015 Set 3 | Question: 39

Consider the following recursive C function.


void get(int n)
{
if (n<1) return;
get (n-1);
get (n-3);
printf("%d", n);
}

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 ☟

1.47.26 Recurrence Relation: GATE CSE 2016 Set 2 | Question: 39

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 .

gatecse-2016-set2 algorithms time-complexity recurrence-relation normal numerical-answers

Answer key ☟

1.47.27 Recurrence Relation: GATE CSE 2017 Set 2 | Question: 30

Consider the recurrence function

Then in terms of notation is

A. B.
C. D.
gatecse-2017-set2 algorithms recurrence-relation

Answer key ☟

1.47.28 Recurrence Relation: GATE CSE 2020 | Question: 2

For parameters and , both of which are , , and . Then is

A. B. )
C. ) D. )
gatecse-2020 algorithms recurrence-relation 1-mark

Answer key ☟

1.47.29 Recurrence Relation: GATE CSE 2021 Set 1 | Question: 30

Consider the following recurrence relation.

Which one of the following options is correct?

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:

Which one of the following options is correct about the recurrence ?

A. If is , then is
B. If is , then is
C. If is for some , then is
D. If is , then is

gatecse-2021-set2 algorithms recurrence-relation 2-marks

Answer key ☟

1.47.31 Recurrence Relation: GATE CSE 2024 | Set 1 | Question: 32

Consider the following recurrence relation:

Which one of the following options is CORRECT?

A. B.
C. D.

gatecse2024-set1 algorithms recurrence-relation

Answer key ☟

1.47.32 Recurrence Relation: GATE IT 2004 | Question: 57

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 ☟

1.47.33 Recurrence Relation: GATE IT 2005 | Question: 51

Let be a function defined by the recurrence


for and
Which of the following statements is TRUE?

A. B.
C. D.
gateit-2005 algorithms recurrence-relation easy

Answer key ☟

1.47.34 Recurrence Relation: GATE IT 2008 | Question: 44

When for some , the recurrence relation


,
evaluates to :

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

Let be a function defined by and , which of the following is


true?

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

The solution of the reccurence relation

is

A. B. C. D. None of the above


ugcnetcse-dec2015-paper3 algorithms recurrence-relation

Answer key ☟

1.47.37 Recurrence Relation: UGC NET CSE | December 2018 | Part 2 | Question: 21

The solution of recurrence relation:


is

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

The solution of the recurrence relation is

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

The solution of recurrence relation, is

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

The solution of the recurrence relation of is

A. B. C. D.
ugcnetjune2014iii algorithms recurrence-relation

Answer key ☟

1.47.41 Recurrence Relation: UGC NET CSE | September 2013 | Part 3 | Question: 37

The time complexity of reccurence relation T(n) = T(n/3) + T(2n/3) +O(n) is

A. O(Ig n) B. O(n) C. O(n Ig n) D. O(n )


ugcnetcse-sep2013-paper3 algorithms time-complexity recurrence-relation

Answer key ☟

1.48 Recursion (7)

1.48.1 Recursion: GATE CSE 1995 | Question: 2.9

A language with string manipulation facilities uses the following operations


head(s): first character of a string
tail(s): all but exclude the first character of a string

concat(s1, s2): s1s2

For the string " " what will be the output of


concat(head(s), head(tail(tail(s))))

A. B. C. D.
gate1995 algorithms normal recursion

Answer key ☟

1.48.2 Recursion: GATE CSE 2007 | Question: 44

In the following C function, let .


int gcd(n,m) {
if (n%m == 0) return m;
n = n%m;
return gcd(m,n);
}

How many recursive calls are made by this function?


A. B.
C. D.
gatecse-2007 algorithms recursion time-complexity normal

Answer key ☟

1.48.3 Recursion: GATE CSE 2018 | Question: 45

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 _____

gatecse-2018 numerical-answers algorithms recursion 2-marks

Answer key ☟

1.48.4 Recursion: GATE CSE 2021 Set 2 | Question: 49

Consider the following program


#include <stdio.h>
int foo(int x, int y, int q)
{
if ((x<=0) && (y<=0))
return q;
if (x<=0)
return foo(x, y-q, q);
if (y<=0)
return foo(x-q, y, q);
return foo(x, y-q, q) + foo(x-q, y, q);
}
int main( )
{
int r = foo(15, 15, 10);
printf(“%d”, r);
return 0;
}

The output of the program upon execution is _________

gatecse-2021-set2 algorithms recursion output numerical-answers 2-marks

Answer key ☟

1.48.5 Recursion: GATE Suitability Test | Test 1 | Question: 11

Consider the following C program?


void mystery(int n){
if(n<=0) return;
printf("%d", 0);
mystery(n-1);
mystery(n-2);
}

int main(){
int n=10;
mystery(n);
return 0;
}

The number of ‘0’s printed by above program is ?

gate-suitability-test-1 recursion numerical-answers

1.48.6 Recursion: UGC NET CSE | December 2009 | Part 2 | Question: 11

Recursive functions are executed in a

(A) First in first out-order

(B) Last in first out-order

(C) Parallel fashion

(D) Load balancing


ugcnetcse-dec2009-paper2 algorithms recursion

Answer key ☟

1.48.7 Recursion: UGC NET CSE | December 2011 | Part 2 | Question: 3

Which of the following is a bad example of recursion ?

A. Factorial B. Fibonacci numbers


C. Tower of Hanai D. Tree traversal
ugcnetcse-dec2011-paper2 algorithms recursion

Answer key ☟

1.49 Red Black Tree (1)

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 ☟

1.50 Searching (7)

1.50.1 Searching: GATE CSE 1996 | Question: 18

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;

gate1996 algorithms searching normal descriptive

Answer key ☟

1.50.2 Searching: GATE CSE 1996 | Question: 2.13, ISRO2016-28

The average number of key comparisons required for a successful search for sequential search on
items is

A. B. C. D. None of the above


gate1996 algorithms easy isro2016 searching

Answer key ☟

1.50.3 Searching: GATE CSE 2002 | Question: 2.10

Consider the following algorithm for searching for a given number in an unsorted array
having distinct values:

1. Choose an at random from


2. If , then Stop else Goto 1;

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 ☟

1.50.4 Searching: GATE CSE 2008 | Question: 84

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 ") ;
}

On which of the following contents of and does the program fail?

A. is and
B. is and
C. is and
D. is and and is even

gatecse-2008 algorithms searching normal

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 ") ;
}

The correction needed in the program to make it work properly is

A. Change line 6 to: if ; else ;


B. Change line 6 to: if ; else ;
C. Change line 6 to: if ; else ;
D. Change line 7 to: } while ;

gatecse-2008 algorithms searching normal

Answer key ☟

1.50.6 Searching: GATE CSE 2017 Set 1 | Question: 48

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 ____________.

gatecse-2017-set1 algorithms normal numerical-answers searching

Answer key ☟

1.50.7 Searching: GATE Overflow | Mock GATE | Test 1 | Question: 32

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 ☟

1.51 Shortest Path (7)


1.51.1 Shortest Path: GATE CSE 2002 | Question: 12

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] =_______;}
}

ALGORITHM: For i = 1 ... n


{For j = 1 ... n
{For k = 1 ... n
{P[__,__] = min{_______,______}; }
}
}

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 (___).

gatecse-2002 algorithms graph-algorithms time-complexity normal descriptive shortest-path

Answer key ☟

1.51.2 Shortest Path: GATE CSE 2003 | Question: 67

Let be an undirected graph with a subgraph . Weights are assigned to edges


of as follows.

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?

A. The number of edges in the shortest paths from to all vertices of


B. is connected
C. forms a clique in
D. is a tree

gatecse-2003 algorithms graph-algorithms normal shortest-path

Answer key ☟

1.51.3 Shortest Path: GATE CSE 2007 | Question: 41

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

A. Dijkstra’s algorithm starting from . B. Warshall’s algorithm.


C. Performing a DFS starting from . D. Performing a BFS starting from .
gatecse-2007 algorithms graph-algorithms easy shortest-path

Answer key ☟

1.51.4 Shortest Path: GATE CSE 2020 | Question: 40

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

gatecse-2020 algorithms graph-algorithms 2-marks shortest-path

Answer key ☟

1.51.5 Shortest Path: GATE IT 2007 | Question: 3, UGCNET-June2012-III: 34

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 ________.

A. Greedy algorithm, Divide-conquer algorithm


B. Divide-conquer algorithm, Greedy algorithm
C. Greedy algorithm, Dynamic programming algorithm
D. Dynamic programming algorithm, Greedy algorithm

ugcnetcse-dec2014-paper3 algorithms shortest-path

Answer key ☟

1.51.7 Shortest Path: UGC NET CSE | Junet 2015 | Part 3 | Question: 31

An all-pairs shortest-paths problem is efficiently solved using:

A. Dijkstra's algorithm B. Bellman-Ford algorithm


C. Kruskal algorithm D. Floyd-Warshall algorithm
ugcnetcse-june2015-paper3 algorithms easy shortest-path

Answer key ☟

1.52 Sorting (36)

1.52.1 Sorting: GATE CSE 1988 | Question: 1iii

Quicksort is ________ efficient than heapsort in the worst case.


gate1988 algorithms sorting fill-in-the-blanks easy

Answer key ☟
1.52.2 Sorting: GATE CSE 1990 | Question: 3-v

The complexity of comparison based sorting algorithms is:

A. B.
C. D.
gate1990 normal algorithms sorting easy time-complexity multiple-selects

Answer key ☟

1.52.3 Sorting: GATE CSE 1991 | Question: 01,vii

The minimum number of comparisons required to sort elements is ______


gate1991 normal algorithms sorting numerical-answers

Answer key ☟

1.52.4 Sorting: GATE CSE 1991 | Question: 13

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 ☟

1.52.5 Sorting: GATE CSE 1992 | Question: 02,ix

Following algorithm(s) can be used to sort in the range in time

a. Heap sort b. Quick sort c. Merge sort d. Radix sort


gate1992 easy algorithms sorting multiple-selects

Answer key ☟

1.52.6 Sorting: GATE CSE 1995 | Question: 12

Consider the following sequence of numbers:

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 ☟

1.52.7 Sorting: GATE CSE 1996 | Question: 14

A two dimensional array of integers is partially sorted if

a. The smallest item in the array is at where and .


b. The smallest item is deleted. Complete the following procedure to insert item (which is guaranteed
to be smaller than any item in the last row or column) still keeping partially sorted.

procedure insert (x: integer);


var i,j: integer;
begin
i:=1; j:=1, A[i][j]:=x;
while (x > __ or x > __) do
if A[i+1][j] < A[i][j] ___ then begin
A[i][j]:=A[i+1][j]; i:=i+1;
end
else begin
_____
end
A[i][j]:= ____
end

gate1996 algorithms sorting normal descriptive

Answer key ☟

1.52.8 Sorting: GATE CSE 1998 | Question: 1.22

Give the correct matching for the following pairs:

A. B.
C. D.
gate1998 algorithms sorting easy match-the-following

Answer key ☟

1.52.9 Sorting: GATE CSE 1999 | Question: 1.12

A sorting technique is called stable if

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

gate1999 algorithms sorting easy

Answer key ☟

1.52.10 Sorting: GATE CSE 1999 | Question: 8

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.

gate1999 algorithms sorting normal descriptive

Answer key ☟

1.52.11 Sorting: GATE CSE 2000 | Question: 17

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 ☟

1.52.12 Sorting: GATE CSE 2003 | Question: 61

In a permutation , of n distinct integers, an inversion is a pair such that and


.
If all permutations are equally likely, what is the expected number of inversions in a randomly chosen
permutation of ?

A. B. C. D.
gatecse-2003 algorithms sorting inversion normal

Answer key ☟

1.52.13 Sorting: GATE CSE 2004 | Question: 29

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 ☟

1.52.14 Sorting: GATE CSE 2005 | Question: 39

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 ☟

1.52.15 Sorting: GATE CSE 2006 | Question: 14, ISRO2011-14

Which one of the following in place sorting algorithms needs the minimum number of swaps?

A. Quick sort B. Insertion sort C. Selection sort D. Heap sort


gatecse-2006 algorithms sorting easy isro2011

Answer key ☟

1.52.16 Sorting: GATE CSE 2007 | Question: 14

Which of the following sorting algorithms has the lowest worse-case complexity?

A. Merge sort B. Bubble sort C. Quick sort D. Selection sort

gatecse-2007 algorithms sorting time-complexity easy

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 ☟

1.52.18 Sorting: GATE CSE 2013 | Question: 30

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 ☟

1.52.19 Sorting: GATE CSE 2013 | Question: 6

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 ☟

1.52.20 Sorting: GATE CSE 2014 Set 1 | Question: 39

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 ☟

1.52.21 Sorting: GATE CSE 2016 Set 1 | Question: 13

The worst case running times of Insertion sort , Merge sort and Quick sort, respectively are:

A. , and
B. , and
C. , and
D. , and

gatecse-2016-set1 algorithms sorting easy

Answer key ☟

1.52.22 Sorting: GATE CSE 2016 Set 2 | Question: 13

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?

I. Quicksort runs in time


II. Bubblesort runs in time
III. Mergesort runs in time
IV. Insertion sort runs in time

A. I and II only B. I and III only C. II and IV only D. I and IV only


gatecse-2016-set2 algorithms sorting time-complexity normal ambiguous

Answer key ☟

1.52.23 Sorting: GATE CSE 2021 Set 1 | Question: 9

Consider the following array.

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?

A. Selection sort B. Mergesort


C. Insertion sort D. Quicksort using the last element as
pivot
gatecse-2021-set1 algorithms sorting 1-mark

Answer key ☟

1.52.24 Sorting: GATE CSE 2024 | Set 1 | Question: 31

An array is heapified. Which one of the following options


represents the first three elements in the heapified array?

A. B. C. D.
gatecse2024-set1 algorithms heap-sort sorting

Answer key ☟

1.52.25 Sorting: GATE CSE 2024 | Set 2 | Question: 25

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 ☟

1.52.26 Sorting: GATE DS&AI 2024 | Question: 35

Consider the following sorting algorithms:

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?

A. only B. only C. and only D. and only


gate-ds-ai-2024 algorithms sorting

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.

Which of the following is TRUE?

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 ☟

1.52.28 Sorting: GATE IT 2008 | Question: 43

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

Consider the following SQL query:


select studentid,name,age from STUDENT order by age,name;

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 ☟

1.52.32 Sorting: GATE Suitability Test | Test 1 | Question: 1

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

1.52.33 Sorting: UGC NET CSE | December 2013 | Part 3 | Question: 38

Assuming there are n keys and each key is in the range [0, m-1]. The run time of bucket sort is

A. O(n) B. O(n lgn) C. O(n lgm) D. O(n+m)


ugcnetcse-dec2013-paper3 algorithms sorting

Answer key ☟

1.52.34 Sorting: UGC NET CSE | December 2014 | Part 2 | Question: 22

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 ?

A. Bubble sort B. Selection sort


C. Quick sort D. Insertion sort
ugcnetcse-dec2014-paper2 algorithms data-structures sorting

Answer key ☟

1.52.35 Sorting: UGC NET CSE | December 2015 | Part 3 | Question: 18

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 ☟

1.52.36 Sorting: UGC NET CSE | June 2019 | Part 2 | Question: 64

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 ☟

1.53 Space Complexity (3)

1.53.1 Space Complexity: GATE CSE 2005 | Question: 81a

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;
}
}

The space complexity of the above code is?

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

An ideal sort is an in-place-sort whose additional space requirement is

A. O (log n) B. O (nlog n) C. O (1) D. O (n)


ugcnetcse-dec2015-paper2 algorithms sorting space-complexity

Answer key ☟

1.53.3 Space Complexity: UGC NET CSE | October 2020 | Part 2 | Question: 73

Match with

Choose the correct answer from the options given below:

A. B.
C. D.
ugcnetcse-oct2020-paper2 space-complexity algorithms

Answer key ☟

1.54 Strongly Connected Components (3)

1.54.1 Strongly Connected Components: GATE CSE 2008 | Question: 7

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 ☟

1.54.2 Strongly Connected Components: GATE CSE 2018 | Question: 43

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 ☟

1.54.3 Strongly Connected Components: GATE IT 2006 | Question: 46

Which of the following is the correct decomposition of the directed graph given below into its strongly
connected components?

A.
B.
C.
D.

gateit-2006 algorithms graph-algorithms normal strongly-connected-components

Answer key ☟

1.55 Time Complexity (44)

1.55.1 Time Complexity: GATE CSE 1988 | Question: 6i

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.

gate1988 normal descriptive algorithms time-complexity

Answer key ☟

1.55.2 Time Complexity: GATE CSE 1989 | Question: 2-iii

Match the pairs in the following:

gate1989 match-the-following algorithms time-complexity

Answer key ☟

1.55.3 Time Complexity: GATE CSE 1993 | Question: 8.7

, where stands for order is:

A. B. C. D.

E.
gate1993 algorithms time-complexity easy

Answer key ☟

1.55.4 Time Complexity: GATE CSE 1999 | Question: 1.13

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

A. B. C. D. None of the above


gate1999 algorithms time-complexity normal

Answer key ☟
1.55.5 Time Complexity: GATE CSE 1999 | Question: 1.16

If is a power of , then the minimum number of multiplications needed to compute is

A. B. C. D.
gate1999 algorithms time-complexity normal

Answer key ☟

1.55.6 Time Complexity: GATE CSE 1999 | Question: 11a

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.

gate1999 algorithms time-complexity normal descriptive

Answer key ☟

1.55.7 Time Complexity: GATE CSE 2000 | Question: 1.15

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 ☟

1.55.8 Time Complexity: GATE CSE 2003 | Question: 66

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

gatecse-2003 algorithms time-complexity normal

Answer key ☟

1.55.9 Time Complexity: GATE CSE 2004 | Question: 39

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

A. best if is in row-major, and is in column-major order


B. best if both are in row-major order
C. best if both are in column-major order
D. independent of the storage scheme

gatecse-2004 algorithms time-complexity easy

Answer key ☟

1.55.10 Time Complexity: GATE CSE 2004 | Question: 82

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;}
}

The complexity of this program fragment is

A. B.
C. D.
gatecse-2004 algorithms time-complexity normal

Answer key ☟

1.55.11 Time Complexity: GATE CSE 2006 | Question: 15

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 ☟

1.55.12 Time Complexity: GATE CSE 2007 | Question: 15, ISRO2016-26

Consider the following segment of C-code:


int j, n;
j = 1;
while (j <= n)
j = j * 2;

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 ☟

1.55.13 Time Complexity: GATE CSE 2007 | Question: 45

What is the of the following recursive function?


int DoSomething (int n) {
if (n <= 2)
return 1;
else
return (DoSomething (floor (sqrt(n))) + n);
}

A. B.
C. D.
gatecse-2007 algorithms time-complexity normal

Answer key ☟

1.55.14 Time Complexity: GATE CSE 2007 | Question: 50

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?

A. At least comparisons, for some constant are needed.


B. At most comparisons are needed.
C. At least comparisons are needed
D. None of the above

gatecse-2007 algorithms time-complexity easy

Answer key ☟

1.55.15 Time Complexity: GATE CSE 2007 | Question: 51

Consider the following C program segment:


int IsPrime (n)
{
int i, n;
for (i=2; i<=sqrt(n);i++)
if(n%i == 0)
{printf("Not Prime \n"); return 0;}
return 1;
}

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 ☟

1.55.16 Time Complexity: GATE CSE 2008 | Question: 40

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.

gatecse-2008 algorithms time-complexity normal

Answer key ☟

1.55.18 Time Complexity: GATE CSE 2008 | Question: 74

Consider the following C functions:


int f1 (int n)
{
if(n == 0 || n == 1)
return n;
else
return (2 * f1(n-1) + 3 * f1(n-2));
}
int f2(int n)
{
int i;
int X[N], Y[N], Z[N];
X[0] = Y[0] = Z[0] = 0;
X[1] = 1; Y[1] = 2; Z[1] = 3;
for(i = 2; i <= n; i++){
X[i] = Y[i-1] + Z[i-2];
Y[i] = 2 * X[i];
Z[i] = 3 * X[i];
}
return X[n];
}

The running time of and are

A. and B. and
C. and D. and
gatecse-2008 algorithms time-complexity normal

Answer key ☟

1.55.19 Time Complexity: GATE CSE 2008 | Question: 75

Consider the following C functions:


int f1 (int n)
{
if(n == 0 || n == 1)
return n;
else
return (2 * f1(n-1) + 3 * f1(n-2));
}
int f2(int n)
{
int i;
int X[N], Y[N], Z[N];
X[0] = Y[0] = Z[0] = 0;
X[1] = 1; Y[1] = 2; Z[1] = 3;
for(i = 2; i <= n; i++){
X[i] = Y[i-1] + Z[i-2];
Y[i] = 2 * X[i];
Z[i] = 3 * X[i];
}
return X[n];
}

and return the values


A. and B. and C. and D. and
gatecse-2008 normal algorithms time-complexity

Answer key ☟

1.55.20 Time Complexity: GATE CSE 2010 | Question: 12

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 ☟

1.55.21 Time Complexity: GATE CSE 2014 Set 1 | Question: 42

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

A. Half of the product of the consecutive integers.


B. One-third of the product of the consecutive integers.
C. One-sixth of the product of the consecutive integers.
D. None of the above.

gatecse-2014-set1 algorithms time-complexity normal

Answer key ☟

1.55.22 Time Complexity: GATE CSE 2015 Set 1 | Question: 40

An algorithm performs find operations , insert operations, delete operations, and


decrease-key operations on a set of data items with keys drawn from a linearly ordered set .
For a delete operation, a pointer is provided to the record that must be deleted . For the decrease-key operation,
a pointer is provided to the record that has its key decreased. Which one of the following data structures is the
most suited for the algorithm to use, if the goal is to achieve the best total asymptotic complexity considering all
the operations?

A. Unsorted array B. Min - heap


C. Sorted array D. Sorted doubly linked list
gatecse-2015-set1 algorithms data-structures normal time-complexity

Answer key ☟

1.55.23 Time Complexity: GATE CSE 2015 Set 2 | Question: 22

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

Match the algorithms with their time complexities:

A.
B.
C.
D.

gatecse-2017-set2 algorithms time-complexity match-the-following easy

Answer key ☟

1.55.25 Time Complexity: GATE CSE 2017 Set 2 | Question: 38

Consider the following C function


int fun(int n) {
int i, j;
for(i=1; i<=n; i++) {
for (j=1; j<n; j+=i) {
printf("%d %d", i, j);
}
}
}

Time complexity of in terms of notation is

A. B.
C. D.
gatecse-2017-set2 algorithms time-complexity

Answer key ☟

1.55.26 Time Complexity: GATE CSE 2019 | Question: 37

There are unsorted arrays: . Assume that is odd.Each of contains


distinct elements. There are no common elements between any two arrays. The worst-case time
complexity of computing the median of the medians of is

A. B.
C. D.
gatecse-2019 algorithms time-complexity 2-marks

Answer key ☟

1.55.27 Time Complexity: GATE CSE 2024 | Set 1 | Question: 7

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

A. both and B. but


C. but not D. neither nor
gatecse2024-set1 algorithms time-complexity

Answer key ☟

1.55.28 Time Complexity: GATE IT 2007 | Question: 17

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.

gateit-2007 algorithms time-complexity normal

Answer key ☟

1.55.29 Time Complexity: GATE IT 2007 | Question: 81

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

Consider the following C function.


int func(int n)
{
int i, j, k, p, q=1;
for(i=1 ; i<= n;i=i+1)
{
p=0;
for(k=1 ; k <= n ; k=k+2)
p++;
for(j=n ; j>= 1 ; j=j/2)
q=q*2;
}
return q;
}

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

The time complexity of the following C snippet is:


int gate_2020(int n)
{
for(int i=1; i <= n; i++)
{
for(int j=i ; j<=i*i ; j++)
if(j%i==0)
{
for(int k=0; k < j; k++)
printf("gate2020");
}
}
}

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 ☟

1.55.34 Time Complexity: GATE Suitability Test | Test 1 | Question: 6

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

The time complexity to build a heap of n elements is

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

Match the following

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

Which of the following is asymptotically smaller?

A. lg(lg*n) B. lg*(lgn) C. lg(n!) D. lg*(n!)


algorithms ugcnetcse-june2015-paper3 time-complexity

Answer key ☟
1.55.40 Time Complexity: UGC NET CSE | October 2020 | Part 2 | Question: 25

If algorithm and another algorithm take and microseconds, respectively, to solve a


problem, then the largest size of a problem these algorithms can solve, respectively, in one second are
______ and ______.

A. and B. and C. and D. and


ugcnetcse-oct2020-paper2 algorithms time-complexity

Answer key ☟

1.55.41 Time Complexity: UGC NET CSE | October 2020 | Part 2 | Question: 52

The running time of an algorithm is if and only if

a. its worst-case running time is and its best-case running time is


b. its worst-case running time is and its best-case running time is
c.
d. is non-empty set,

ugcnetcse-oct2020-paper2 algorithms time-complexity

Answer key ☟

1.55.42 Time Complexity: UGC NET CSE | October 2022 | Part 1 | Question: 87

Consider the following algorithms and their running times :


Algorithms Complexities
(A) Breadth First Search (I)
(B) Rabin-Karp
(II)
Algorithm
( I I I )
(C) Depth-First Search
(D) Heap sort (worst
(IV)
case)
(E) Quick sort (worst
(V)
case)

Which one of the following is correct?

A.
B.
C.
D.

ugcnetcse-oct2022-paper1 algorithms time-complexity match-the-following

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)

A. Search B. Search and Insert


C. Search and Delete D. Search, Insert and Delete
ugcnetsep2013ii algorithms time-complexity

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

A. B. C. D. None of the above


algorithms time-complexity ugcnetcse-sep2013-paper3

Answer key ☟

1.56 Topological Sort (6)

1.56.1 Topological Sort: GATE CSE 2007 | Question: 5

Consider the DAG with shown below.

Which of the following is not a topological ordering?

A. B. C. D.
gatecse-2007 algorithms graph-algorithms topological-sort easy

Answer key ☟

1.56.2 Topological Sort: GATE CSE 2014 Set 1 | Question: 13

Consider the directed graph below given.

Which one of the following is TRUE?

A. The graph does not have any topological ordering.


B. Both PQRS and SRQP are topological orderings.
C. Both PSRQ and SPRQ are topological orderings.
D. PSRQ is the only topological ordering.

gatecse-2014-set1 graph-algorithms easy topological-sort

Answer key ☟
1.56.3 Topological Sort: GATE CSE 2016 Set 1 | Question: 11

Consider the following directed graph:

The number of different topological orderings of the vertices of the graph is _____________.

gatecse-2016-set1 algorithms graph-algorithms normal numerical-answers topological-sort

Answer key ☟

1.56.4 Topological Sort: GATE DS&AI 2024 | Question: 41

​Consider the directed acyclic graph (DAG) below:

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

The number of topological-orderings (sortings) of the graph given is ________

go2025-mockgate-3 numerical-answers algorithms topological-sort

Answer key ☟
1.56.6 Topological Sort: UGC NET CSE | December 2005 | Part 2 | Question: 23

Consider the graph, which of the following is a valid topological sorting?

A. B. C. D.
ugcnetcse-dec2005-paper2 algorithms topological-sort

Answer key ☟

1.57 Tree (2)

1.57.1 Tree: UGC NET CSE | December 2015 | Part 2 | Question: 37

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 ☟

1.57.2 Tree: UGC NET CSE | January 2017 | Part 3 | Question: 32

Any decision tree that sorts n elements has height ____

A. B.
C. D.
ugcnetcse-jan2017-paper3 algorithms tree

Answer key ☟

1.58 Tree Search Algorithm (2)

1.58.1 Tree Search Algorithm: UGC NET CSE | Junet 2015 | Part 3 | Question: 58

Which of the following statements is true for Branch-and-Bound search?

A. Underestimates of remaining distance may cause deviation from optimal path


B. Overestimates can't cause right path to be overlooked
C. Dynamic programming principle can be used to discard redundant partial paths
D. All of the above

ugcnetcse-june2015-paper3 algorithms branch-and-bound tree-search-algorithm graph-search

Answer key ☟
1.58.2 Tree Search Algorithm: UGC NET CSE | September 2013 | Part 3 | Question: 2

cutoffs are applied to

A. Depth first search B. Best first search


C. Minimax search D. Breadth first search
ugcnetcse-sep2013-paper3 algorithms graph-search tree-search-algorithm

Answer key ☟

1.59 Tree Traversal (1)

1.59.1 Tree Traversal: UGC NET CSE | Junet 2015 | Part 2 | Question: 4

Consider the following statements:

i. Depth-first search is used to traverse a rooted tree


ii. Pre-order, Post-order and Inorder are used to list the vertices of an ordered rooted tree.
iii. Huffman's algorithm is used to find an optimal binary tree with given weights
iv. Topological sorting provides a labelling such that the parents have larger labels than their children

Which one of the above statements is true?

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

1.18.8 C 1.19.1 C 1.20.1 B 1.20.2 C 1.20.3 C


1.20.4 B 1.20.5 B 1.20.6 A 1.20.7 34 1.20.8 150
1.20.9 C 1.20.10 C 1.20.11 B 1.21.1 17 1.21.2 -1
1.21.3 B 1.21.4 C 1.21.5 A 1.21.6 B 1.22.1 N/A
1.22.2 B 1.22.3 D 1.22.4 A 1.22.5 A 1.22.6 B
929 :
1.22.7 A 1.22.8 A;B 1.22.9 1.22.10 A 1.22.11 C
929
1.22.12 D 1.22.13 A 1.22.14 B 1.23.1 N/A 1.23.2 C
1.23.3 C 1.23.4 C 1.23.5 D 1.23.6 D 1.23.7 C
1.23.8 C 1.23.9 B 1.23.10 19 1.23.11 D 1.23.12 31
1.23.13 D 1.23.14 A 1.23.15 5040 1.23.16 C 1.23.17 60
1.23.18 A 1.23.19 D 1.23.20 D 1.23.21 D 1.23.22 B
1.23.23 B 1.24.1 A 1.24.2 B 1.24.3 D 1.24.4 A
1.24.5 16 1.25.1 C 1.26.1 B 1.26.2 N/A 1.26.3 13
1.26.4 C 1.26.5 B 1.26.6 C 1.26.7 D 1.26.8 0.144:0.145
1.26.9 0.15:0.16 1.26.10 540 1.27.1 2.33 1.27.2 A 1.27.3 D
1.27.4 225 1.27.5 B 1.27.6 A 1.27.7 C 1.27.8 B
1.28.1 N/A 1.28.2 N/A 1.28.3 C 1.28.4 A 1.28.5 N/A
1.28.6 C 1.28.7 C 1.28.8 N/A 1.28.9 C 1.28.10 D
1.28.11 A 1.28.12 B 1.28.13 D 1.28.14 C 1.28.15 C
1.28.16 D 1.28.17 D 1.28.18 D 1.28.19 B 1.28.20 C
1.28.21 B 1.28.22 D 1.28.23 B 1.28.24 A 1.28.25 9
1.28.26 A 1.28.27 D 1.28.28 51 1.28.29 0 1.28.30 D
1023 :
1.28.31 81 1.28.32 1.28.33 15 : 15 1.28.34 D 1.28.35 C
1023
1.28.36 C 1.28.37 D 1.28.38 C 1.28.39 D 1.28.40 11
1.29.1 D 1.30.1 A 1.30.2 D 1.30.3 C 1.31.1 B
1.31.2 C 1.32.1 A 1.33.1 B 1.34.1 C 1.34.2 1500
1.34.3 C 1.34.4 Q-Q 1.34.5 B 1.34.6 D 1.34.7 C
1.35.1 B 1.35.2 B 1.35.3 B 1.35.4 D 1.35.5 B
1.36.1 C 1.36.2 358 1.37.1 B;D;E 1.37.2 N/A 1.37.3 2
1.37.4 N/A 1.37.5 N/A 1.37.6 C 1.37.7 N/A 1.37.8 B
1.37.9 C 1.37.10 B 1.37.11 D 1.37.12 D 1.37.13 D
1.37.14 D 1.37.15 B 1.37.16 B 1.37.17 C 1.37.18 X
1.37.19 6 1.37.20 69 1.37.21 995 1.37.22 A 1.37.23 7
1.37.24 B 1.37.25 4 1.37.26 D 1.37.27 99 1.37.28 3:3
1.37.29 C 1.37.30 A;B;C 1.37.31 24 1.37.32 9 1.37.33 A
1.37.34 A;B;C;D 1.37.35 172 1.37.36 A;C 1.37.37 8 1.37.38 A;B;C;D
1.37.39 C 1.37.40 Q-Q 1.38.1 A 1.39.1 0.6 1.40.1 C
1.41.1 A 1.42.1 N/A 1.43.1 C 1.43.2 C 1.43.3 C
1.43.4 B 1.43.5 B 1.43.6 B 1.43.7 D 1.43.8 D
1.43.9 C 1.43.10 C 1.44.1 D 1.44.2 C 1.44.3 A;C
1.45.1 B 1.46.1 C 1.46.2 N/A 1.46.3 N/A 1.46.4 C
1.46.5 C 1.46.6 B 1.46.7 B 1.46.8 B 1.46.9 C
1.46.10 A 1.46.11 B 1.46.12 A 1.46.13 0.08 1.46.14 0
1.46.15 A 1.46.16 C 1.47.1 N/A 1.47.2 N/A 1.47.3 N/A
1.47.4 N/A 1.47.5 N/A 1.47.6 N/A 1.47.7 N/A 1.47.8 B
1.47.9 A 1.47.10 N/A 1.47.11 B 1.47.12 N/A 1.47.13 B
1.47.14 C 1.47.15 B 1.47.16 D 1.47.17 A 1.47.18 B
1.47.19 D 1.47.20 X 1.47.21 A 1.47.22 D 1.47.23 A
2.32 :
1.47.24 A 1.47.25 B 1.47.26 1.47.27 B 1.47.28 A
2.33
1.47.29 C 1.47.30 C 1.47.31 A 1.47.32 B 1.47.33 C
1.47.34 A 1.47.35 C 1.47.36 C 1.47.37 D 1.47.38 Q-Q
1.47.39 D 1.47.40 C 1.47.41 C 1.48.1 C 1.48.2 A
1.48.3 10230 1.48.4 60 : 60 1.48.5 143 1.48.6 Q-Q 1.48.7 B
1.49.1 B 1.50.1 N/A 1.50.2 C 1.50.3 A 1.50.4 C
1.50.5 A 1.50.6 5 1.50.7 B 1.51.1 N/A 1.51.2 B
1.51.3 D 1.51.4 A 1.51.5 C 1.51.6 C 1.51.7 D
1.52.1 N/A 1.52.2 A 1.52.3 7 1.52.4 N/A 1.52.5 D
1.52.6 N/A 1.52.7 N/A 1.52.8 B 1.52.9 B 1.52.10 N/A
1.52.11 N/A 1.52.12 B 1.52.13 C 1.52.14 A 1.52.15 C
147.1 :
1.52.16 A 1.52.17 A 1.52.18 C 1.52.19 B 1.52.20
148.1
1.52.21 D 1.52.22 D 1.52.23 C 1.52.24 D 1.52.25 3
1.52.26 B 1.52.27 C 1.52.28 C 1.52.29 128 1.52.30 D
1.52.31 C;D 1.52.32 D 1.52.33 D 1.52.34 D 1.52.35 D
1.52.36 B 1.53.1 B 1.53.2 C 1.53.3 A 1.54.1 C
1.54.2 109 1.54.3 B 1.55.1 N/A 1.55.2 N/A 1.55.3 B;C;D;E
1.55.4 D 1.55.5 A 1.55.6 N/A 1.55.7 A 1.55.8 C
1.55.9 D 1.55.10 C 1.55.11 C 1.55.12 D 1.55.13 D
1.55.14 B 1.55.15 B 1.55.16 B 1.55.17 B 1.55.18 B
1.55.19 C 1.55.20 C 1.55.21 C 1.55.22 A 1.55.23 D
1.55.24 C 1.55.25 C 1.55.26 C 1.55.27 A 1.55.28 A
1.55.29 B 1.55.30 B 1.55.31 C 1.55.32 C 1.55.33 D
1.55.34 A 1.55.35 Q-Q 1.55.36 Q-Q 1.55.37 A 1.55.38 C
1.55.39 A 1.55.40 B 1.55.41 X 1.55.42 N/A 1.55.43 D
1.55.44 B 1.56.1 D 1.56.2 C 1.56.3 6 1.56.4 B;D
1.56.5 24 1.56.6 Q-Q 1.57.1 D 1.57.2 C 1.58.1 C
1.58.2 C 1.59.1 D
2 Artificial Intelligence (45)

2.0.1 UGC NET CSE | July 2016 | Part 3 | Question: 75

A software program that infers and manipulates existing knowledge in order to generate new knowledge
is known as:

A. Data dictionary B. Reference mechanism


C. Inference engine D. Control strategy
ugcnetcse-july2016-paper3

Answer key ☟

2.0.2 UGC NET CSE | July 2016 | Part 3 | Question: 66

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 ☟

2.1 Artificial Intelligence (18)

2.1.1 Artificial Intelligence: GATE DS&AI 2024 | Question: 13

​Let and be two admissible heuristics used in search.


Which ONE of the following expressions is always an admissible heuristic?

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

A. backward planning B. goal stack planning


C. operator subgoaling D. operator overloading
ugcnetcse-dec2013-paper3 artificial-intelligence

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

ugcnetcse-dec2014-paper3 artificial-intelligence machine-learning

Answer key ☟

2.1.4 Artificial Intelligence: UGC NET CSE | December 2015 | Part 3 | Question: 46

Language model used in LISP is

A. Functional programming B. Logic programming


C. Object oriented programming D. All of the above
ugcnetcse-dec2015-paper3 artificial-intelligence

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)

A. Only is correct. B. Only is correct.


C. Both and are correct. D. Neither nor is correct.
ugcnetcse-jan2017-paper3 non-gatecse artificial-intelligence

Answer key ☟

2.1.7 Artificial Intelligence: UGC NET CSE | July 2018 | Part 2 | Question: 71

In artificial Intelligence (AI), an environment is uncertain if it is ___

A. Not fully observable and not deterministic


B. Not fully observable or not deterministic
C. Fully observable but not deterministic
D. Not fully observable but deterministic
ugcnetcse-july2018-paper2 artificial-intelligence

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 ___

A. current percept, completely ignoring rest of the percept history


B. rest of the percept history, completely ignoring the current percept
C. both current percept and complete percept history
D. both current percept and just previous percept

ugcnetcse-july2018-paper2 artificial-intelligence

Answer key ☟

2.1.9 Artificial Intelligence: UGC NET CSE | July 2018 | Part 2 | Question: 73

In heuristic search algorithms in Artificial Intelligence (AI), if a collection of admissible heuristics


is available for a problem and none of them dominates any of the others, which should we
choose?

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).

a. expands all nodes with


b. expands no nodes with
c. Pruning is integral to

Here, is the cost of the optimal solution path. Which of the following is correct with respect to the above
statements?

A. Both statements a and statement b are true


B. Both statements a and statement c are true
C. Both statements b and statement c are true
D. All the statements a, b and c are true

ugcnetcse-july2018-paper2 artificial-intelligence

Answer key ☟

2.1.11 Artificial Intelligence: UGC NET CSE | June 2012 | Part 3 | Question: 2

In Delta Rule for error minimization

A. weights are adjusted w.r.to change in the output


B. weights are adjusted w.r.to difference between desired output and actual output
C. weights are adjusted w.r.to difference between output and output
D. none of the above

ugcnetcse-june2012-paper3 artificial-intelligence machine-learning


Answer key ☟

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

Match the following

A. B.
C. D.
ugcnetjune2014iii artificial-intelligence

Answer key ☟

2.1.14 Artificial Intelligence: UGC NET CSE | June 2014 | Part 3 | Question: 30

Slots and facets are used in

A. Semantic Networks B. Frames C. Rules D. All of these


ugcnetjune2014iii artificial-intelligence

Answer key ☟

2.1.15 Artificial Intelligence: UGC NET CSE | Junet 2015 | Part 3 | Question: 23

Which of the following is false for the programming language PROLOG?

A. A PROLOG variable can only be assigned to a value once


B. PROLOG is a strongly typed language
C. The scope of a variable in PROLOG is a single clause or rule
D. The scope of a variable in PROLOG is a single query

ugcnetcse-june2015-paper3 artificial-intelligence

Answer key ☟

2.1.16 Artificial Intelligence: UGC NET CSE | Junet 2015 | Part 3 | Question: 56

Match the following knowledge representation techniques with their applications


A. B.
C. D.
ugcnetcse-june2015-paper3 artificial-intelligence

Answer key ☟

2.1.17 Artificial Intelligence: UGC NET CSE | Junet 2015 | Part 3 | Question: 59

Match the following with respect to heuristic search techniques

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

Which of the following is NOT true in problem solving in artificial intelligence?

A. Implements heuristic search technique B. Solution steps are not explicit


C. Knowledge is imprecise D. It works on or implements repetition
mechanism
ugcnetcse-oct2020-paper2 non-gatecse artificial-intelligence

Answer key ☟

2.2 Artificial Neural Network (1)

2.2.1 Artificial Neural Network: UGC NET CSE | December 2013 | Part 3 | Question: 30

An artificial neuron receives n inputs with weights attached to the input


links. The weighted sum ____ is computed to be passed on to a non-linear filter called activation
function to release the output.
A. B.
C. D.
ugcnetcse-dec2013-paper3 machine-learning artificial-neural-network

Answer key ☟

2.3 Back Propagation (1)

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.

A. Forward from source to sink B. Backward from sink to source


C. Forward from source to hidden nodes D. Backward from sink to hidden nodes
ugcnetcse-dec2012-paper2 machine-learning data-mining back-propagation

Answer key ☟

2.4 Blocks World Problem (1)

2.4.1 Blocks World Problem: UGC NET CSE | September 2013 | Part 3 | Question: 5

The Blocks World Problem in Artificial Intelligence is normally discussed to explain a

A. Search technique B. Planning system


C. Constraint satisfaction system D. Knowledge base system
ugcnetcse-sep2013-paper3 artificial-intelligence blocks-world-problem

Answer key ☟

2.5 Chaining (1)

2.5.1 Chaining: UGC NET CSE | December 2015 | Part 3 | Question: 8

Forward chaining systems are ____ where as backward chaining systems are ____

A. Data driven, Data driven B. Goal driven, Data driven


C. Data driven, Goal driven D. Goal driven, Goal driven
ugcnetcse-dec2015-paper3 artificial-intelligence chaining

Answer key ☟

2.6 Expert System (2)

2.6.1 Expert System: UGC NET CSE | December 2012 | Part 3 | Question: 67

An expert system shell is an expert system without

A. domain knowledge B. explanation facility


C. reasoning with knowledge D. all of the above
ugcnetcse-dec2012-paper3 artificial-intelligence expert-system

Answer key ☟

2.6.2 Expert System: UGC NET CSE | December 2015 | Part 3 | Question: 45

Reasoning strategies used in expert systems include

A. Forward chaining, backward chaining and problem reduction


B. Forward chaining, backward chaining and boundary mutation
C. Forward chaining, backward chaining and back propagation
D. Forward chaining, problem reduction and boundary mutation
ugcnetcse-dec2015-paper3 artificial-intelligence expert-system

Answer key ☟

2.7 Fuzzy Logic (1)

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 Genetic Algorithms (1)

2.8.1 Genetic Algorithms: UGC NET CSE | June 2019 | Part 2 | Question: 97

Consider the following:

i. Evolution
ii. Selection
iii. Reproduction
iv. Mutation

Which of the following are found in genetic algorithms?

A. b, c and d only B. b and d only C. a, b, c and d D. a, b and d only


ugcnetcse-june2019-paper2 artificial-intelligence genetic-algorithms

Answer key ☟

2.9 Heuristic Search (1)

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 Linear Programming (1)

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

A. Alternative solution B. Infeasible solution


C. Unbounded solution D. Degenerate solution
ugcnetcse-sep2013-paper3 artificial-intelligence linear-programming

Answer key ☟
2.11 Machine Learning (2)

2.11.1 Machine Learning: UGC NET CSE | December 2012 | Part 3 | Question: 73

Match the following:


1. The decision system receives
a. Supervised
rewards for its action at the end
learning
of a sequence of steps
b.
2. Manual labels of inputs are not
Unsupervised
used
learning
c. Re-
3. Manual labels of inputs are
inforcement
used
learning
d. Inductive
4. System learns by example
learning
a b c d
A 1 2 3 4
B 2 3 1 4
C 3 2 4 1
D 3 2 1 4

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

A. Error correction learning - learning with a teacher


B. Reinforcement learning - learning with a critic
C. Hebbian learning
D. Competitive learning - learning without a teacher

ugcnetjune2014iii machine-learning

Answer key ☟

2.12 Map Coloring (1)

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?

A. Means-end analysis B. Constraint satisfaction


C. AO* search D. Breadth first search
ugcnetcse-june2013-paper3 artificial-intelligence map-coloring

Answer key ☟

2.13 Means End (1)

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

ugcnetcse-sep2013-paper3 artificial-intelligence means-end analysis

Answer key ☟

2.14 Minimax Procedure (1)

2.14.1 Minimax Procedure: UGC NET CSE | June 2019 | Part 2 | Question: 91

Consider the game tree given below:

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 Neural Network (3)

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

ugcnetcse-dec2012-paper3 artificial-intelligence neural-network

Answer key ☟

2.15.2 Neural Network: UGC NET CSE | June 2019 | Part 2 | Question: 98

Which of the following is an example of unsupervised neural network?


A. Back-propagation network B. Hebb network
C. Associative memory network D. Self-organizing feature map
ugcnetcse-june2019-paper2 artificial-intelligence neural-network

Answer key ☟

2.15.3 Neural Network: UGC NET CSE | September 2013 | Part 3 | Question: 28

In a single perceptron, the updation rule of weight vector is given by

A. B.
C. D.
ugcnetcse-sep2013-paper3 neural-network machine-learning

Answer key ☟

2.16 Planning (1)

2.16.1 Planning: UGC NET CSE | July 2018 | Part 2 | Question: 78

Consider the following two sentences:

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

Which of the following is correct with respect to the above sentences?

A. Both sentence a and sentence b are false


B. Both sentence a and sentence b are true
C. Sentence a is true but sentence b is false
D. Sentence a is false but sentence b is true

ugcnetcse-july2018-paper2 planning

Answer key ☟

2.17 Prolog (2)

2.17.1 Prolog: UGC NET CSE | June 2013 | Part 3 | Question: 67

Which one of the following is the correct implementation of the meta-predicate “not” in PROLOG (Here
G represents a goal)?

A. not(G):- !, call(G), fail. not(G). B. not(G):- call(G), !, fail. not(G).


C. not(G):- call(G), fail, !, not(G). D. not(G):- call(G), !, fail.not(G):- !.
ugcnetcse-june2013-paper3 artificial-intelligence prolog

2.17.2 Prolog: UGC NET CSE | June 2014 | Part 3 | Question: 14

Which one of the following describes the syntax of prolog program?

I. Rules and facts are terminated by full stop(.)


II. Rules and facts are terminated by semi colon(;)
III. Variables names must start with upper case alphabets.
IV. Variables names must start with lower case alphabets.

A. I, II B. III, IV C. I, III D. II, IV


ugcnetjune2014iii artificial-intelligence prolog

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.

A. Markov decision processes, objects B. Hidden states, objects


C. Markov decision processes, states D. objects, states
ugcnetcse-june2019-paper2 artificial-intelligence reinforcement-learning

Answer key ☟

2.19 Searches (1)

2.19.1 Searches: UGC NET CSE | June 2019 | Part 2 | Question: 92

Math List-I with List-II:

Choose the correct option from those given below:

A. (a) – (i) ; (b) – (ii); (c) – (iii)


B. (a) – (iii) ; (b) – (ii); (c) – (i)
C. (a) – (i) ; (b) – (iii); (c) – (ii)
D. (a) – (ii) ; (b) – (iii); (c) – (i)

ugcnetcse-june2019-paper2 artificial-intelligence searches

Answer key ☟

2.20 Sigmoid Function (1)

2.20.1 Sigmoid Function: UGC NET CSE | June 2019 | Part 2 | Question: 99

The value of the derivative of Sigmoid function given by at is

A. B. C. D.
ugcnetcse-june2019-paper2 artificial-intelligence sigmoid-function

Answer key ☟

2.21 Strips (1)

2.21.1 Strips: UGC NET CSE | June 2019 | Part 2 | Question: 93

The STRIPS representation is

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)

3.0.1 UGC NET CSE | June 2013 | Part 2 | Question: 39

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 ☟

3.0.2 UGC NET CSE | June 2013 | Part 2 | Question: 40

The truth value of the statements:

, (where the notation denotes the proposition “There


exists a unique such that is true”) are:

A. True and False B. False and True C. False and False D. True and True
ugcnetcse-june2013-paper2

Answer key ☟

3.0.3 UGC NET CSE | September 2013 | Part 3 | Question: 67

The tracing model in Prolog describes program execution in terms of certain events. These events are

A. call and exit B. call and fail


C. call, exit and redo D. call, exit, redo and fail
ugcnetcse-sep2013-paper3

3.0.4 UGC NET CSE | December 2015 | Part 2 | Question: 6

Which of the following arguments are not valid?

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 ☟

3.0.5 UGC NET CSE | June 2014 | Part 3 | Question: 32

________ 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 ☟

3.0.6 UGC NET CSE | Junet 2015 | Part 2 | Question: 8

"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 ☟

3.0.7 UGC NET CSE | December 2014 | Part 3 | Question: 55

Equivalent logical expression for the Well Formed Formula ,

is

A. B.
C. D.
ugcnetcse-dec2014-paper3 mathematical-logic

Answer key ☟

3.0.8 UGC NET CSE | December 2014 | Part 3 | Question: 57

The resolvent of the set of clauses is

A. B.
C. D.
ugcnetcse-dec2014-paper3 mathematical-logic

Answer key ☟

3.0.9 UGC NET CSE | Junet 2015 | Part 3 | Question: 22

The casual form of the disjunctive normal form is:

A.
B.
C.
D.

ugcnetcse-june2015-paper3 mathematical-logic

Answer key ☟

3.0.10 UGC NET CSE | December 2015 | Part 2 | Question: 7

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

ugcnetcse-dec2015-paper2 discrete-mathematics mathematical-logic

Answer key ☟

3.0.11 UGC NET CSE | December 2015 | Part 2 | Question: 9

Consider the compund propositions given below as:

i.
ii.
iii.

Which of the above propositions are tautologies

A. i and iii B. ii and iii C. i and ii D. i, ii, and iii


ugcnetcse-dec2015-paper2 mathematical-logic

Answer key ☟

3.0.12 UGC NET CSE | June 2011 | Part 2 | Question: 3

The proposition is equivalent to

A. B.
C. D.
ugcnetcse-june2011-paper2 discrete-mathematics mathematical-logic

Answer key ☟

3.0.13 UGC NET CSE | November 2017 | Part 2 | Question: 8

Let and be two propositions is equivalent to

A. B.
C. D.
ugcnetcse-nov2017-paper2 discrete-mathematics mathematical-logic

Answer key ☟

3.0.14 UGC NET CSE | December 2018 | Part 2 | Question: 2

​Match List-I with List-II and choose the correct answer from the code given below :

A. (a)-(i), (b)-(ii), (c)-(iii), (d)-(iv) B. (a)-(ii), (b)-(i), (c)-(iii), (d)-(iv)


C. (a)-(iii), (b)-(iv), (c)-(ii), (d)-(i) D. (a)-(iv), (b)-(iii), (c)-(ii), (d)-(i)
ugcnetcse-dec2018-paper2 mathematical-logic
Answer key ☟

3.0.15 UGC NET CSE | December 2018 | Part 2 | Question: 1

​In mathematical logic, which of the following are statements?

i. There will be snow in January.


ii. What is the time now?
iii. Today is Sunday.
iv. You must study Discrete mathematics

Choose the correct answer from the code given below:

A. i and iii B. i and ii C. ii and iv D. iii and iv


ugcnetcse-dec2018-paper2 mathematical-logic

Answer key ☟

3.0.16 UGC NET CSE | January 2017 | Part 2 | Question: 2

Match the following :

Codes:

ugcnetjan2017ii mathematical-logic

Answer key ☟

3.0.17 UGC NET CSE | October 2020 | Part 2 | Question: 53

Consider the following statements:

i. Any tree is -colorable


ii. A graph has no cycles of even length if it is bipartite
iii. A graph is -colorable if is bipartite
iv. A graph can be colored with colors if is the maximum degree of any vertex in the graph
v. A graph can be colored with colors if it has edges.

Choose the correct answer from the options given below:

A. and are incorrect B. and are incorrect


C. and are incorrect D. and are incorrect
ugcnetcse-oct2020-paper2 discrete-mathematics graph-theory

Answer key ☟
3.1 Clausal Form (2)

3.1.1 Clausal Form: GATE CSE 1988 | Question: 14i

Consider the following well-formed formula:

Express the above well-formed formula in clausal form.

gate1988 descriptive first-order-logic clausal-form out-of-gatecse-syllabus

Answer key ☟

3.1.2 Clausal Form: GATE CSE 1988 | Question: 14ii

Consider the following well-formed formula:

Show using resolution principle that the well-formed formula, given above, cannot be satisfied for any
interpretation.

gate1988 descriptive first-order-logic clausal-form out-of-gatecse-syllabus

Answer key ☟

3.2 Combinatory (1)

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 Countable Uncountable Set (1)

3.3.1 Countable Uncountable Set: UGC NET CSE | December 2015 | Part 2 | Question: 3

Which of the following is/are not true ?

i. The set of negative integers is countable.


ii. The set of integers that are multiples of 7 is countable.
iii. The set of even integers is countable.
iv. The set of real numbers between 0 and 1⁄2 is countable.
A. i and iii B. ii and iv C. ii only D. iv only
ugcnetcse-dec2015-paper2 discrete-mathematics set-theory countable-uncountable-set

Answer key ☟

3.4 First Order Logic (41)

3.4.1 First Order Logic: GATE CSE 1989 | Question: 14a

Symbolize the expression "Every mother loves her children" in predicate logic.
gate1989 descriptive first-order-logic mathematical-logic

Answer key ☟

3.4.2 First Order Logic: GATE CSE 1991 | Question: 15,b

Consider the following first order formula:

Does it have finite models?

Is it satisfiable? If so, give a countable model for it.


gate1991 mathematical-logic first-order-logic descriptive

Answer key ☟

3.4.3 First Order Logic: GATE CSE 1992 | Question: 92,xv

Which of the following predicate calculus statements is/are valid?

A.
B.
C.
D.

gate1992 mathematical-logic normal first-order-logic

Answer key ☟

3.4.4 First Order Logic: GATE CSE 2003 | Question: 32

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.

gatecse-2003 mathematical-logic first-order-logic normal

Answer key ☟
3.4.5 First Order Logic: GATE CSE 2003 | Question: 33

Consider the following formula and its two interpretations and .

: Domain: the set of natural numbers

= ' is a prime number'

= ' divides '

: same as except that = ' is a composite number'.

Which of the following statements is true?

A. satisfies , does not


B. satisfies , does not
C. Neither nor satisfies
D. Both and satisfies

gatecse-2003 mathematical-logic difficult first-order-logic

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

Note: is true if is taller than .

A.
B.
C.
D.

gatecse-2004 mathematical-logic easy isro2007 first-order-logic

Answer key ☟

3.4.7 First Order Logic: GATE CSE 2005 | Question: 41

What is the first order predicate calculus statement equivalent to the following?

"Every teacher is liked by some student"

A.
B.
C.
D.

gatecse-2005 mathematical-logic easy first-order-logic

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?

Tigers and lions attack if they are hungry or threatened.

A.
B.
C.
D.

gatecse-2006 mathematical-logic normal first-order-logic

Answer key ☟

3.4.9 First Order Logic: GATE CSE 2007 | Question: 22

Let be a predicate which denotes that is a graph. Let be a predicate which


denotes that is connected. Which of the following first order logic sentences DOES NOT represent the
statement:

A. B.
C. D.
gatecse-2007 mathematical-logic easy first-order-logic

Answer key ☟

3.4.10 First Order Logic: GATE CSE 2008 | Question: 30

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?

Each finite state automaton has an equivalent pushdown automaton

A.
B.
C.
D.

gatecse-2008 easy mathematical-logic first-order-logic

Answer key ☟

3.4.11 First Order Logic: GATE CSE 2009 | Question: 23

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 ☟

3.4.12 First Order Logic: GATE CSE 2009 | Question: 26

Consider the following well-formed formulae:

I.
II.
III.
IV.

Which of the above are equivalent?

A. and B. and C. and D. and


gatecse-2009 mathematical-logic normal first-order-logic

Answer key ☟

3.4.13 First Order Logic: GATE CSE 2010 | Question: 30

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,

A. Everyone can fool some person at some time


B. No one can fool everyone all the time
C. Everyone cannot fool some person all the time
D. No one can fool some person at some time

gatecse-2010 mathematical-logic easy first-order-logic

Answer key ☟

3.4.14 First Order Logic: GATE CSE 2011 | Question: 30

Which one of the following options is CORRECT given three positive integers and , and a
predicate

A. being true means that is a prime number


B. being true means that is a number other than
C. is always true irrespective of the value of
D. being true means that has exactly two factors other than and

gatecse-2011 mathematical-logic normal first-order-logic

Answer key ☟

3.4.15 First Order Logic: GATE CSE 2012 | Question: 13

What is the correct translation of the following statement into mathematical logic?

“Some real numbers are rational”


A. B.
C. D.
gatecse-2012 mathematical-logic easy first-order-logic

Answer key ☟

3.4.16 First Order Logic: GATE CSE 2013 | Question: 27

What is the logical translation of the following statement?

"None of my friends are perfect."

A. B.
C. D.
gatecse-2013 mathematical-logic easy first-order-logic

Answer key ☟

3.4.17 First Order Logic: GATE CSE 2013 | Question: 47

Which one of the following is NOT logically equivalent to ?

A. B.
C. D.
mathematical-logic normal marks-to-all gatecse-2013 first-order-logic

Answer key ☟

3.4.18 First Order Logic: GATE CSE 2014 Set 1 | Question: 1

Consider the statement

"Not all that glitters is gold”

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.

gatecse-2014-set1 mathematical-logic first-order-logic

Answer key ☟

3.4.19 First Order Logic: GATE CSE 2014 Set 3 | Question: 53

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 ☟

3.4.20 First Order Logic: GATE CSE 2015 Set 2 | Question: 55

Which one of the following well-formed formulae is a tautology?

A.
B.
C.
D.

gatecse-2015-set2 mathematical-logic normal first-order-logic

Answer key ☟

3.4.21 First Order Logic: GATE CSE 2016 Set 2 | Question: 27

Which one of the following well-formed formulae in predicate calculus is NOT valid ?

A.
B.
C.
D.

gatecse-2016-set2 mathematical-logic first-order-logic normal

Answer key ☟

3.4.22 First Order Logic: GATE CSE 2017 Set 1 | Question: 02

Consider the first-order logic sentence . Assuming non-empty logical domains, which
of the sentences below are implied by ?

I.
II.
III.
IV.

A. IV only B. I and IV only C. II only D. II and III only


gatecse-2017-set1 mathematical-logic first-order-logic

Answer key ☟

3.4.23 First Order Logic: GATE CSE 2018 | Question: 28

Consider the first-order logic sentence

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

gatecse-2018 mathematical-logic normal first-order-logic 2-marks

Answer key ☟

3.4.24 First Order Logic: GATE CSE 2019 | Question: 35

Consider the first order predicate formula :


Here denotes that , where and are integers. Consider the following sets:

Set of all positive integers


Set of all integers

Which of the above sets satisfy ?

A. and B. and C. and D. and


gatecse-2019 engineering-mathematics discrete-mathematics mathematical-logic first-order-logic 2-marks

Answer key ☟

3.4.25 First Order Logic: GATE CSE 2020 | Question: 39

Which one of the following predicate formulae is NOT logically valid?


Note that is a predicate formula without any free occurrence of .

A.
B.
C.
D.

gatecse-2020 first-order-logic mathematical-logic 2-marks

Answer key ☟

3.4.26 First Order Logic: GATE CSE 2023 | Question: 16

Geetha has a conjecture about integers, which is of the form

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.

gatecse-2023 mathematical-logic first-order-logic multiple-selects 1-mark

Answer key ☟

3.4.27 First Order Logic: GATE IT 2004 | Question: 3

Let and be three statements with variables and chosen from some universe.
Consider the following statement:

Which one of the following is its equivalent?

A.
B.
C.
D.

gateit-2004 mathematical-logic normal discrete-mathematics first-order-logic

Answer key ☟

3.4.28 First Order Logic: GATE IT 2005 | Question: 36

Let and be arbitrary predicates. Which of the following statements is always TRUE?

A.
B.
C.
D.

gateit-2005 mathematical-logic first-order-logic normal

Answer key ☟

3.4.29 First Order Logic: GATE IT 2006 | Question: 21

Consider the following first order logic formula in which is a binary relation symbol.

The formula is

A. satisfiable and valid B. satisfiable and so is its negation


C. unsatisfiable but its negation is valid D. satisfiable but its negation is
unsatisfiable
gateit-2006 mathematical-logic normal first-order-logic

Answer key ☟

3.4.30 First Order Logic: GATE IT 2007 | Question: 21

Which one of these first-order logic formulae is valid?

A.
B.
C.
D.

gateit-2007 mathematical-logic normal first-order-logic

Answer key ☟

3.4.31 First Order Logic: GATE IT 2008 | Question: 21

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.

gateit-2008 first-order-logic normal


Answer key ☟

3.4.32 First Order Logic: GATE IT 2008 | Question: 22

Which of the following is the negation of

A.
B.
C.
D.

gateit-2008 mathematical-logic normal first-order-logic

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?

here is sister of (Mark all the appropriate choices)

A.
B.
C.
D.

go2025-mockgate-1 first-order-logic multiple-selects mathematical-logic

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.

go2025-mockgate-2 first-order-logic multiple-selects

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

Here, (Mark all the appropriate choices)

A.
B.
C.
D.

go2025-mockgate-3 mathematical-logic first-order-logic multiple-selects

Answer key ☟

3.4.36 First Order Logic: GATE Overflow Test Series | Mock GATE | Test 4 | Question: 29

Which of the following formulas is a Correct formalization of the sentence:

Here, denotes uses

A.
B.
C.
D. None of the above

go2025-mockgate-4 mathematical-logic first-order-logic

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.

ugcnetcse-jan2017-paper3 mathematical-logic first-order-logic

Answer key ☟

3.4.38 First Order Logic: UGC NET CSE | July 2018 | Part 2 | Question: 77

Consider the following English sentence:


"Agra and Gwalior are both in India".
A student has written a logical sentence for the above English sentence in First-Order Logic using predicate
IN(x, y), which means x is in y, as follows.
In(Agra, India) In(Gwalior, India)
Which one of the following is correct with respect to the above logical sentence?

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

ugcnetcse-july2018-paper2 discrete-mathematics first-order-logic

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

ugcnetcse-june2013-paper3 discrete-mathematics first-order-logic

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.

A. Both & are true. B. Both & are false.


C. - false, - true D. - true, - false
ugcnetcse-june2014-paper2 mathematical-logic first-order-logic

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 ☟

3.5 Functions (1)

3.5.1 Functions: UGC NET CSE | July 2018 | Part 2 | Question: 87

Match the following in and , for a function :

A. B.
C. D.
ugcnetcse-july2018-paper2 discrete-mathematics functions

Answer key ☟

3.6 Group Theory (1)

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 ☟

3.7 Logical Reasoning (3)

3.7.1 Logical Reasoning: GATE CSE 2012 | Question: 1

Consider the following logical inferences.

: If it rains then the cricket match will not be played.


The cricket match was played.
Inference: There was no rain.

: If it rains then the cricket match will not be played.


It did not rain.
Inference: The cricket match was played.
Which of the following is TRUE?

A. Both and are correct inferences


B. is correct but is not a correct inference
C. is not correct but is a correct inference
D. Both and are not correct inferences

gatecse-2012 mathematical-logic easy logical-reasoning

Answer key ☟

3.7.2 Logical Reasoning: GATE CSE 2015 Set 2 | Question: 3

Consider the following two statements.

: If a candidate is known to be corrupt, then he will not be elected


: If a candidate is kind, he will be elected

Which one of the following statements follows from and as per sound inference rules of logic?

A. If a person is known to be corrupt, he is kind


B. If a person is not known to be corrupt, he is not kind
C. If a person is kind, he is not known to be corrupt
D. If a person is not kind, he is not known to be corrupt

gatecse-2015-set2 mathematical-logic normal logical-reasoning

Answer key ☟

3.7.3 Logical Reasoning: GATE CSE 2015 Set 3 | Question: 24

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?

A. The result is head B. The result is tail


C. If the person is of , then the D. If the person is of , then the
result is tail result is tail
gatecse-2015-set3 mathematical-logic difficult logical-reasoning

Answer key ☟

3.8 Prolog (1)

3.8.1 Prolog: UGC NET CSE | December 2015 | Part 3 | Question: 7

Given the following set of prolog clauses:


father(X,Y) :
parent(X,Y),
male(X),
parent(Sally, Bob),
parent(Jim, Bob),
parent(Alice, Jane),
male(Bob),
male(Jim),
female(Salley),
female(Alice)

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 ☟

3.9 Propositional Logic (59)

3.9.1 Propositional Logic: GATE CSE 1987 | Question: 10e

Show that the conclusion follows from the premises


gate1987 mathematical-logic propositional-logic proof descriptive

Answer key ☟

3.9.2 Propositional Logic: GATE CSE 1988 | Question: 2vii

Define the validity of a well-formed formula(wff)?


gate1988 descriptive mathematical-logic propositional-logic

Answer key ☟

3.9.3 Propositional Logic: GATE CSE 1989 | Question: 3-v

Which of the following well-formed formulas are equivalent?

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

Indicate which of the following well-formed formulae are valid:

A.
B.
C.
D.

gate1990 normal mathematical-logic propositional-logic multiple-selects

Answer key ☟

3.9.5 Propositional Logic: GATE CSE 1991 | Question: 03,xii

If , and are propositional formulae such that and are both


tautologies, then which of the following is true:

A. Both and are tautologies B. The conjunction is not


satisfiable
C. Neither is tautologous D. Neither is satisfiable
E. None of the above
gate1991 mathematical-logic normal propositional-logic multiple-selects

Answer key ☟

3.9.6 Propositional Logic: GATE CSE 1992 | Question: 02,xvi

Which of the following is/are a tautology?

A. B.
C. D.
gate1992 mathematical-logic easy propositional-logic multiple-selects

Answer key ☟

3.9.7 Propositional Logic: GATE CSE 1992 | Question: 15.a

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.

gate1992 normal mathematical-logic propositional-logic descriptive

Answer key ☟

3.9.8 Propositional Logic: GATE CSE 1993 | Question: 18

Show that proposition is a logical consequence of the formula

using truth tables.


gate1993 mathematical-logic normal propositional-logic proof descriptive

Answer key ☟
3.9.9 Propositional Logic: GATE CSE 1993 | Question: 8.2

The proposition is:

A. a tautology B. logically equivalent to


C. logically equivalent to D. a contradiction
E. none of the above
gate1993 mathematical-logic easy propositional-logic

Answer key ☟

3.9.10 Propositional Logic: GATE CSE 1994 | Question: 3.13

Let and be propositions. Using only the Truth Table, decide whether

does not imply

is True or False.

gate1994 mathematical-logic normal propositional-logic true-false

Answer key ☟

3.9.11 Propositional Logic: GATE CSE 1995 | Question: 13

Obtain the principal (canonical) conjunctive normal form of the propositional formula

where is logical and, is inclusive or and is negation.


gate1995 mathematical-logic propositional-logic normal descriptive

Answer key ☟

3.9.12 Propositional Logic: GATE CSE 1995 | Question: 2.19

If the proposition is true, then the truth value of the proposition , where is
negation, is inclusive OR and is implication, is

A. True B. Multiple Values


C. False D. Cannot be determined
gate1995 mathematical-logic normal propositional-logic

Answer key ☟

3.9.13 Propositional Logic: GATE CSE 1996 | Question: 2.3

Which of the following is NOT True?


(Read as AND, as OR, as NOT, as one way implication and as two way implication)

A.
B.
C.
D.

gate1996 mathematical-logic normal propositional-logic

Answer key ☟
3.9.14 Propositional Logic: GATE CSE 1997 | Question: 3.2

Which of the following propositions is a tautology?

A. B.
C. D.
gate1997 mathematical-logic easy propositional-logic

Answer key ☟

3.9.15 Propositional Logic: GATE CSE 1998 | Question: 1.5

What is the converse of the following assertion?

I stay only if you go

A. I stay if you go B. If I stay then you go


C. If you do not go then I do not stay D. If I do not stay then you go
gate1998 mathematical-logic easy propositional-logic

Answer key ☟

3.9.16 Propositional Logic: GATE CSE 1999 | Question: 14

Show that the formula is not a tautology.

Let be a tautology and any other formula. Prove that is a tautology.


gate1999 mathematical-logic normal propositional-logic proof descriptive

Answer key ☟

3.9.17 Propositional Logic: GATE CSE 2000 | Question: 2.7

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 ☟

3.9.18 Propositional Logic: GATE CSE 2001 | Question: 1.3

Consider two well-formed formulas in propositional logic

Which one of the following statements is correct?

A. is satisfiable, is valid B. unsatisfiable, is satisfiable


C. is unsatisfiable, is valid D. and are both satisfiable
gatecse-2001 mathematical-logic easy propositional-logic

Answer key ☟

3.9.19 Propositional Logic: GATE CSE 2002 | Question: 1.8

"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 ☟

3.9.20 Propositional Logic: GATE CSE 2002 | Question: 5b

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.

gatecse-2002 mathematical-logic easy descriptive propositional-logic

Answer key ☟

3.9.21 Propositional Logic: GATE CSE 2003 | Question: 72

The following resolution rule is used in logic programming.


Derive clause from clauses
Which of the following statements related to this rule is FALSE?

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

gatecse-2003 mathematical-logic normal propositional-logic

Answer key ☟

3.9.22 Propositional Logic: GATE CSE 2004 | Question: 70

The following propositional statement is

A. satisfiable but not valid B. valid


C. a contradiction D. None of the above
gatecse-2004 mathematical-logic normal propositional-logic

Answer key ☟

3.9.23 Propositional Logic: GATE CSE 2005 | Question: 40

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 ☟

3.9.24 Propositional Logic: GATE CSE 2006 | Question: 27

Consider the following propositional statements:


Which one of the following is true?

A. is a tautology, but not B. is a tautology, but not


C. and are both tautologies D. Both and are not tautologies
gatecse-2006 mathematical-logic normal propositional-logic

Answer key ☟

3.9.25 Propositional Logic: GATE CSE 2008 | Question: 31

and are two propositions. Which of the following logical expressions are equivalent?

I.
II.
III.
IV.

A. Only I and II B. Only I, II and III


C. Only I, II and IV D. All of I, II, III and IV
gatecse-2008 normal mathematical-logic propositional-logic

Answer key ☟

3.9.26 Propositional Logic: GATE CSE 2009 | Question: 24

The binary operation is defined as follows

Which one of the following is equivalent to ?

A. B.
C. D.
gatecse-2009 mathematical-logic easy propositional-logic

Answer key ☟

3.9.27 Propositional Logic: GATE CSE 2014 Set 1 | Question: 53

Which one of the following propositional logic formulas is TRUE when exactly two of and are
TRUE?

A.
B.
C.
D.

gatecse-2014-set1 mathematical-logic normal propositional-logic

Answer key ☟

3.9.28 Propositional Logic: GATE CSE 2014 Set 2 | Question: 53

Which one of the following Boolean expressions is NOT a tautology?


A.
B.
C.
D.

gatecse-2014-set2 mathematical-logic propositional-logic normal

Answer key ☟

3.9.29 Propositional Logic: GATE CSE 2014 Set 3 | Question: 1

Consider the following statements:

P: Good mobile phones are not cheap


Q: Cheap mobile phones are not good

L: P implies Q
M: Q implies P
N: P is equivalent to Q

Which one of the following about L, M, and N is CORRECT?

A. Only L is TRUE. B. Only M is TRUE.


C. Only N is TRUE. D. L, M and N are TRUE.
gatecse-2014-set3 mathematical-logic easy propositional-logic

Answer key ☟

3.9.30 Propositional Logic: GATE CSE 2015 Set 1 | Question: 14

Which one of the following is NOT equivalent to ?

A.
B.
C.
D.

gatecse-2015-set1 mathematical-logic easy propositional-logic

Answer key ☟

3.9.31 Propositional Logic: GATE CSE 2016 Set 1 | Question: 1

Let represents the following propositions.

is a composite number.
is a perfect square.
is a prime number.

The integer which satisfies is ____________.

gatecse-2016-set1 mathematical-logic normal numerical-answers propositional-logic

Answer key ☟
3.9.32 Propositional Logic: GATE CSE 2016 Set 2 | Question: 01

Consider the following expressions:

i.
ii.
iii.
iv.
v.

The number of expressions given above that are logically implied by is ___________.

gatecse-2016-set2 mathematical-logic normal numerical-answers propositional-logic

Answer key ☟

3.9.33 Propositional Logic: GATE CSE 2017 Set 1 | Question: 01

The statement is logically equivalent to which of the statements below?

I.
II.
III.
IV.

A. I only B. I and IV only


C. II only D. II and III only
gatecse-2017-set1 mathematical-logic propositional-logic easy

Answer key ☟

3.9.34 Propositional Logic: GATE CSE 2017 Set 1 | Question: 29

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 ☟

3.9.35 Propositional Logic: GATE CSE 2017 Set 2 | Question: 11

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 ☟

3.9.36 Propositional Logic: GATE CSE 2021 Set 1 | Question: 7

Let and be two propositions. Consider the following two formulae in propositional logic.

Which one of the following choices is correct?


A. Both and are tautologies.
B. is a tautology but is not a tautology
C. is not a tautology but is a tautology
D. Neither nor is a tautology

gatecse-2021-set1 mathematical-logic propositional-logic 1-mark

Answer key ☟

3.9.37 Propositional Logic: GATE CSE 2021 Set 2 | Question: 15

Choose the correct choice(s) regarding the following proportional logic assertion :

A. is neither a tautology nor a contradiction


B. is a tautology
C. is a contradiction
D. The antecedent of is logically equivalent to the consequent of

gatecse-2021-set2 multiple-selects mathematical-logic propositional-logic 1-mark

Answer key ☟

3.9.38 Propositional Logic: GATE CSE 2024 | Set 2 | Question: 2

​Let and be the following propositions:


: Fail grade can be given.
: Student scores more than marks.

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 ☟

3.9.39 Propositional Logic: GATE DS&AI 2024 | Question: 19

​Let and be two propositions. Which of the following statements is a tautology /are tautologies?

A.
B.
C.
D.

gate-ds-ai-2024 mathematical-logic propositional-logic

Answer key ☟

3.9.40 Propositional Logic: GATE IT 2004 | Question: 31

Let and be four primitive statements. Consider the following arguments:


Which of the above arguments are valid?

A. and only B. and only C. and only D. and


gateit-2004 mathematical-logic normal propositional-logic

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

go2025-mockgate-4 propositional-logic mathematical-logic

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

go2025-mockgate-5 mathematical-logic propositional-logic 1-mark

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.

go2025-mockgate-5 mathematical-logic propositional-logic multiple-selects 2-marks

Answer key ☟

3.9.45 Propositional Logic: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 11

Consider the following logical statements:

If budget happens or if gold prices go up, stock prices go down.


Stock prices went down.

Which of the following is NOT a valid conclusion? (Mark all the appropriate choices)

A. Gold prices went up B. Gold prices went down


C. Budget happened D. If budget did not happen then gold
prices had gone down
go2025-mockgate-6 mathematical-logic propositional-logic moderate multiple-selects 1-mark

Answer key ☟

3.9.46 Propositional Logic: UGC NET CSE | December 2006 | Part 2 | Question: 2

The proposition ~ q ∨ p is equivalent to :

A. B. C. D.

ugcnetcse-dec2006-paper2 mathematical-logic propositional-logic

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

In propositional logic, given and , we can infer ________

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

In propositional logic if and are two premises such that

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

Which of the following statements is true?

A. The sentence is a logical consequence of if and only if is satisfiable.


B. The sentence is a logical consequence of if and only if is valid.
C. The sentence is a logical consequence of if and only if is consistent.
D. The sentence is a logical consequence of if and only if is inconsistent.

ugcnetcse-jan2017-paper3 mathematical-logic propositional-logic

Answer key ☟

3.9.51 Propositional Logic: UGC NET CSE | June 2009 | Part 2 | Question: 25

The prepositional formula given by the tree :


is :

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.

ugcnetcse-june2014-paper2 mathematical-logic propositional-logic

Answer key ☟

3.9.53 Propositional Logic: UGC NET CSE | June 2019 | Part 2 | Question: 6

Which of the following is principal conjunctive normal form for ?

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

Match List-I with List-II:

Choose the correct option from those given below:

A. (a) – (ii); (b) – (iii); (c) – (i); (d) – (iv)


B. (a) – (ii); (b) – (i); (c) – (iii); (d) – (iv)
C. (a) – (iv); (b) – (i); (c) – (iii); (d) – (ii)
D. (a) – (iv); (b) – (iii); (c) – (i); (d) – (ii)

ugcnetcse-june2019-paper2 propositional-logic

Answer key ☟

3.9.55 Propositional Logic: UGC NET CSE | Junet 2015 | Part 2 | Question: 10

Consider a proposition given as:


, if and and its proof as:
If , then
Which of the following is correct with respect to the given proposition and its proof?

i. The proof shows the converse


ii. The proof starts by assuming what is to be shown
iii. The proof is correct and there is nothing wrong

A. only B. only C. and D. only


ugcnetcse-june2015-paper2 discrete-mathematics propositional-logic

Answer key ☟
3.9.56 Propositional Logic: UGC NET CSE | Junet 2015 | Part 2 | Question: 9

Match the following :

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

Consider the statement below.


A person who is radical is electable if he/she is conservative , but otherwise not electable.
Few probable logical assertions of the above sentence are given below.

i.
ii.
iii.
iv.

Which of the above logical assertions are true?


Choose the correct answer from the options given below:

A. only B. only C. and only D. and only


ugcnetcse-oct2020-paper2 discrete-mathematics propositional-logic

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.

ugcnetsep2013ii discrete-mathematics propositional-logic

Answer key ☟

3.10 Relations (1)

3.10.1 Relations: UGC NET CSE | October 2020 | Part 2 | Question: 39

Consider the following properties:

i. Reflexive
ii. Antisymmetric
iii. Symmetric

Let and be a relation on .


Which of the following property (properties) is (are) satisfied by the relation ?

A. Only B. Only C. Both and D. and not


ugcnetcse-oct2020-paper2 discrete-mathematics set-theory&algebra relations

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)

4.0.1 GATE Overflow Test Series | Mock GATE | Test 3 | Question: 59

If the function is differentiable, then the value of is


_________
go2025-mockgate-3 numerical-answers calculus

Answer key ☟

4.1 Continuity (8)

4.1.1 Continuity: GATE CSE 1996 | Question: 3

Let be a function defined by

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 ☟

4.1.2 Continuity: GATE CSE 1998 | Question: 1.4

Consider the function in the interval . In this interval, the function is

A. continuous and differentiable B. continuous but not differentiable


C. differentiable but not continuous D. neither continuous nor differentiable
gate1998 calculus continuity differentiation easy

Answer key ☟

4.1.3 Continuity: GATE CSE 2007 | Question: 1

Consider the following two statements about the function :

P. is continuous for all real values of .


Q. is differentiable for all real values of .

Which of the following is TRUE?

A. is true and is false. B. is false and is true.


C. Both and are true. D. Both and are false.
gatecse-2007 calculus continuity differentiation easy

Answer key ☟

4.1.4 Continuity: GATE CSE 2013 | Question: 22

Which one of the following functions is continuous at


A.

B.

C.
D.

gatecse-2013 calculus continuity normal

Answer key ☟

4.1.5 Continuity: GATE CSE 2014 Set 1 | Question: 47

A function is continuous in the interval . It is known that and .


Which one of the following statements must be true?

A. There exists a in the interval such that


B. For every in the interval , =
C. The maximum value of the function in the interval is
D. There exists a in the interval such that =

gatecse-2014-set1 calculus continuity normal

Answer key ☟

4.1.6 Continuity: GATE CSE 2015 Set 2 | Question: 26

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

A. II only B. III only C. II and III only D. I, II and III


gatecse-2015-set2 continuity functions normal

Answer key ☟

4.1.7 Continuity: GATE CSE 2021 Set 2 | Question: 25

Suppose that is a continuous function on the interval and a differentiable function in


the interval such that for every in the interval, . If , then is at most
__________
gatecse-2021-set2 numerical-answers calculus continuity 1-mark

Answer key ☟

4.1.8 Continuity: GATE2010 ME

The function ​

A. is continuous and differentiable


B. is continuous and differentiable except at
C. is continuous and differentiable except at
D. is continuous except and differentiable

calculus gate2010me engineering-mathematics continuity

Answer key ☟

4.2 Convergence (2)

4.2.1 Convergence: GATE CSE 1993 | Question: 01.6

Which of the following improper integrals is (are) convergent?

A. B.
C. D.

gate1993 calculus integration convergence out-of-gatecse-syllabus multiple-selects

Answer key ☟

4.2.2 Convergence: GATE CSE 1993 | Question: 02.2

The radius of convergence of the power series

is: _____________
gate1993 calculus convergence normal out-of-gatecse-syllabus fill-in-the-blanks

4.3 Definite Integral (3)

4.3.1 Definite Integral: GATE CSE 2023 | Question: 21

The value of the definite integral

is _________. (Rounded off to the nearest integer)


gatecse-2023 calculus definite-integral numerical-answers 1-mark

Answer key ☟

4.3.2 Definite Integral: GATE CSE 2024 | Set 2 | Question: 6

​Let be a continuous function from to such that

Which one of the following options is the CORRECT value of ?

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

The value of is _____

A. B. C. D.
go2025-mockgate-6 calculus definite-integral 1-mark

Answer key ☟

4.4 Differential Equation (1)

4.4.1 Differential Equation: GATE CSE 1993 | Question: 01.2

The differential equation is:

A. linear
B. non- linear
C. homogeneous
D. of degree two

gate1993 calculus differential-equation easy out-of-gatecse-syllabus multiple-selects

Answer key ☟

4.5 Differentiation (6)

4.5.1 Differentiation: GATE CSE 1996 | Question: 1.6

The formula used to compute an approximation for the second derivative of a function at a point is

A. B.

C. D.

gate1996 calculus differentiation normal

Answer key ☟

4.5.2 Differentiation: GATE CSE 2014 Set 1 | Question: 46

The function satisfies the following equation:

The value of is______.


gatecse-2014-set1 calculus easy numerical-answers differentiation

Answer key ☟

4.5.3 Differentiation: GATE CSE 2014 Set 1 | Question: 6

Let the function


where
and denote the derivative of with respect to . Which of the following statements
is/are TRUE?

I. There exists such that


II. There exists such that

A. I only B. II only C. Both I and II D. Neither I nor II


gatecse-2014-set1 calculus differentiation normal

Answer key ☟

4.5.4 Differentiation: GATE CSE 2016 Set 2 | Question: 02

Let be a polynomial and be its derivative. If the degree of is ,


then the degree of is __________.
gatecse-2016-set2 calculus normal numerical-answers differentiation

Answer key ☟

4.5.5 Differentiation: GATE CSE 2017 Set 2 | Question: 10

If and , then the constants and are

A. and B. and 0 C. and 0 D. and


gatecse-2017-set2 engineering-mathematics calculus differentiation

Answer key ☟

4.5.6 Differentiation: GATE CSE 2024 | Set 1 | Question: 1

Let be a function such that , where is the set of all real


numbers. The set of all points where is NOT differentiable is

A. B. C. D.
gatecse2024-set1 calculus differentiation

Answer key ☟

4.6 GO Mockgate 1 (1)

4.6.1 GO Mockgate 1: GATE Overflow | Mock GATE | Test 1 | Question: 19

Evaluate the limit:

A. B. C. D.
go-mockgate-1 limits calculus

Answer key ☟

4.7 Integration (12)


4.7.1 Integration: GATE CSE 1993 | Question: 02.6

The value of the double integral is_________.

gate1993 calculus integration normal fill-in-the-blanks

Answer key ☟

4.7.2 Integration: GATE CSE 1998 | Question: 8

a. Find the points of local maxima and minima, if any, of the following function defined in .

b. Integrate

gate1998 calculus maxima-minima integration normal descriptive

Answer key ☟

4.7.3 Integration: GATE CSE 2000 | Question: 2.3

Let , and .
Which of the following statements is true?

A. B.
C. and D.
gatecse-2000 calculus integration normal

Answer key ☟

4.7.4 Integration: GATE CSE 2009 | Question: 25

A. B. C. D.
gatecse-2009 calculus integration normal

Answer key ☟

4.7.5 Integration: GATE CSE 2011 | Question: 31

Given , what will be the evaluation of the definite integral ?

A. B. C. D.
gatecse-2011 calculus integration normal

Answer key ☟

4.7.6 Integration: GATE CSE 2014 Set 3 | Question: 47

The value of the integral given below is


A. B. C. D.
gatecse-2014-set3 calculus limits integration normal

Answer key ☟

4.7.7 Integration: GATE CSE 2014 Set 3 | Question: 6

If , then the value of is equal to ______.

gatecse-2014-set3 calculus integration limits numerical-answers easy

Answer key ☟

4.7.8 Integration: GATE CSE 2015 Set 1 | Question: 44

Compute the value of:

gatecse-2015-set1 calculus integration normal numerical-answers

Answer key ☟

4.7.9 Integration: GATE CSE 2015 Set 3 | Question: 45

If for non-zero where is

A. B.
C. D.
gatecse-2015-set3 calculus integration normal

Answer key ☟

4.7.10 Integration: GATE CSE 2018 | Question: 16

The value of correct to three decimal places (assuming that ) is ____

gatecse-2018 calculus integration normal numerical-answers 1-mark

Answer key ☟

4.7.11 Integration: GATE IT 2005 | Question: 35

What is the value of

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

Assuming and is a real number ,

A. B.
C. D.
go2025-mockgate-1 integration calculus

Answer key ☟

4.8 Limits (13)

4.8.1 Limits: GATE CSE 1993 | Question: 02.1

is __________

gate1993 limits calculus normal fill-in-the-blanks

Answer key ☟

4.8.2 Limits: GATE CSE 1995 | Question: 7(B)

Compute without using power series expansion

gate1995 calculus limits numerical-answers

Answer key ☟

4.8.3 Limits: GATE CSE 2008 | Question: 1

equals

A. B. C. D.
gatecse-2008 calculus limits easy

Answer key ☟

4.8.4 Limits: GATE CSE 2010 | Question: 5

What is the value of ?

A. B. C. D.
gatecse-2010 calculus limits normal

Answer key ☟

4.8.5 Limits: GATE CSE 2015 Set 1 | Question: 4

is
A. B. C. D. Not defined
gatecse-2015-set1 calculus limits normal

Answer key ☟

4.8.6 Limits: GATE CSE 2015 Set 3 | Question: 9

The value of is

A. B. C. D.
gatecse-2015-set3 calculus limits normal

Answer key ☟

4.8.7 Limits: GATE CSE 2016 Set 1 | Question: 3

gatecse-2016-set1 calculus limits easy numerical-answers

Answer key ☟

4.8.8 Limits: GATE CSE 2017 Set 1 | Question: 28

The value of

A. is B. is C. is D. does not exist


gatecse-2017-set1 calculus limits normal

Answer key ☟

4.8.9 Limits: GATE CSE 2019 | Question: 13

Compute

A. B.
C. D. Limit does not exist
gatecse-2019 engineering-mathematics calculus limits 1-mark

Answer key ☟

4.8.10 Limits: GATE CSE 2021 Set 1 | Question: 20

Consider the following expression.

The value of the above expression (rounded to 2 decimal places) is ___________.


gatecse-2021-set1 calculus limits numerical-answers 1-mark

Answer key ☟
4.8.11 Limits: GATE CSE 2022 | Question: 24

The value of the following limit is ________________.

gatecse-2022 numerical-answers calculus limits 1-mark

Answer key ☟

4.8.12 Limits: GATE DS&AI 2024 | Question: 50

Evaluate the following limit:

gate-ds-ai-2024 numerical-answers limits engineering-mathematics

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 ☟

4.9 Maxima Minima (13)

4.9.1 Maxima Minima: GATE CSE 1987 | Question: 1-xxvi

If then

A. There must be a root of between and


B. There need not be a root of between and
C. There fourth derivative of with respect to vanishes at
D. The fourth derivative of with respect to vanishes at

gate1987 calculus maxima-minima

Answer key ☟

4.9.2 Maxima Minima: GATE CSE 1995 | Question: 1.21

In the interval the equation has

A. No solution B. Exactly one solution


C. Exactly two solutions D. An infinite number of solutions
gate1995 calculus normal maxima-minima

Answer key ☟
4.9.3 Maxima Minima: GATE CSE 1995 | Question: 25a

Find the minimum value of .


gate1995 calculus maxima-minima easy descriptive

Answer key ☟

4.9.4 Maxima Minima: GATE CSE 1997 | Question: 4.1

What is the maximum value of the function in the interval ?

A. 6 B. 10 C. 12 D. 5.5
gate1997 calculus maxima-minima normal

Answer key ☟

4.9.5 Maxima Minima: GATE CSE 2008 | Question: 25

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 ☟

4.9.6 Maxima Minima: GATE CSE 2012 | Question: 9

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

C. Two, at and D. Two, at and


gatecse-2012 calculus maxima-minima normal

Answer key ☟

4.9.7 Maxima Minima: GATE CSE 2015 Set 2 | Question: GA-3

Consider a function . The value of at which the function attains a


maximum, and the maximum value of the function are:

A. B. C. D.
gatecse-2015-set2 set-theory&algebra functions normal maxima-minima

Answer key ☟

4.9.8 Maxima Minima: GATE CSE 2020 | Question: 1

Consider the functions

I.
II.
III.

Which of the above functions is/are increasing everywhere in ?


A. Ⅲ only B. Ⅱ only
C. Ⅱ and Ⅲ only D. Ⅰ and Ⅲ only
gatecse-2020 engineering-mathematics calculus maxima-minima 1-mark

Answer key ☟

4.9.9 Maxima Minima: GATE CSE 2023 | Question: 18

Let

be a real-valued function.
Which of the following statements is/are

A. does not have a local maximum. B. has a local maximum.


C. does not have a local minimum. D. has a local minimum.
gatecse-2023 calculus maxima-minima multiple-selects 1-mark

Answer key ☟

4.9.10 Maxima Minima: GATE DS&AI 2024 | Question: 5

For any twice differentiable function , if at some and , then


the function necessarily has a at .

Note: denotes the set of real numbers.

A. local minimum B. global minimum


C. local maximum D. global maximum
gate-ds-ai-2024 calculus maxima-minima

Answer key ☟

4.9.11 Maxima Minima: GATE IT 2008 | Question: 31

If is defined as follows, what is the minimum value of for ?

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

The minimum value of the function

occurs at (Mark all the appropriate choices)

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

The minimum value of the function

occurs at

A. B. C. D.
go2025-mockgate-4 maxima-minima calculus

Answer key ☟

4.10 Out of Gatecse Syllabus (4)

4.10.1 Out of Gatecse Syllabus: GATE CSE 1993 | Question: 01.5

Fourier series of the periodic function (period 2π) defined by

But putting , we get the sum of the series

A. B. C. D.
gate1993 calculus normal out-of-gatecse-syllabus multiple-selects

Answer key ☟

4.10.2 Out of Gatecse Syllabus: GATE CSE 1993 | Question: 01.7

The function has

A. no local extremum B. one local minimum but no local


maximum
C. one local maximum but no local D. one local minimum and one local
minimum maximum
gate1993 calculus maxima-minima normal out-of-gatecse-syllabus multiple-selects

Answer key ☟

4.10.3 Out of Gatecse Syllabus: GATE CSE 1993 | Question: 02.8

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 __________.

gate1993 calculus normal out-of-gatecse-syllabus fill-in-the-blanks

4.10.4 Out of Gatecse Syllabus: GATE CSE 1995 | Question: 2.18

The solution of differential equation is of the form


A. B.
C. D.
gate1995 calculus out-of-gatecse-syllabus

Answer key ☟

4.11 Polynomials (2)

4.11.1 Polynomials: GATE CSE 1987 | Question: 1-xxii

The equation has

A. All complex roots B. At least one real root


C. Four pairs of imaginary roots D. None of the above
gate1987 calculus polynomials

Answer key ☟

4.11.2 Polynomials: GATE CSE 1995 | Question: 2.8

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)

5.0.1 UGC NET CSE | June 2012 | Part 3 | Question: 17

Let denote “x+y=0” and let there be two quantifications given as

I.
II.

where and are real numbers. Then which of the following is valid?

A. I is true and II is false B. I is false and II is true


C. I is false and II is also false D. both I and II are true
ugcnetcse-june2012-paper3 discrete-mathematics mathematical-logic

Answer key ☟

5.0.2 UGC NET CSE | June 2012 | Part 3 | Question: 50

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 ☟

5.0.3 UGC NET CSE | December 2014 | Part 2 | Question: 01

Consider a set .
How many members of A shall be divisible by or by or by both and ?

A. 533 B. 599 C. 467 D. 66


ugcnetcse-dec2014-paper2 discrete-mathematics set-theory&algebra

Answer key ☟

5.0.4 UGC NET CSE | December 2013 | Part 3 | Question: 24

The objective of ____ procedure is to discover at least one ____ that causes two literals to match.

A. unification, validation B. unification, substituion


C. substitution, unification D. minimax, maximum
ugcnetcse-dec2013-paper3 discrete-mathematics mathematical-logic

Answer key ☟

5.0.5 UGC NET CSE | Junet 2015 | Part 3 | Question: 24

Which one of the following is true?

A. The resolvent of two Horn clauses is not a Horn clause


B. The resolvent of two Horn clauses is a Horn clause
C. If we resolve a negated goal G against a fact or rule A to get clause C then C has positive literal or non-null
goal
D. If we resolve a negated goal G against a fact or rule A to get clause C then C has positive literal or null goal

ugcnetcse-june2015-paper3 discrete-mathematics mathematical-logic


Answer key ☟

5.0.6 UGC NET CSE | July 2018 | Part 2 | Question: 86

If then is

A. Z B. Q C. R D. C
ugcnetcse-july2018-paper2 discrete-mathematics

Answer key ☟

5.0.7 UGC NET CSE | October 2020 | Part 2 | Question: 86

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

A. Both Statement and Statement are true


B. Both Statement and Statement are false
C. Statement is correct but Statement is false
D. Statement is incorrect but Statement is true

ugcnetcse-oct2020-paper2 discrete-mathematics graph-theory

5.0.8 UGC NET CSE | October 2020 | Part 2 | Question: 38

What kind of clauses are available in conjunctive normal form?

A. Disjunction of literals B. Disjunction of variables


C. Conjunction of literals D. Conjunction of variables
ugcnetcse-oct2020-paper2 discrete-mathematics mathematical-logic

Answer key ☟

5.0.9 UGC NET CSE | October 2020 | Part 2 | Question: 37

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 ☟

5.0.10 UGC NET CSE | October 2020 | Part 2 | Question: 26

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

Which of the following pairs of propositions are not logically equivalent?

A. and
B. and
C. and
D. and

ugcnetcse-oct2020-paper2 discrete-mathematics mathematical-logic

Answer key ☟

5.1 Boolean Function (1)

5.1.1 Boolean Function: UGC NET CSE | August 2016 | Part 2 | Question: 1

The Boolean function is equal to the Boolean function :

A. B. C. D.
ugcnetcse-aug2016-paper2 discrete-mathematics boolean-function

Answer key ☟

5.2 Combinatory (2)

5.2.1 Combinatory: UGC NET CSE | December 2012 | Part 3 | Question: 21

How many solutions do the following equations have?

where

A. B. C. D.
ugcnetcse-dec2012-paper3 discrete-mathematics combinatory

Answer key ☟

5.2.2 Combinatory: UGC NET CSE | December 2015 | Part 2 | Question: 48

How many solutions are there for the equation subject to the constraints that
?

A. 4960 B. 2600 C. 23751 D. 8855


ugcnetcse-dec2015-paper2 discrete-mathematics combinatory

Answer key ☟

5.3 Equivalence Class (1)

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 First Order Logic (2)

5.4.1 First Order Logic: UGC NET CSE | December 2012 | Part 3 | Question: 58

Skolmization is the process of

A. bringing all the quantifiers in the beginning of a formula in FDL


B. removing all the universal quantifiers
C. removing all the extential quantifiers
D. all of the above

ugcnetcse-dec2012-paper3 engineering-mathematics discrete-mathematics first-order-logic

Answer key ☟

5.4.2 First Order Logic: UGC NET CSE | October 2020 | Part 2 | Question: 40

Consider the following argument with premise and conclusion

A. This is a valid argument B. Steps and are not correct


inferences
C. Steps and are not correct D. Step is not a correct inference
inferences
ugcnetcse-oct2020-paper2 discrete-mathematics first-order-logic

Answer key ☟

5.5 Functions (2)

5.5.1 Functions: UGC NET CSE | December 2011 | Part 2 | Question: 4

Domain and Range of the function is

A. B.
C. D.
ugcnetcse-dec2011-paper2 discrete-mathematics functions

Answer key ☟

5.5.2 Functions: UGC NET CSE | December 2012 | Part 3 | Question: 19

Identify the following activation function:


, Z, X, Y are parameters.

A. Step function B. Ramp function


C. Sigmoid function D. Gaussian function
ugcnetcse-dec2012-paper3 discrete-mathematics functions

Answer key ☟

5.6 GO Mockgate 1 (1)

5.6.1 GO Mockgate 1: GATE Overflow | Mock GATE | Test 1 | Question: 35

Consider the following graph.

How many paths of length exist from node to node ?


(Note: The path may have repeated vertices. You can think of it as walks in general rather than path)

go-mockgate-1 discrete-mathematics graph-theory graph-connectivity numerical-answers

Answer key ☟

5.7 Group Theory (1)

5.7.1 Group Theory: UGC NET CSE | June 2012 | Part 3 | Question: 67

Let a*H and b*H be two cosets of H.

I. Either a*H and b*H are disjoint


II. a*H and b*H are identical

Then,

A. Only I is true B. Only II is true


C. I or II is true D. I and II is false
ugcnetcse-june2012-paper3 discrete-mathematics set-theory&algebra group-theory

Answer key ☟

5.8 Linear Programming (1)

5.8.1 Linear Programming: UGC NET CSE | July 2016 | Part 3 | Question: 70

Consider the statement


"Either "
The negation of this statement is

A. x<-2 or 2<x or -1<x<1 B. x<-2 or 2<x


C. -1<x<1 D. x -2 or 2 x or -1<x<1
ugcnetcse-july2016-paper3 linear-programming

Answer key ☟

5.9 Number Representation (1)


5.9.1 Number Representation: UGC NET CSE | December 2011 | Part 2 | Question: 34

Negative numbers cannot be represented in

A. Signed magnitude form B. complement form


C. complement form D. None of the above
ugcnetcse-dec2011-paper2 discrete-mathematics number-representation

Answer key ☟

5.10 Partial Order (2)

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

A. A unique least upper bound B. A unique greatest lower bound


C. Both and D. None of the above
ugcnetcse-dec2010-paper2 discrete-mathematics partial-order

Answer key ☟

5.10.2 Partial Order: UGC NET CSE | July 2018 | Part 2 | Question: 90

Which of the following statements is true?

A. is not totally ordered


B. The set inclusion relation is a partial ordering on the power set of a set S
C. is a poset
D. The directed graph is not a partial order

ugcnetcse-july2018-paper2 discrete-mathematics partial-order

Answer key ☟

5.11 Propositional Logic (8)

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.

ugcnetcse-aug2016-paper2 discrete-mathematics propositional-logic

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

A. O n l y and are equivalent B. O n l y and are equivalent


sentences sentences.
C. O n l y and are equivalent D. and are equivalent
sentence . sentences.
ugcnetcse-aug2016-paper3 discrete-mathematics propositional-logic

Answer key ☟

5.11.3 Propositional Logic: UGC NET CSE | August 2016 | Part 3 | Question: 74

Consider the following logical inferences :


: If it is Sunday then school will not open.
The school was open.
Inference : It was not Sunday.
: If it is Sunday then school will not open.
It was not Sunday.
Inference : The school was open.
Which of the following is correct ?

A. Both and are correct inferences.


B. is correct but is not a correct inference.
C. is not correct but is a correct inference.
D. Both and are not correct inferences.

ugcnetcse-aug2016-paper3 discrete-mathematics propositional-logic

Answer key ☟

5.11.4 Propositional Logic: UGC NET CSE | December 2011 | Part 2 | Question: 43

The proposition qvp is equivalent to

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?

A. I is true and II is true B. I is true and II is false


C. I is false and II is true D. I is false and II is false
ugcnetcse-dec2012-paper3 discrete-mathematics propositional-logic

Answer key ☟
5.11.6 Propositional Logic: UGC NET CSE | December 2015 | Part 2 | Question: 8

Match the following :

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

Consider the following statements:

a. False True
b. If

Which of the following is correct with respect to above statements?

A. Both statement a and statement b are false


B. Statement a is true and statement b is false
C. Statement a is false and statement b is true
D. Both statement a and statement b are true

ugcnetcse-july2018-paper2 discrete-mathematics propositional-logic

Answer key ☟

5.11.8 Propositional Logic: UGC NET CSE | Junet 2015 | Part 3 | Question: 57

In propositional language is equivalent to (where denotes NOT)

A. B.
C. D.
ugcnetcse-june2015-paper3 discrete-mathematics propositional-logic

Answer key ☟

5.12 Quantifiers (1)

5.12.1 Quantifiers: UGC NET CSE | July 2018 | Part 2 | Question: 85

The equivalence of is

A.
B.
C.
D.

ugcnetcse-july2018-paper2 discrete-mathematics quantifiers

Answer key ☟

5.13 Relations (1)

5.13.1 Relations: UGC NET CSE | July 2018 | Part 2 | Question: 88

Which of the relations on {0, 1, 2, 3} is an equivalence relation?

A. { (0, 0) (0, 2) (2, 0) (2, 2) (2, 3) (3, 2) (3, 3) }


B. { (0, 0) (1, 2) (2, 2) (3, 3) }
C. { (0, 0) (0, 1) (0, 2) (1, 0) (1, 1) (1, 2) (2, 0) }
D. { (0, 0) (0, 2) (2, 3) (1, 1) (2, 2)

ugcnetcse-july2018-paper2 discrete-mathematics relations

Answer key ☟

5.14 Set Theory (2)

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.

ugcnetcse-aug2016-paper2 discrete-mathematics set-theory

Answer key ☟

5.14.2 Set Theory: UGC NET CSE | December 2012 | Part 3 | Question: 34

The power set of AUB, where A={2, 3, 5, 7} and B={2, 5, 8, 9}is

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)

6.0.1 UGC NET CSE | December 2018 | Part 2 | Question: 42

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 ☟

6.0.2 UGC NET CSE | December 2004 | Part 2 | Question: 1

is called :

A. Identity law B. De Morgan’s law


C. Idempotent law D. Complement law
ugcnetcse-dec2004-paper2

Answer key ☟

6.1 Cartesian Coordinates (1)

6.1.1 Cartesian Coordinates: GATE IT 2007 | Question: 80

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 ?

A. and are adjacent to each other with respect to their -coordinate


B. Either or has the largest or the smallest -coordinate among all the points
C. The difference between -coordinates and is minimum
D. None of the above

gateit-2007 cartesian-coordinates

Answer key ☟

6.2 Determinant (11)

6.2.1 Determinant: GATE CSE 1997 | Question: 1.3

The determinant of the matrix

A. B. C. D.
gate1997 linear-algebra normal determinant

Answer key ☟

6.2.2 Determinant: GATE CSE 2000 | Question: 1.3

The determinant of the matrix

A. B. C. D.
gatecse-2000 linear-algebra easy determinant

Answer key ☟

6.2.3 Determinant: GATE CSE 2013 | Question: 3

Which one of the following does NOT equal

A. B.

C. D.

gatecse-2013 linear-algebra normal determinant

Answer key ☟
6.2.4 Determinant: GATE CSE 2014 Set 2 | Question: 4

If the matrix is such that

then the determinant of is equal to ______.


gatecse-2014-set2 linear-algebra numerical-answers easy determinant

Answer key ☟

6.2.5 Determinant: GATE CSE 2019 | Question: 9

Let be a square matrix. Consider the following two statements on .

I. is invertible
II. Determinant of is non-zero

Which one of the following is TRUE?

A. I implies II; II does not imply I B. II implies I; I does not imply II


C. I does not imply II; II does not imply I D. I and II are equivalent statements
gatecse-2019 engineering-mathematics linear-algebra determinant 1-mark

Answer key ☟

6.2.6 Determinant: GATE CSE 2023 | Question: 8

Let

and

Let and denote the determinants of the matrices and respectively.


Which one of the options given below is

A.
B.
C.
D.

gatecse-2023 linear-algebra determinant 1-mark easy

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?

A. The determinant of is the negative of the determinant of


B. If is invertible, then is also invertible
C. If is symmetric, then is also symmetric
D. If the trace of is zero, then the trace of is also zero

gatecse2024-set2 linear-algebra multiple-selects matrix determinant

Answer key ☟

6.2.8 Determinant: GATE DS&AI 2024 | Question: 25

Consider the matrix .

The determinant of is .

gate-ds-ai-2024 numerical-answers matrix determinant linear-algebra

Answer key ☟

6.2.9 Determinant: GATE IT 2004 | Question: 32

Let be an matrix of the following form.

What is the value of the determinant of ?

A.

B.

C.

D.

gateit-2004 linear-algebra matrix normal determinant

Answer key ☟
6.2.10 Determinant: GATE IT 2005 | Question: 3

The determinant of the matrix given below is

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

The value of determinant of non identity idempotent matrix is ________


go2025-mockgate-2 numerical-answers matrix determinant

Answer key ☟

6.3 Eigen Value (32)

6.3.1 Eigen Value: GATE CSE 1993 | Question: 01.1

The eigen vector of the matrix

is (are)

A. B. C. D.
gate1993 eigen-value linear-algebra easy multiple-selects

Answer key ☟

6.3.2 Eigen Value: GATE CSE 2002 | Question: 5a

Obtain the eigen values of the matrix

gatecse-2002 linear-algebra eigen-value normal descriptive

Answer key ☟

6.3.3 Eigen Value: GATE CSE 2005 | Question: 49

What are the eigenvalues of the following matrix?


A. and B. and C. and D. and
gatecse-2005 linear-algebra eigen-value easy

Answer key ☟

6.3.4 Eigen Value: GATE CSE 2007 | Question: 25

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 ☟

6.3.5 Eigen Value: GATE CSE 2008 | Question: 28

How many of the following matrices have an eigenvalue 1?


and

A. one B. two C. three D. four


gatecse-2008 eigen-value linear-algebra

Answer key ☟

6.3.6 Eigen Value: GATE CSE 2010 | Question: 29

Consider the following matrix

If the eigenvalues of A are and , then

A. , B. , C. , D. ,
gatecse-2010 linear-algebra eigen-value easy

Answer key ☟

6.3.7 Eigen Value: GATE CSE 2011 | Question: 40

Consider the matrix as given below.

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 ☟

6.3.8 Eigen Value: GATE CSE 2012 | Question: 11

Let A be the matrix with elements and . Then the eigenvalues of


the matrix are

A. and B. and
C. and D. and
gatecse-2012 linear-algebra eigen-value

Answer key ☟

6.3.9 Eigen Value: GATE CSE 2014 Set 1 | Question: 5

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 ☟

6.3.10 Eigen Value: GATE CSE 2014 Set 2 | Question: 47

The product of the non-zero eigenvalues of the matrix is ____

gatecse-2014-set2 linear-algebra eigen-value normal numerical-answers

Answer key ☟

6.3.11 Eigen Value: GATE CSE 2014 Set 3 | Question: 4

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.

gatecse-2014-set3 linear-algebra eigen-value normal

Answer key ☟

6.3.12 Eigen Value: GATE CSE 2015 Set 1 | Question: 36

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 ☟

6.3.13 Eigen Value: GATE CSE 2015 Set 2 | Question: 5

The larger of the two eigenvalues of the matrix is _______.

gatecse-2015-set2 linear-algebra eigen-value easy numerical-answers

Answer key ☟

6.3.14 Eigen Value: GATE CSE 2015 Set 3 | Question: 15

In the given matrix , one of the eigenvalues is The eigenvectors corresponding to the

eigenvalue are

A.
B.
C.
D.

gatecse-2015-set3 linear-algebra eigen-value normal

Answer key ☟

6.3.15 Eigen Value: GATE CSE 2016 Set 1 | Question: 05

Two eigenvalues of a real matrix are and . The determinant of is _______


gatecse-2016-set1 linear-algebra eigen-value numerical-answers normal

Answer key ☟

6.3.16 Eigen Value: GATE CSE 2016 Set 2 | Question: 06

Suppose that the eigenvalues of matrix are . The determinant of is _________.

gatecse-2016-set2 linear-algebra eigen-value normal numerical-answers

Answer key ☟

6.3.17 Eigen Value: GATE CSE 2017 Set 1 | Question: 31

Let be real valued square symmetric matrix of rank with Consider the
following statements.

I. One eigenvalue must be in


II. The eigenvalue with the largest magnitude must be strictly greater than

Which of the above statements about eigenvalues of is/are necessarily CORRECT?

A. Both I and II B. I only C. II only D. Neither I nor II


gatecse-2017-set1 linear-algebra eigen-value normal

Answer key ☟
6.3.18 Eigen Value: GATE CSE 2017 Set 2 | Question: 22

Let and be two matrices.

Then the rank of is ___________ .


gatecse-2017-set2 linear-algebra eigen-value numerical-answers

Answer key ☟

6.3.19 Eigen Value: GATE CSE 2017 Set 2 | Question: 52

If the characteristic polynomial of a matrix over (the set of real numbers) is


, and one eigenvalue of is then the largest among the absolute values
of the eigenvalues of is _______
gatecse-2017-set2 engineering-mathematics linear-algebra numerical-answers eigen-value

Answer key ☟

6.3.20 Eigen Value: GATE CSE 2018 | Question: 17

Consider a matrix where . Note that denotes the transpose of . The


largest eigenvalue of is ____
gatecse-2018 linear-algebra eigen-value normal numerical-answers 1-mark

Answer key ☟

6.3.21 Eigen Value: GATE CSE 2018 | Question: 26

Consider a matrix P whose only eigenvectors are the multiples of .

Consider the following statements.

I. P does not have an inverse


II. P has a repeated eigenvalue
III. P cannot be diagonalized

Which one of the following options is correct?

A. Only I and III are necessarily true B. Only II is necessarily true


C. Only I and II are necessarily true D. Only II and III are necessarily true
gatecse-2018 linear-algebra matrix eigen-value normal 2-marks

Answer key ☟

6.3.22 Eigen Value: GATE CSE 2019 | Question: 44

Consider the following matrix:

The absolute value of the product of Eigen values of is _______


gatecse-2019 numerical-answers engineering-mathematics linear-algebra eigen-value 2-marks

Answer key ☟

6.3.23 Eigen Value: GATE CSE 2021 Set 1 | Question: 52

Consider the following matrix.

The largest eigenvalue of the above matrix is __________.


gatecse-2021-set1 linear-algebra matrix eigen-value numerical-answers 2-marks

Answer key ☟

6.3.24 Eigen Value: GATE CSE 2022 | Question: 43

​Which of the following is/are the eigenvector(s) for the matrix given below?

A. B.

C. D.

gatecse-2022 linear-algebra eigen-value multiple-selects 2-marks

Answer key ☟

6.3.25 Eigen Value: GATE CSE 2023 | Question: 20

Let be the adjacency matrix of the graph with vertices

Let , and be the five eigenvalues of . Note that these eigenvalues need not be distinct.
The value of ____________

gatecse-2023 linear-algebra eigen-value numerical-answers 1-mark


Answer key ☟

6.3.26 Eigen Value: GATE CSE 2024 | Set 1 | Question: 2

The product of all eigenvalues of the matrix is

A. B. C. D.
gatecse2024-set1 linear-algebra eigen-value

Answer key ☟

6.3.27 Eigen Value: GATE DS&AI 2024 | Question: 3

​Consider the matrix .


Which ONE of the following statements is TRUE?

A. The eigenvalues of are non-negative and real.


B. The eigenvalues of are complex conjugate pairs.
C. One eigenvalue of is positive and real, and another eigenvalue of is zero.
D. One eigenvalue of is non-negative and real, and another eigenvalue of is negative and real.

gate-ds-ai-2024 eigen-value linear-algebra

Answer key ☟

6.3.28 Eigen Value: GATE Data Science and Artificial Intelligence 2024 | Sample Paper | Question: 17

For matrix , one of the eigenvalues is . Then, the other eigenvalue is

A. B. C. D.

gateda-sample-paper-2024 linear-algebra eigen-value

Answer key ☟

6.3.29 Eigen Value: GATE IT 2006 | Question: 26

What are the eigenvalues of the matrix given below

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 ☟

6.3.32 Eigen Value: GATE-2014 EC

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.

My question is what is “principal minors of A” ?

linear-algebra gate2014-ec-1 eigen-value

Answer key ☟

6.4 Eigen Vector (1)

6.4.1 Eigen Vector: GATE Overflow Test Series | Mock GATE | Test 6 | Question: 35

What is the minimum value of subject to if

A. B. C. D.
go2025-mockgate-6 linear-algebra eigen-value eigen-vector 1-mark

Answer key ☟

6.5 GO Mockgate 1 (1)

6.5.1 GO Mockgate 1: GATE Overflow | Mock GATE | Test 1 | Question: 52

For the above given matrix

A. B. C. D.
go-mockgate-1 engineering-mathematics linear-algebra matrix
Answer key ☟

6.6 Inequality (1)

6.6.1 Inequality: GATE CSE 1987 | Question: 1-xxi

If and are constants, which of the following is a linear inequality?

A. B. C. D.
gate1987 linear-algebra inequality out-of-gatecse-syllabus

Answer key ☟

6.7 Matrix (27)

6.7.1 Matrix: GATE CSE 1987 | Question: 1-xxiii

A square matrix is singular whenever

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 ☟

6.7.2 Matrix: GATE CSE 1988 | Question: 16i

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

Compute and using Gaussian elimination with partial pivoting.


gate1988 normal descriptive linear-algebra matrix

Answer key ☟

6.7.3 Matrix: GATE CSE 1993 | Question: 02.7

If the matrix , calculated by the use of Cayley-Hamilton theorem or

otherwise, is _______
gate1993 linear-algebra normal matrix fill-in-the-blanks

Answer key ☟

6.7.4 Matrix: GATE CSE 1994 | Question: 1.2

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 ☟

6.7.5 Matrix: GATE CSE 1994 | Question: 3.12

Find the inverse of the matrix

gate1994 linear-algebra matrix easy descriptive

Answer key ☟

6.7.6 Matrix: GATE CSE 1996 | Question: 10

Let be two matrices such that . Let

and . Express the elements of in terms of the elements of .

gate1996 linear-algebra matrix normal descriptive

Answer key ☟

6.7.7 Matrix: GATE CSE 1996 | Question: 2.6

The matrices and commute under multiplication

A. if an integer B. always
C. never D. if
gate1996 linear-algebra normal matrix

Answer key ☟

6.7.8 Matrix: GATE CSE 1997 | Question: 4.2

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

C. Column is the same as the second D. Row is all zero


column of
gate1997 linear-algebra easy matrix

Answer key ☟

6.7.9 Matrix: GATE CSE 1998 | Question: 2.2

Consider the following determinant

Which of the following is a factor of ?

A. B. C. D.
gate1998 linear-algebra matrix normal
Answer key ☟

6.7.10 Matrix: GATE CSE 2001 | Question: 1.1

Consider the following statements:

S1: The sum of two singular matrices may be non-singular


S2: The sum of two non-singular matrices may be singular

Which one of the following statements is correct?

A. and both are true B. is true, is false


C. is false, is true D. and both are false
gatecse-2001 linear-algebra normal matrix

Answer key ☟

6.7.11 Matrix: GATE CSE 2004 | Question: 26

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 ☟

6.7.12 Matrix: GATE CSE 2004 | Question: 27

Let be matrices, each with non-zero determinant. If , then is

A. B.
C. D. Does not necessarily exist
gatecse-2004 linear-algebra normal matrix

Answer key ☟

6.7.13 Matrix: GATE CSE 2004 | Question: 76

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 ☟

6.7.14 Matrix: GATE CSE 2006 | Question: 23

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 ☟

6.7.15 Matrix: GATE CSE 2015 Set 1 | Question: 18

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 ☟

6.7.16 Matrix: GATE CSE 2015 Set 2 | Question: 27

Perform the following operations on the matrix

i. Add the third row to the second row


ii. Subtract the third column from the first column.

The determinant of the resultant matrix is _____.

gatecse-2015-set2 linear-algebra matrix easy numerical-answers

Answer key ☟

6.7.17 Matrix: GATE CSE 2022 | Question: 10

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?

A. Statement is correct and Statement is wrong.


B. Statement is wrong and Statement is correct.
C. Both Statement and Statement are correct.
D. Both Statement and Statement are wrong.

gatecse-2022 linear-algebra matrix 1-mark

Answer key ☟

6.7.18 Matrix: GATE IT 2004 | Question: 36

If matrix and ( is the identity matrix and is the


zero matrix), then the inverse of is

A. B.

C. D.

gateit-2004 linear-algebra matrix normal

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

A. and B. and C. and D. and


gateit-2008 linear-algebra normal matrix

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

Let be the matrix . For what value of will be orthogonal?

A. B. C. D.
go2025-mockgate-2 matrix

Answer key ☟

6.7.22 Matrix: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 35

If and are matrices of same order and , , then the expression


evaluates to be

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

Let be an invertible matrix of order and , then the value of is ________


go2025-mockgate-3 numerical-answers linear-algebra matrix

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

The trace of the following matrix is _______

go2025-mockgate-6 numerical-answers linear-algebra matrix 1-mark

Answer key ☟

6.8 Numerical Methods (2)

6.8.1 Numerical Methods: GATE IT 2006 | Question: 76

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?

A. it will converge B. It will diverse


C. It will neither converge nor diverse D. It is not applicable
gateit-2006 linear-algebra normal numerical-methods non-gatecse

Answer key ☟

6.9 Out of Gatecse Syllabus (1)

6.9.1 Out of Gatecse Syllabus: GATE CSE 1988 | Question: 16ii-iii

If for the vector and is

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

6.10 Rank of Matrix (7)

6.10.1 Rank of Matrix: GATE CSE 1994 | Question: 1.9

The rank of matrix is:

A. B. C. D.
gate1994 linear-algebra matrix rank-of-matrix easy

Answer key ☟

6.10.2 Rank of Matrix: GATE CSE 1995 | Question: 1.24

The rank of the following matrix, where is a real number is

A. B.
C. D. Depends on the value of
gate1995 linear-algebra matrix normal rank-of-matrix
Answer key ☟

6.10.3 Rank of Matrix: GATE CSE 1998 | Question: 2.1

The rank of the matrix given below is:

A. B. C. D.
gate1998 linear-algebra matrix normal rank-of-matrix

Answer key ☟

6.10.4 Rank of Matrix: GATE CSE 2002 | Question: 1.1

The rank of the matrix is

A. B. C. D.
gatecse-2002 linear-algebra easy rank-of-matrix

Answer key ☟

6.10.5 Rank of Matrix: GATE CSE 2020 | Question: 27

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.

Which of the above statements are TRUE?

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 ☟

6.10.6 Rank of Matrix: GATE CSE 2021 Set 2 | Question: 24

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)

A. rank rank B. rank rank


C. rank D. rank
go2025-mockgate-4 linear-algebra rank-of-matrix multiple-selects

Answer key ☟

6.11 Subspace (1)

6.11.1 Subspace: GATE DS&AI 2024 | Question: 37

Select all choices that are subspaces of .

Note: denotes the set of real numbers.

A.

B.

C.

D.

gate-ds-ai-2024 linear-algebra vector-space subspace

Answer key ☟

6.12 System of Equations (15)

6.12.1 System of Equations: GATE CSE 1996 | Question: 1.7

Let be a system of linear equations where is an matrix and is a column vector


and is an column vector of unknowns. Which of the following is false?

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 .

gate1996 linear-algebra system-of-equations normal

Answer key ☟

6.12.2 System of Equations: GATE CSE 1998 | Question: 1.2

Consider the following set of equations


This set

A. has unique solution B. has no solution


C. has finite number of solutions D. has infinite number of solutions
gate1998 linear-algebra system-of-equations easy

Answer key ☟

6.12.3 System of Equations: GATE CSE 1998 | Question: 9

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 ☟

6.12.4 System of Equations: GATE CSE 2003 | Question: 41

Consider the following system of linear equations

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 ☟

6.12.5 System of Equations: GATE CSE 2004 | Question: 71

How many solutions does the following system of linear equations have?

A. infinitely many B. two distinct solutions


C. unique D. none
gatecse-2004 linear-algebra system-of-equations normal

Answer key ☟

6.12.6 System of Equations: GATE CSE 2005 | Question: 48

Consider the following system of linear equations :

The system of equations has

A. no solution B. a unique solution


C. more than one but a finite number of D. an infinite number of solutions
solutions
gatecse-2005 linear-algebra system-of-equations normal

Answer key ☟

6.12.7 System of Equations: GATE CSE 2008 | Question: 3

The following system of equations

has a unique solution. The only possible value(s) for is/are

A. B. either or C. one of , or D. any real number


gatecse-2008 easy linear-algebra system-of-equations

Answer key ☟

6.12.8 System of Equations: GATE CSE 2014 Set 1 | Question: 4

Consider the following system of equations:

The number of solutions for this system is ______________

gatecse-2014-set1 linear-algebra system-of-equations numerical-answers normal

Answer key ☟

6.12.9 System of Equations: GATE CSE 2015 Set 3 | Question: 33

If the following system has non-trivial solution,

then which one of the following options is TRUE?

A. B.
C. D.
gatecse-2015-set3 linear-algebra system-of-equations normal

Answer key ☟

6.12.10 System of Equations: GATE CSE 2016 Set 2 | Question: 04

Consider the systems, each consisting of linear equations in variables.

I. If , then all such systems have a solution.


II. If , then none of these systems has a solution.
III. If , then there exists a system which has a solution.

Which one of the following is CORRECT?

A. and are true. B. Only and are true.


C. Only is true. D. None of them is true.
gatecse-2016-set2 linear-algebra system-of-equations normal

Answer key ☟

6.12.11 System of Equations: GATE CSE 2017 Set 1 | Question: 3

Let be scalars, not all zero, such that = 0 where are column vectors in .

Consider the set of linear equations

where and . The set of equations has

A. a unique solution at where denotes a -dimensional vector of all 1.


B. no solution
C. infinitely many solutions
D. finitely many solutions

gatecse-2017-set1 linear-algebra system-of-equations normal

Answer key ☟

6.12.12 System of Equations: GATE CSE 2022 | Question: 35

Consider solving the following system of simultaneous equations using decomposition.

where and are denoted as

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 ☟

6.12.13 System of Equations: GATE CSE 2024 | Set 1 | Question: 39

Let be any matrix, where . Which of the following statements is/are TRUE about the
system of linear equations ?

A. There exist at least linearly independent solutions to this system


B. There exist linearly independent vectors such that every solution is a linear combination of these
vectors
C. There exists a non-zero solution in which at least variables are
D. There exists a solution in which at least variables are non-zero

gatecse2024-set1 multiple-selects linear-algebra system-of-equations

Answer key ☟
6.12.14 System of Equations: GATE IT 2004 | Question: 6

What values of x, y and z satisfy the following system of linear equations?

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

Consider the system of equations given below:

The number of independent solutions of the system of equations is?

A. B. C. D.
go2025-mockgate-4 linear-algebra system-of-equations

Answer key ☟

6.13 Vector Space (5)

6.13.1 Vector Space: GATE CSE 1993 | Question: 02.3

If the linear velocity is given by

The angular velocity at the point is ________


gate1993 linear-algebra normal vector-space out-of-gatecse-syllabus fill-in-the-blanks

Answer key ☟

6.13.2 Vector Space: GATE CSE 1995 | Question: 2.13

A unit vector perpendicular to both the vectors and is:

A. B. C. D.
gate1995 linear-algebra normal vector-space

Answer key ☟

6.13.3 Vector Space: GATE CSE 2007 | Question: 27

Consider the set of (column) vectors defined by


.Which of the following is TRUE?

A. is a basis for the subspace .


B. is a linearly independent set, but it does not span and therefore is not a basis of
.
C. is not a subspace of .
D. None of the above

gatecse-2007 linear-algebra normal vector-space

Answer key ☟

6.13.4 Vector Space: GATE CSE 2014 Set 3 | Question: 5

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 ☟

6.13.5 Vector Space: GATE CSE 2017 Set 1 | Question: 30

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

6.7.22 D 6.7.23 0.625 6.7.24 625 6.7.25 3564 6.7.26 C;D


6.7.27 11 6.8.1 D 6.8.2 A 6.9.1 N/A 6.10.1 C
6.10.2 A 6.10.3 A 6.10.4 C 6.10.5 C 6.10.6 4:4
6.10.7 A;B;C 6.11.1 A;C 6.12.1 C 6.12.2 B 6.12.3 N/A
6.12.4 B 6.12.5 C 6.12.6 B 6.12.7 X 6.12.8 1
6.12.9 C 6.12.10 C 6.12.11 C 6.12.12 D 6.12.13 A
6.12.14 C 6.12.15 A 6.13.1 N/A 6.13.2 A 6.13.3 A
6.13.4 2 6.13.5 A
7 Non GATE CSE: Optimization (18)

7.1 Assignment Problem (2)

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.

ugcnetjune2014iii optimization assignment-problem

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

A. rows or columns B. rows + columns


C. rows + columns -1 D. rows + columns +1
ugcnetcse-june2015-paper3 assignment-problem optimization

Answer key ☟

7.2 Dual Linear Programming (1)

7.2.1 Dual Linear Programming: UGC NET CSE | December 2012 | Part 3 | Question: 24

If dual has an unbounded solution, then its corresponding primal has

A. no feasible solution B. unbounded solution


C. feasible solution D. none of these
ugcnetcse-dec2012-paper3 optimization dual-linear-programming

Answer key ☟

7.3 Linear Programming (1)

7.3.1 Linear Programming: UGC NET CSE | October 2020 | Part 2 | Question: 4

Consider the following linear programming (LP):

The optimum value of the LP is

A. B. C. D.
ugcnetcse-oct2020-paper2 non-gatecse linear-programming

Answer key ☟

7.4 Linear Programming Problem (1)


7.4.1 Linear Programming Problem: UGC NET CSE | December 2013 | Part 3 | Question: 1

If the primal Linear Programming pro blem has unbounded solution, then it's dual problem will have

A. feasible solution B. alternative solution


C. no feasible solution at all D. no alternative solution at all
ugcnetcse-dec2013-paper3 optimization linear-programming-problem

Answer key ☟

7.5 Optimization (8)

7.5.1 Optimization: UGC NET CSE | December 2012 | Part 3 | Question: 18

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 ☟

7.5.2 Optimization: UGC NET CSE | December 2013 | Part 3 | Question: 2

Given the problem to maximize subject to m number of in equality


constraints. , i=1, 2, .... m including the non-negativity constrains . Which of the
following conditions is a Kuhn-Tucker necessary condition for a local maxima at ?

A.
B.
C.
D. All of these

ugcnetcse-dec2013-paper3 optimization linear-programming

Answer key ☟

7.5.3 Optimization: UGC NET CSE | December 2013 | Part 3 | Question: 3

The following Linear Programming problem has:

Subject to

A. Feasible solution B. No feasible solution


C. Unbounded solution D. Single point as solution
ugcnetcse-dec2013-paper3 optimization linear-programming

Answer key ☟

7.5.4 Optimization: UGC NET CSE | December 2015 | Part 3 | Question: 47

In constraint satisfaction problem, constraints can be stated as

A. Arithmetic equations and inequalities that bind the values of variables


B. Arithmetic equations and inequalities that does not bind any restriction over variables
C. Arithmetic equations that impose restrictions over variables
D. Arithmetic equations that discard constraints over the given variables

ugcnetcse-dec2015-paper3 optimization

Answer key ☟

7.5.5 Optimization: UGC NET CSE | December 2015 | Part 3 | Question: 52

A basic feasible solution of a linear programming problem is said to be ______ if at least one of the
basic variable is zero

A. generate B. degenerate C. infeasible D. unbounded


ugcnetcse-dec2015-paper3 optimization linear-programming

Answer key ☟

7.5.6 Optimization: UGC NET CSE | June 2012 | Part 3 | Question: 46

The feasible region represented by the constraints of the


objective function Max is

A. A polygon B. Unbounded feasible region


C. A point D. None of these
ugcnetcse-june2012-paper3 optimization linear-programming

Answer key ☟

7.5.7 Optimization: UGC NET CSE | June 2014 | Part 3 | Question: 58

Which of the following special cases does not require reformulation of the problem in order to obtain a
solution ?

A. Alternate optimality B. Infeasibility


C. Unboundedness D. All of the above
ugcnetjune2014iii optimization

Answer key ☟

7.5.8 Optimization: UGC NET CSE | Junet 2015 | Part 3 | Question: 69

Given the following statements with respect to linear programming problem:


S1: The dual of the dual linear programming problem is again the primal problem
S2: If either the primal or the dual problem has an unbounded objective function value, the other problem has no
feasible solution
S3: If either the primal or the dual problem has a finite optimal solution, the other one also possess the same, and
the optimal value of the objective functions of the two problems are equal.
Which of the following is true?

A. S1 and S2 B. S1 and S3 C. S2 and S3 D. S1, S2 and S3


ugcnetcse-june2015-paper3 optimization linear-programming

Answer key ☟

7.6 Transportation Problem (5)

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

ugcnetcse-dec2012-paper3 optimization transportation-problem

Answer key ☟

7.6.2 Transportation Problem: UGC NET CSE | December 2015 | Part 3 | Question: 53

Consider the following conditions:

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:

A. and only B. and only


C. and only D. , and
ugcnetcse-dec2015-paper3 optimization transportation-problem

Answer key ☟

7.6.3 Transportation Problem: UGC NET CSE | December 2015 | Part 3 | Question: 54

Consider the following transportation problem:

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

The initial basic feasible solution of the following transportion problem:

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

Consider the following transportation problem:

The initial basic feasible solution of the above transportation problem using Vogel's Approximation method
(VAM) is given below:

The solution of the above problem:

A. is degenerate solution B. is optimum solution


C. needs to improve D. is infeasible solution
ugcnetcse-june2015-paper3 transportation-problem optimization

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)

8.1 Array (2)

8.1.1 Array: UGC NET CSE | December 2014 | Part 2 | Question: 14

When an array is passed as parameter to a function, which of the following statements is correct ?

A. The function can change values in the original array.


B. In , parameters are passed by value, the function cannot change the original value in the array.
C. It results in compilation error when the function tries to access the elements in the array.
D. Results in a run time error when the function tries to access the elements in the array.

ugcnetcse-dec2014-paper2 programming-in-c array

Answer key ☟

8.1.2 Array: UGC NET CSE | June 2013 | Part 3 | Question: 32

Arrays in C language can have ____ with reference to memory representation.

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 Array of Pointers (1)

8.2.1 Array of Pointers: UGC NET CSE | August 2016 | Part 2 | Question: 12

The following statement :

int * f[]()

declares :

A. A function returning a pointer to an array of integers.


B. Array of functions returning pointers to integers.
C. A function returning an array of pointers to integers.
D. An illegal statement.

ugcnetcse-aug2016-paper2 programming-in-c array-of-pointers pointers

Answer key ☟

8.3 Dangling Pointers (1)

8.3.1 Dangling Pointers: UGC NET CSE | September 2013 | Part 3 | Question: 65

Consider the following sequence of operations:

Pointer p1 is set to point at a new heap-dynamic variable.


Pointer p2 is assigned p1’s value
The heap dynamic variable pointed to by p1 is explicitly de-allocated but p2 is not changed by the operation

This situation leads to which of the following:

A. p1 becomes a dangling pointer B. p2 becomes a dangling pointer


C. Both p1 and p2 are now dangling D. Neither p1 nor p2 is now a dangling
pointers pointer
ugcnetcse-sep2013-paper3 programming-in-c dangling-pointers

8.4 Data Types (1)

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 ☟

8.5 GO Mockgate 1 (1)

8.5.1 GO Mockgate 1: GATE Overflow | Mock GATE | Test 1 | Question: 21

Consider the following C language code:


#include<stdio.h>
int main() {
int x=64;
int i=0;
while (i++<3)
x=(((x<<2)+(x>>1))>>1);
printf("%d", x);
return 0;
}

What is the output of the above code?

go-mockgate-1 numerical-answers programming-in-c programming output

Answer key ☟

8.6 Input Output Statement (1)

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” ?

main (int argc, char ∗ argv[ ])

{ int i ;

i = argv[1] + argv[2] + argv[3] ;

printf (“% d”, i) ;

(A) 123

(B) 6

(C) Error

(D) “123”
ugcnetcse-dec2009-paper2 programming-in-c input-output-statement

Answer key ☟

8.7 Operator Precedence (2)

8.7.1 Operator Precedence: UGC NET CSE | December 2010 | Part 2 | Question: 12

The value of the following expression is

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 ☟

8.8 Operators (2)

8.8.1 Operators: UGC NET CSE | December 2012 | Part 2 | Question: 45

What is the result of the following expression?


(1 & 2) + (3 & 4)

A. 1 B. 3 C. 2 D. 0
ugcnetcse-dec2012-paper2 programming-in-c operators

Answer key ☟

8.8.2 Operators: UGC NET CSE | June 2010 | Part 2 | Question: 11

The statement print


f (" % d", 10 ? 0 ? 5 : 1 : 12);
will print

A. B. C. D.
ugcnetcse-june2010-paper2 programming-in-c operators

Answer key ☟

8.9 Parameter Passing (1)

8.9.1 Parameter Passing: UGC NET CSE | December 2012 | Part 3 | Question: 44

The Default Parameter Passing Mechanism is called as

A. Call by Value B. Call by Reference


C. Call by Address D. Call by Name
ugcnetcse-dec2012-paper3 programming-in-c parameter-passing

Answer key ☟
8.10 Pointer Declaration (1)

8.10.1 Pointer Declaration: UGC NET CSE | September 2013 | Part 3 | Question: 51

Consider the following two function declarations:


int *f()
int (*f)()
Which of the following is true?

A. Both are identical


B. The first is a correct declaration and the second is wrong
C. Both are different ways of declaring pointer to a function
D. The first declaration is a function returning a pointer to an integer and the second is a pointer to function
returning integer

ugcnetcse-sep2013-paper3 programming-in-c pointer-declaration

Answer key ☟

8.11 Programming In C (12)

8.11.1 Programming In C: UGC NET CSE | August 2016 | Part 2 | Question: 11

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 ☟

8.11.2 Programming In C: UGC NET CSE | December 2010 | Part 2 | Question: 11

How many of the following declarations are correct ?


int ;
double void = ;
short array ;
char c = “\n”;

A. None B. One is correct


C. Two are correct D. All four are correct
ugcnetcse-dec2010-paper2 programming-in-c

Answer key ☟

8.11.3 Programming In C: UGC NET CSE | December 2010 | Part 2 | Question: 13

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

Consider the following program:


#include<stdio.h>
main()
{
int i, inp;
float x, term=1, sum=0;
scanf("%d %f", &inp, &x);
for(i=1;i<=inp;i++)
{
term=term*x/i;
sum=sum+term;
}
printf("Result=%f\n", sum);
}

The program computes the sum of which of the following series?

A. B.
C. D.
ugcnetcse-dec2015-paper2 programming-in-c

Answer key ☟

8.11.5 Programming In C: UGC NET CSE | December 2015 | Part 3 | Question: 43

A horn clause is

A. A clause in which no variables occur in the expression


B. A clause that has at least one negative literal
C. A disjunction of a number of literals
D. A clause that has atmost one positive literal

programming-in-c ugcnetcse-dec2015-paper3

Answer key ☟

8.11.6 Programming In C: UGC NET CSE | June 2007 | Part 2 | Question: 14

What is the output of the following program?


main()
{
printf(“%x”,-1>>4);
}

A. B. C. D.
ugcnetcse-june2007-paper2 programming-in-c

Answer key ☟

8.11.7 Programming In C: UGC NET CSE | June 2013 | Part 3 | Question: 51

Trace the error:


void main()
{
int *b, &a;
*b=20;
printf(“%d, %d”, a, *b)
}

A. No error B. Logical error C. Syntax error D. Semantic error


ugcnetcse-june2013-paper3 programming-in-c

Answer key ☟

8.11.8 Programming In C: UGC NET CSE | October 2020 | Part 2 | Question: 9

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 ☟

8.11.9 Programming In C: UGC NET CSE | September 2013 | Part 2 | Question: 33

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 ☟

8.11.10 Programming In C: UGC NET CSE | September 2013 | Part 2 | Question: 34

What is the output of the following program segment?


sum(n)
{
if (n<1) return n;
else return (n+sum(n-1));
}
main()
{
printf(“%d”, sum(5));
}

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

Consider the following program segment:


d=0;
for(i=1; i<31, ++i)
for (j=1; j < 31; ++j)
for (k=1; k < 31; ++k)
if((i+j+k%3)==0))
d=d+1;
printf(“%d”, d);

The output will be

A. 9000 B. 3000 C. 90 D. 2700


ugcnetsep2013ii programming-in-c

Answer key ☟

8.11.12 Programming In C: UGC NET CSE | September 2013 | Part 3 | Question: 53

What is the output of the following program?


#include<stdio.h>
main()
{
int a, b =0;
static int c[10]={1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
for (a=0; a<10; ++a)
int ((c[a]%2)==0) b+=c[a];
printf(“%d”, b);
}

A. 15 B. 25 C. 45 D. 20
ugcnetcse-sep2013-paper3 programming-in-c

Answer key ☟

8.12 Storage Classes In C (1)

8.12.1 Storage Classes In C: UGC NET CSE | January 2017 | Part 2 | Question: 13

Which of the following storage classes have global visibility in ?

A. Auto B. Extern C. Static D. Register


ugcnetjan2017ii programming-in-c storage-classes-in-c

Answer key ☟

8.13 Three Dimensional Array (1)

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)

9.0.1 UGC NET CSE | June 2013 | Part 2 | Question: 28

The time complexity to build a heap with a list of n numbers is

A. O(log n) B. O(n) C. O(n logn) D. O(n )


heap-sort ugcnetcse-june2013-paper2

Answer key ☟

9.0.2 UGC NET CSE | June 2009 | Part 2 | Question: 28

A binary tree is said to have heap property if the elements along any path :

A. from leaf to root are non-increasing


B. from leaf to root are non-decreasing
C. from root to leaf are non-decreasing
D. from root to leaf are non-increasing

ugcnetcse-june2009-paper2

Answer key ☟

9.0.3 UGC NET CSE | June 2009 | Part 2 | Question: 24

In a B tree of order m with p nodes the average number of splits is at most :

A. 1/(⌈m/2⌉−1) B. ⌈m/2⌉−1
C. 1/(m/2) D. None
ugcnetcse-june2009-paper2

Answer key ☟

9.0.4 UGC NET CSE | December 2004 | Part 2 | Question: 24

What operation is supported in constant time by the doubly linked list, but not by the singly linked list ?

A. Advance B. Backup C. First D. Retrieve

ugcnetcse-dec2004-paper2

Answer key ☟

9.0.5 UGC NET CSE | December 2004 | Part 2 | Question: 22

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 ☟

9.0.6 UGC NET CSE | December 2004 | Part 2 | Question: 21

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 ☟

9.0.7 UGC NET CSE | December 2004 | Part 2 | Question: 32

Which of the following is not collision resolution technique?

A. Hash addressing B. Chaining C. Both (A) and (B) D. Indexing


ugcnetcse-dec2004-paper2

Answer key ☟

9.0.8 UGC NET CSE | December 2006 | Part 2 | Question: 25

Which one of the following is a physical data structure ?

A. Array B. Linked lists C. Stacks D. Tables


ugcnetcse-dec2006-paper2

Answer key ☟

9.0.9 UGC NET CSE | December 2006 | Part 2 | Question: 24

The equivalent postfix expression for :

1.
2.
3.
4. None of these

ugcnetcse-dec2006-paper2

Answer key ☟

9.0.10 UGC NET CSE | December 2006 | Part 2 | Question: 11

When a function is recursively called, all automatic variables :

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 ☟

9.0.11 UGC NET CSE | December 2007 | Part 2 | Question: 23

The height of a binary tree with nodes, in the worst case is :

A. B.
C. D.
ugcnetcse-dec2007-paper2

Answer key ☟
9.0.12 UGC NET CSE | December 2007 | Part 2 | Question: 22

Which of the following data structure is used to implement recursion ?

A. Arrays B. Stacks C. Queues D. Linked lists

ugcnetcse-dec2007-paper2

Answer key ☟

9.0.13 UGC NET CSE | December 2007 | Part 2 | Question: 21

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 ☟

9.0.14 UGC NET CSE | December 2007 | Part 2 | Question: 12

Consider the following linked list :

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 ☟

9.1 AVL Tree (7)

9.1.1 AVL Tree: GATE CSE 1988 | Question: 7ii

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 ☟

9.1.2 AVL Tree: GATE CSE 2009 | Question: 37,ISRO-DEC2017-55

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 ☟

9.1.3 AVL Tree: GATE CSE 2020 | Question: 6

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 ☟

9.1.4 AVL Tree: GATE IT 2008 | Question: 12

Which of the following is TRUE?

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

gateit-2008 data-structures binary-search-tree easy avl-tree

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

A. Search and Insert Operations B. Search and Delete Operations


C. Insert and Delete Operations D. Search, Insert and Delete Operations
data-structures binary-tree ugcnetcse-dec2012-paper2 avl-tree

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 ☟

9.2 Array (13)

9.2.1 Array: GATE CSE 1993 | Question: 12

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

gate1993 data-structures array normal descriptive

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 ☟

9.2.3 Array: GATE CSE 1994 | Question: 25

An array contains integers in non-decreasing order, . Describe, using


Pascal like pseudo code, a linear time algorithm to find such that given integer ,
if such exist.
gate1994 data-structures array normal descriptive

Answer key ☟

9.2.4 Array: GATE CSE 1997 | Question: 17

An array contains positive integers in the locations . The following program


fragment prints the length of a shortest sequence of consecutive elements of ,
such that the sum of their values is , a given positive number. It prints ‘ ’ if no such sequence exists.
Complete the program by filling in the boxes. In each case use the simplest possible expression. Write only the
line number and the contents of the box.
begin
i:=1;j:=1;
sum := ◻
min:=n; finish:=false;
while not finish do
if ◻ then
if j=n then finish:=true
else
begin
j:=j+1;
sum:= ◻
end
else
begin
if(j-i) < min then min:=j-i;
sum:=sum –A[i];
i:=i+1;
end
writeln (min +1);
end.

gate1997 data-structures array normal descriptive

Answer key ☟

9.2.5 Array: GATE CSE 1998 | Question: 2.14

Let be a two dimensional array declared as follows:


A: array [1 …. 10] [1 ….. 15] of integer;

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 ☟

9.2.6 Array: GATE CSE 2000 | Question: 1.2

An array is defined as follows:


for all
The sum of the elements of the array is

A. B. C. D.
gatecse-2000 data-structures array easy

Answer key ☟

9.2.7 Array: GATE CSE 2000 | Question: 15

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;
}

A. Suppose we make the following sequence of calls:


; ; ;
After these sequence of calls, what is the value of count, and what do and
contain?
B. Complete the following statement "The first count elements of __________contain values i such that set
(_________________) has been called".
C. Show that if has not been called for some , then regardless of what contains, will
return false.

gatecse-2000 data-structures array easy descriptive

Answer key ☟

9.2.8 Array: GATE CSE 2005 | Question: 5

A program reads in integers in the range representing the scores of students. It


then prints the frequency of each score above . What would be the best way for to store the
frequencies?

A. An array of numbers B. An array of numbers


C. An array of numbers D. A dynamically allocated array of numbers
gatecse-2005 data-structures array easy

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];
}

The procedure is tested with the following four test cases.

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?

A. Only one B. Only two C. Only three D. All four


gatecse-2013 data-structures array normal

Answer key ☟

9.2.10 Array: GATE CSE 2013 | Question: 51

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];
}

The procedure is tested with the following four test cases.

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?

A. None B. only C. and only D. only


gatecse-2013 data-structures array normal

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;
}

Which one of the following statements about the function is CORRECT?

A. It will run into an infinite loop when is not in .


B. It is an implementation of binary search.
C. It will always find the maximum element in .
D. It will return − even when is present in .

gatecse-2014-set3 data-structures array easy

Answer key ☟

9.2.12 Array: GATE CSE 2015 Set 2 | Question: 31

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 ☟

9.2.13 Array: GATE CSE 2021 Set 1 | Question: 2

​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)

9.3.1 B Tree: UGC NET CSE | December 2012 | Part 2 | Question: 34

The maximum number of keys stored in a B-tree of order and depth is

A. B.
C. D.
ugcnetcse-dec2012-paper2 b-tree databases

Answer key ☟

9.4 B and Bplus Trees (1)

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 ☟

9.5 Binary Heap (37)

9.5.1 Binary Heap: GATE CSE 1990 | Question: 2-viii

Match the pairs in the following questions:

gate1990 match-the-following data-structures binary-heap

Answer key ☟

9.5.2 Binary Heap: GATE CSE 1996 | Question: 2.11

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 ☟

9.5.3 Binary Heap: GATE CSE 1999 | Question: 12

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 ☟

9.5.4 Binary Heap: GATE CSE 2001 | Question: 1.15

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 ☟

9.5.5 Binary Heap: GATE CSE 2003 | Question: 23

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 ☟

9.5.6 Binary Heap: GATE CSE 2004 | Question: 37

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 ☟

9.5.7 Binary Heap: GATE CSE 2005 | Question: 34

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 ☟

9.5.9 Binary Heap: GATE CSE 2006 | Question: 76

Statement for Linked Answer Questions 76 & 77:

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.

gatecse-2006 data-structures binary-heap normal

Answer key ☟

9.5.10 Binary Heap: GATE CSE 2006 | Question: 77

Statement for Linked Answer Questions 76 & 77:

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 ☟

9.5.11 Binary Heap: GATE CSE 2007 | Question: 47

Consider the process of inserting an element into a , where the is represented by


an . Suppose we perform a binary search on the path from the new leaf to the root to find the
position for the newly inserted element, the number of performed is:

A. B.
C. D.
gatecse-2007 data-structures binary-heap normal

Answer key ☟

9.5.12 Binary Heap: GATE CSE 2009 | Question: 59

Consider a binary max-heap implemented using an array.


Which one of the following array represents a binary max-heap?

A. B.
C. D.
gatecse-2009 data-structures binary-heap easy

Answer key ☟

9.5.13 Binary Heap: GATE CSE 2009 | Question: 60

Consider a binary max-heap implemented using an array.


What is the content of the array after two delete operations on

A. B.
C. D.
gatecse-2009 data-structures binary-heap normal

Answer key ☟

9.5.14 Binary Heap: GATE CSE 2011 | Question: 23

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 ☟

9.5.15 Binary Heap: GATE CSE 2014 Set 2 | Question: 12

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

Consider a max heap, represented by the array: .

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 ☟

9.5.17 Binary Heap: GATE CSE 2015 Set 2 | Question: 17

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 ☟

9.5.18 Binary Heap: GATE CSE 2015 Set 3 | Question: 19

Consider the following array of elements.

The minimum number of interchanges needed to convert it into a max-heap is

A. B. C. D.
gatecse-2015-set3 data-structures binary-heap easy

Answer key ☟

9.5.19 Binary Heap: GATE CSE 2016 Set 1 | Question: 37

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 ☟

9.5.20 Binary Heap: GATE CSE 2016 Set 2 | Question: 34

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 ☟

9.5.22 Binary Heap: GATE CSE 2019 | Question: 40

Consider the following statements:

I. The smallest element in a max-heap is always at a leaf node


II. The second largest element in a max-heap is always a child of a root node
III. A max-heap can be constructed from a binary search tree in time
IV. A binary search tree can be constructed from a max-heap in time

Which of the above statements are TRUE?

A. I, II and III B. I, II and IV C. I, III and IV D. II, III and IV


gatecse-2019 data-structures binary-heap 2-marks

Answer key ☟

9.5.23 Binary Heap: GATE CSE 2020 | Question: 47

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 ☟

9.5.24 Binary Heap: GATE CSE 2021 Set 2 | Question: 2

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 ☟

9.5.25 Binary Heap: GATE CSE 2023 | Question: 2

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 ☟

9.5.26 Binary Heap: GATE CSE 2024 | Set 1 | Question: 33

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 ☟

9.5.27 Binary Heap: GATE IT 2004 | Question: 53

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 ☟

9.5.28 Binary Heap: GATE IT 2006 | Question: 44

Which of the following sequences of array elements forms a heap?

A. B.
C. D.
gateit-2006 data-structures binary-heap easy

Answer key ☟

9.5.29 Binary Heap: GATE IT 2006 | Question: 72

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

What is the worst case time complexity in building a heap of elements?

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

In a heap, every element is ___________ of all the elements in the subtree.

A. maximum
B. minimum
C. sum
D. product

ugcnetcse-dec2008-paper2 data-structures binary-heap

Answer key ☟
9.5.32 Binary Heap: UGC NET CSE | January 2017 | Part 2 | Question: 23

Which of the following is a valid heap?

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

In any n-element heap, the number of nodes of height h is,

A. less than equal to B. greater than

C. greater than D. less than equal to

ugcnetcse-june2013-paper3 data-structures binary-heap

Answer key ☟

9.5.35 Binary Heap: UGC NET CSE | Junet 2015 | Part 3 | Question: 36

The number of nodes in height h in any n-element heap is

A. B.
C. ceil D. ceil

ugcnetcse-june2015-paper3 data-structures binary-heap

Answer key ☟

9.5.36 Binary Heap: UGC NET CSE | November 2017 | Part 3 | Question: 20

Heap allocation is required for languages that

A. Use dynamic scope rules B. Support dynamic data structures


C. Support recursion D. Support recursion and dynamic data
structures
ugcnetcse-nov2017-paper3 data-structures binary-heap

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 ☟

9.6 Binary Search Tree (45)

9.6.1 Binary Search Tree: GATE CSE 1996 | Question: 2.14

A binary search tree is generated by inserting in order the following integers:

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 ☟

9.6.2 Binary Search Tree: GATE CSE 1996 | Question: 4

A binary search tree is used to locate the number . Which of the following probe sequences are
possible and which are not? Explain.

gate1996 data-structures binary-search-tree normal descriptive

Answer key ☟

9.6.3 Binary Search Tree: GATE CSE 1997 | Question: 4.5

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 ☟

9.6.4 Binary Search Tree: GATE CSE 2001 | Question: 14

A. Insert the following keys one by one into a binary search tree in the order specified.

Show the final binary search tree after the insertions.


B. Draw the binary search tree after deleting from it.
C. Complete the statements , and in the following function so that the function computes the depth of
a binary tree rooted at .
typedef struct tnode{
int key;
struct tnode *left, *right;
} *Tree;

int depth (Tree t)


{
int x, y;
if (t == NULL) return 0;
x = depth (t -> left);
S1: ___________;

S2: if (x > y) return __________;

S3: else return _______;

gatecse-2001 data-structures binary-search-tree normal descriptive

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.

gatecse-2003 binary-search-tree easy isro2009

Answer key ☟

9.6.6 Binary Search Tree: GATE CSE 2003 | Question: 6

Let be the number of different binary search trees on distinct elements.


Then , where is

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.

I. Deletion of the smallest element


II. Insertion of an element if it is not already present in the set

Which of the following data structures can be used for this purpose?

A. A heap can be used but not a balanced binary search tree


B. A balanced binary search tree can be used but not a heap
C. Both balanced binary search tree and heap can be used
D. Neither balanced search tree nor heap can be used

gatecse-2003 data-structures easy isro2009 binary-search-tree

Answer key ☟

9.6.8 Binary Search Tree: GATE CSE 2004 | Question: 4, ISRO2009-26

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 ☟

9.6.9 Binary Search Tree: GATE CSE 2004 | Question: 85

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:

Then the worst-case time complexity of the program is?

A. B.
C. D.
gatecse-2004 binary-search-tree normal data-structures

Answer key ☟

9.6.10 Binary Search Tree: GATE CSE 2005 | Question: 33

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.

gatecse-2005 data-structures binary-search-tree easy

Answer key ☟

9.6.11 Binary Search Tree: GATE CSE 2005 | Question: 35

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 ☟

9.6.12 Binary Search Tree: GATE CSE 2008 | Question: 46

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

gatecse-2008 data-structures binary-search-tree normal

Answer key ☟

9.6.13 Binary Search Tree: GATE CSE 2012 | Question: 5

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 ☟

9.6.14 Binary Search Tree: GATE CSE 2013 | Question: 43

The preorder traversal sequence of a binary search tree is . Which one of


the following is the postorder traversal sequence of the same tree?

A. B.
C. D.
gatecse-2013 data-structures binary-search-tree normal

Answer key ☟

9.6.15 Binary Search Tree: GATE CSE 2013 | Question: 7

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 ☟

9.6.16 Binary Search Tree: GATE CSE 2014 Set 3 | Question: 39

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.

A. I and IV only B. II and III only C. II and IV only D. II only


gatecse-2015-set1 data-structures binary-search-tree easy

Answer key ☟

9.6.18 Binary Search Tree: GATE CSE 2015 Set 1 | Question: 23

What are the worst-case complexities of insertion and deletion of a key in a binary search tree?

A. for both insertion and deletion


B. for both insertion and deletion
C. for insertion and for deletion
D. for insertion and for deletion

gatecse-2015-set1 data-structures binary-search-tree easy

Answer key ☟

9.6.19 Binary Search Tree: GATE CSE 2015 Set 3 | Question: 13

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 ☟

9.6.20 Binary Search Tree: GATE CSE 2016 Set 2 | Question: 40

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 _________.

Note: The height of a tree with a single node is .


gatecse-2016-set2 data-structures binary-search-tree normal numerical-answers

Answer key ☟

9.6.21 Binary Search Tree: GATE CSE 2017 Set 1 | Question: 6

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 .

A. and respectively. B. and respectively.


C. and respectively. D. and respectively.
gatecse-2017-set1 data-structures binary-search-tree easy

Answer key ☟
9.6.22 Binary Search Tree: GATE CSE 2017 Set 2 | Question: 36

The pre-order traversal of a binary search tree is given by . Then the


post-order traversal of this tree is

A.
B.
C.
D.

gatecse-2017-set2 data-structures binary-search-tree

Answer key ☟

9.6.23 Binary Search Tree: GATE CSE 2020 | Question: 41

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 ☟

9.6.24 Binary Search Tree: GATE CSE 2020 | Question: 5

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 ☟

9.6.25 Binary Search Tree: GATE CSE 2021 Set 1 | Question: 10

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 ☟

9.6.26 Binary Search Tree: GATE CSE 2022 | Question: 18

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 ☟

9.6.27 Binary Search Tree: GATE CSE 2024 | Set 2 | Question: 29

​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?

A. Inorder traversal of can be determined from


B. Root node of can be determined from
C. Preorder traversal of can be determined from
D. Postorder traversal of can be determined from

gatecse2024-set2 binary-search-tree

Answer key ☟

9.6.28 Binary Search Tree: GATE IT 2005 | Question: 12

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 ☟

9.6.29 Binary Search Tree: GATE IT 2005 | Question: 55

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 ☟

9.6.30 Binary Search Tree: GATE IT 2006 | Question: 45

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 ☟

9.6.31 Binary Search Tree: GATE IT 2007 | Question: 29

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 ☟

9.6.33 Binary Search Tree: GATE IT 2008 | Question: 72

A Binary Search Tree (BST) stores values in the range to . Consider the following sequence of
keys.

I.
II.
III.
IV.

Which of the following statements is TRUE?

A. I, II and IV are inorder sequences of three different BSTs


B. I is a preorder sequence of some BST with as the root
C. II is an inorder sequence of some BST where is the root and is a leaf
D. IV is a postorder sequence of some BST with as the root

gateit-2008 data-structures binary-search-tree easy

Answer key ☟

9.6.34 Binary Search Tree: GATE IT 2008 | Question: 73

How many distinct BSTs can be constructed with distinct keys?

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

The preorder traversal sequence of a binary search tree is .


If the sum of the value of nodes whose index values (position from beginning) of preorder and postorder
traversals are same is then the value of is _________
go2025-mockgate-3 numerical-answers data-structures binary-search-tree

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)

go2025-mockgate-5 numerical-answers data-structures binary-search-tree 2-marks

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?

A. post – order B. in – order


C. pre – order D. linear – order
ugcnetcse-dec2005-paper2 data-structures binary-search-tree

Answer key ☟

9.6.42 Binary Search Tree: UGC NET CSE | July 2016 | Part 2 | Question: 21

Consider the following binary search tree:

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:

A. cannot have more than 37 nodes B. has exactly 37 nodes


C. has exactly 35 nodes D. cannot have more than 35 nodes
ugcnetcse-july2018-paper2 data-structures binary-search-tree

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

The expected optimal cost of the search is

A. B. C. D.
ugcnetcse-sep2013-paper3 data-structures binary-search-tree

Answer key ☟

9.7 Binary Tree (61)

9.7.1 Binary Tree: GATE CSE 1987 | Question: 2c

State whether the following statements are TRUE or FALSE:

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 ☟

9.7.2 Binary Tree: GATE CSE 1987 | Question: 2g

State whether the following statements are TRUE or FALSE:

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 ☟

9.7.3 Binary Tree: GATE CSE 1987 | Question: 7b

Construct a binary tree whose preorder traversal is

and inorder traversal is

gate1987 data-structures binary-tree descriptive

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 ☟

9.7.5 Binary Tree: GATE CSE 1988 | Question: 7iii

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.

gate1988 normal descriptive data-structures binary-tree

Answer key ☟

9.7.6 Binary Tree: GATE CSE 1989 | Question: 3-ixa

Which one of the following statements (s) is/are FALSE?

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.

normal gate1989 binary-tree multiple-selects

Answer key ☟

9.7.7 Binary Tree: GATE CSE 1990 | Question: 3-iv

The total external path length, of a binary tree with external nodes is, , where

is the path length of external node ),

A. always. B. always.
C. Equal to always. D. for some special trees.
gate1990 normal data-structures binary-tree multiple-selects

Answer key ☟

9.7.8 Binary Tree: GATE CSE 1991 | Question: 01,viii

The weighted external path length of the binary tree in figure is ______
gate1991 binary-tree data-structures normal numerical-answers

Answer key ☟

9.7.9 Binary Tree: GATE CSE 1991 | Question: 1,ix

If the binary tree in figure is traversed in inorder, then the order in which the nodes will be visited is
______

gate1991 binary-tree easy data-structures descriptive

Answer key ☟

9.7.10 Binary Tree: GATE CSE 1991 | Question: 14,a

Consider the binary tree in the figure below:

What structure is represented by the binary tree?

gate1991 data-structures binary-tree time-complexity easy descriptive

Answer key ☟

9.7.11 Binary Tree: GATE CSE 1991 | Question: 14,b

Consider the binary tree in the figure below:


Give different steps for deleting the node with key so that the structure is preserved.

gate1991 data-structures binary-tree normal descriptive

Answer key ☟

9.7.12 Binary Tree: GATE CSE 1991 | Question: 14,c

Consider the binary tree in the figure below:

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?

gate1991 normal data-structures binary-tree time-complexity descriptive

Answer key ☟

9.7.13 Binary Tree: GATE CSE 1993 | Question: 16

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 ☟

9.7.14 Binary Tree: GATE CSE 1994 | Question: 8

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 ☟

9.7.15 Binary Tree: GATE CSE 1995 | Question: 1.17

A binary tree has leaf nodes. The number of nodes of degree in is

A. B. C. D.
gate1995 data-structures binary-tree normal
Answer key ☟

9.7.16 Binary Tree: GATE CSE 1995 | Question: 6

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 ☟

9.7.17 Binary Tree: GATE CSE 1996 | Question: 1.14

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 ☟

9.7.18 Binary Tree: GATE CSE 1996 | Question: 1.15

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 ☟

9.7.19 Binary Tree: GATE CSE 1997 | Question: 16

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 ☟

9.7.20 Binary Tree: GATE CSE 1998 | Question: 20

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 ☟

9.7.21 Binary Tree: GATE CSE 2000 | Question: 1.14

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 ☟

9.7.22 Binary Tree: GATE CSE 2000 | Question: 2.16

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?

A. LASTIN = LASTPOST B. LASTIN = LASTPRE


C. LASTPRE = LASTPOST D. None of the above
gatecse-2000 data-structures binary-tree normal

Answer key ☟

9.7.23 Binary Tree: GATE CSE 2002 | Question: 2.12

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 ☟

9.7.24 Binary Tree: GATE CSE 2002 | Question: 6

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?

I. preorder and postorder


II. inorder and postorder
III. preorder and inorder
IV. level order and postorder

A. I only B. II, III C. III only D. IV only


gatecse-2004 data-structures binary-tree normal

Answer key ☟

9.7.26 Binary Tree: GATE CSE 2004 | Question: 43

Consider the following C program segment


struct CellNode{
struct CellNode *leftChild
int element;
struct CellNode *rightChild;
};

int Dosomething (struct CellNode *ptr)


{
int value = 0;
if(ptr != NULL)
{
if (ptr -> leftChild != NULL)
value = 1 + DoSomething (ptr -> leftChild);
if (ptr -> rightChild != NULL)
value = max(value, 1 + Dosomething (ptr -> rightChild));
}
return(value);
}

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 ☟

9.7.27 Binary Tree: GATE CSE 2006 | Question: 13

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 ☟

9.7.28 Binary Tree: GATE CSE 2007 | Question: 12

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.

gatecse-2007 data-structures binary-tree easy

Answer key ☟

9.7.29 Binary Tree: GATE CSE 2007 | Question: 13

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 ☟

9.7.30 Binary Tree: GATE CSE 2007 | Question: 39, UGCNET-June2015-II: 22

The inorder and preorder traversal of a binary tree are


and , respectively
The postorder traversal of the binary tree is:

A. B.
C. D.
gatecse-2007 data-structures binary-tree normal ugcnetcse-june2015-paper2

Answer key ☟

9.7.31 Binary Tree: GATE CSE 2007 | Question: 46

Consider the following C program segment where represents a node in a binary tree:
struct CellNode {
struct CellNode *leftChild;
int element;
struct CellNode *rightChild;
};

int Getvalue (struct CellNode *ptr) {


int value = 0;
if (ptr != NULL) {
if ((ptr->leftChild == NULL) &&
(ptr->rightChild == NULL))
value = 1;
else
value = value + GetValue(ptr->leftChild)
+ GetValue(ptr->rightChild);
}
return(value);
}

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 ☟

9.7.32 Binary Tree: GATE CSE 2010 | Question: 10

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 ☟

9.7.33 Binary Tree: GATE CSE 2011 | Question: 29

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 ☟

9.7.34 Binary Tree: GATE CSE 2012 | Question: 47

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

else{h1 = height(n -> left);


if(n -> right == NULL) return (1+h1);
else{h2 = height(n -> right);
return B2; // Box 2
}
}
}

The appropriate expressions for the two boxes B1 and B2 are:

A. B1: ; B2:
B. B1: ; B2:
C. B1: ; B2:
D. B1: ; B2:

gatecse-2012 data-structures binary-tree normal

Answer key ☟

9.7.35 Binary Tree: GATE CSE 2014 Set 1 | Question: 12

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 ☟

9.7.36 Binary Tree: GATE CSE 2015 Set 1 | Question: 25

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

A. and , respectively B. and , respectively


C. and , respectively D. and , respectively
gatecse-2015-set1 data-structures binary-tree easy

Answer key ☟

9.7.37 Binary Tree: GATE CSE 2015 Set 2 | Question: 10

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 ☟

9.7.38 Binary Tree: GATE CSE 2015 Set 3 | Question: 25

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 ☟

9.7.39 Binary Tree: GATE CSE 2016 Set 2 | Question: 36

Consider the following New-order strategy for traversing a binary tree:

Visit the root;


Visit the right subtree using New-order;
Visit the left subtree using New-order;

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.

gatecse-2016-set2 data-structures binary-tree normal

Answer key ☟

9.7.40 Binary Tree: GATE CSE 2018 | Question: 20

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 ☟

9.7.41 Binary Tree: GATE CSE 2019 | Question: 46

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 ☟

9.7.42 Binary Tree: GATE CSE 2021 Set 2 | Question: 16

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.

The value of is _____________


gatecse-2021-set2 numerical-answers data-structures binary-tree 1-mark

Answer key ☟

9.7.43 Binary Tree: GATE CSE 2023 | Question: 37

Consider the function and the binary tree shown.


typedef struct node {
int val;
struct node *left, *right;
} node;

int foo(node *p) {


int retval;
if (p == NULL)
return 0;
else {
retval = p->val + foo(p->left) + foo(p->right);
printf("%d ", retval);
return retval;
}
}

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 ☟

9.7.44 Binary Tree: GATE DS&AI 2024 | Question: 18

​Consider the following tree traversals on a full binary tree:

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 ☟

9.7.46 Binary Tree: GATE IT 2004 | Question: 54

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 ☟

9.7.47 Binary Tree: GATE IT 2005 | Question: 50

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 ☟

9.7.48 Binary Tree: GATE IT 2006 | Question: 71

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.

gateit-2006 data-structures binary-tree normal

Answer key ☟

9.7.49 Binary Tree: GATE IT 2006 | Question: 73

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 ☟

9.7.50 Binary Tree: GATE IT 2006 | Question: 9

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 ☟

9.7.51 Binary Tree: GATE IT 2008 | Question: 46

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.

Pick the true statement from the following.

A. I and II are preorder and inorder sequences, respectively


B. I and III are preorder and postorder sequences, respectively
C. II is the inorder sequence, but nothing more can be said about the other two sequences
D. II and III are the preorder and inorder sequences, respectively

gateit-2008 data-structures normal binary-tree

Answer key ☟

9.7.52 Binary Tree: GATE IT 2008 | Question: 76

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 ☟

9.7.53 Binary Tree: GATE IT 2008 | Question: 77

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

In a full binary tree of height k, there are ______ internal nodes .

A. 2k-1
B. 2k-1
C. 2k
D. 2k+1

ugcnetcse-june2009-paper2 data-structures binary-tree

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

A. Binary tree B. Binary search tree


C. Heaps D. None of the above
data-structures binary-tree ugcnetcse-june2012-paper2

Answer key ☟

9.7.58 Binary Tree: UGC NET CSE | June 2012 | Part 2 | Question: 8

A binary search tree is a binary tree in which

A. All items in the left subtree are less than root


B. All items in the right subtree are greater than or equal to root
C. Each subtree is itself a binary search tree
D. All of the above

ugcnetcse-june2012-paper2 data-structures binary-tree

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

The min. number of nodes in a binary tree of depth d (root at level 0) is

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

Consider the In-order and Post-order traversals of a tree as given below:


In-order: j e n k o p b f a c l g m d h i
Post-order: j n o p k e f b c l m g h I d a
The Pre-order traversal of the tree shall be

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 ☟

9.8 Cryptography (1)

9.8.1 Cryptography: UGC NET CSE | January 2017 | Part 2 | Question: 24

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 ☟

9.9 Data Structures (13)

9.9.1 Data Structures: GATE CSE 1997 | Question: 6.2

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

An Abstract Data Type (ADT) is:

A. same as an abstract class


B. a data type that cannot be instantiated
C. a data type for which only the operations defined on it can be used, but none else
D. all of the above

gatecse-2005 data-structures normal abstract-data-type

Answer key ☟

9.9.3 Data Structures: GATE CSE 2014 Set 1 | Question: 3

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

gatecse-2014-set1 data-structures graph-theory ambiguous

Answer key ☟

9.9.4 Data Structures: GATE CSE 2016 Set 1 | Question: 38

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 ☟

9.9.5 Data Structures: GATE DS&AI 2024 | Question: 22

The fundamental operations in a double-ended queue are:


insertFirst (e) - Insert a new element at the beginning of .
insertLast (e) - Insert a new element at the end of D.
removeFirst () - Remove and return the first element of .
removeLast () - Remove and return the last element of .

In an empty double-ended queue, the following operations are performed:


insertFirst (10)
insertLast (32)
a removeFirst ()
insertLast (28)
insertLast (17)
a removeFirst ()
removeLast ()

The value of is .

gate-ds-ai-2024 numerical-answers data-structures

Answer key ☟

9.9.6 Data Structures: GATE DS&AI 2024 | Question: 6

​Match the items in Column with the items in Column in the following table:

A.
B.
C.
D.

gate-ds-ai-2024 data-structures match-the-following

Answer key ☟

9.9.7 Data Structures: UGC NET CSE | December 2011 | Part 2 | Question: 1

Which of the following data structure is Non-linear type ?

A. Strings B. Lists C. Stacks D. None of the above


ugcnetcse-dec2011-paper2 data-structures

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.

A. 14, 14 B. 16, 14 C. 16, 4 D. 14, 4


ugcnetcse-july2016-paper2 data-structures graph-theory

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

Which of the following data structure is linear type?

A. Strings B. Lists C. Queues D. All of the above


data-structures ugcnetcse-june2012-paper2 easy

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?

A. Circular linked list B. Doubly linked list


C. Linked list D. Dequeue
ugcnetcse-june2013-paper3 data-structures

Answer key ☟

9.9.12 Data Structures: UGC NET CSE | October 2020 | Part 2 | Question: 63

Which of the following statements are true?

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

Choose the correct answer from the options given below:

A. and only B. and only


C. and only D. and only
ugcnetcse-oct2020-paper2 data-structures breadth-first-search

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 ☟

9.10 GO Mockgate 1 (3)

9.10.1 GO Mockgate 1: GATE Overflow | Mock GATE | Test 1 | Question: 13

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)

go-mockgate-1 numerical-answers data-structures tree

Answer key ☟

9.10.2 GO Mockgate 1: GATE Overflow | Mock GATE | Test 1 | Question: 43

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.

A. i, ii B. ii, iii C. iii, iv D. ii, iv


go-mockgate-1 data-structures stack
9.10.3 GO Mockgate 1: GATE Overflow | Mock GATE | Test 1 | Question: 49

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 Graph Algorithms (1)

9.11.1 Graph Algorithms: UGC NET CSE | July 2018 | Part 2 | Question: 24

Which of the following algorithms solves the single-source shortest paths?

A. Prim's algorithm B. Floys-Warshall algorithm


C. Johnson's algorithm D. Dijkstra's algorithm
ugcnetcse-july2018-paper2 data-structures graph-algorithms

Answer key ☟

9.12 Graph Connectivity (1)

9.12.1 Graph Connectivity: UGC NET CSE | September 2013 | Part 2 | Question: 20

Consider the following statements:

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

Which one of the above statements is/are true?

A. I and III B. II and III C. I and II D. All of the above


graph-connectivity ugcnetsep2013ii

Answer key ☟

9.13 Hashing (29)

9.13.1 Hashing: GATE CSE 1996 | Question: 1.13

An advantage of chained hash table (external hashing) over the open addressing scheme is

A. Worst case complexity of search operations is less B. Space used is less


C. Deletion is easier D. None of the above
gate1996 data-structures hashing normal

Answer key ☟

9.13.2 Hashing: GATE CSE 1996 | Question: 15

Insert the characters of the string into a hash table of size .


Use the hash function

and linear probing to resolve collisions.


A. Which insertions cause collisions?
B. Display the final hash table.

gate1996 data-structures hashing normal descriptive

Answer key ☟

9.13.3 Hashing: GATE CSE 1997 | Question: 12

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?

gate1997 data-structures hashing probability normal descriptive

Answer key ☟

9.13.4 Hashing: GATE CSE 2004 | Question: 7

Given the following input and the hash function


mod , which of the following statements are true?

I. hash to the same value


II. hash to the same value
III. All elements hash to the same value
IV. Each element hashes to a different value

A. I only B. II only C. I and II only D. III or IV


gatecse-2004 data-structures hashing easy

Answer key ☟

9.13.5 Hashing: GATE CSE 2007 | Question: 40

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 ☟

9.13.6 Hashing: GATE CSE 2009 | Question: 36

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.

gatecse-2009 data-structures hashing normal

Answer key ☟

9.13.7 Hashing: GATE CSE 2010 | Question: 52

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 ☟

9.13.8 Hashing: GATE CSE 2010 | Question: 53

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 ☟

9.13.9 Hashing: GATE CSE 2014 Set 1 | Question: 40

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

A. and B. and C. and D. and


gatecse-2014-set1 data-structures hashing normal

Answer key ☟

9.13.10 Hashing: GATE CSE 2014 Set 3 | Question: 40

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 ☟

9.13.11 Hashing: GATE CSE 2015 Set 2 | Question: 33

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 ☟

9.13.12 Hashing: GATE CSE 2015 Set 3 | Question: 17

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 ☟

9.13.13 Hashing: GATE DS&AI 2024 | Question: 11

​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 ☟

9.13.14 Hashing: GATE IT 2006 | Question: 20

Which of the following statement(s) is TRUE?

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 ☟

9.13.15 Hashing: GATE IT 2007 | Question: 28

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 ☟

9.13.16 Hashing: GATE IT 2008 | Question: 48

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 ☟

9.13.17 Hashing: UGC NET CSE | August 2016 | Part 3 | Question: 32

Consider a hash table of size , and the hash function for


. The key is mapped to location ______.

A. B. C. D.
ugcnetcse-aug2016-paper3 data-structures hashing
Answer key ☟

9.13.18 Hashing: UGC NET CSE | December 2005 | Part 2 | Question: 34

Which of the following is not collision Resolution Technique :

A. Hash addressing B. Chainning C. Indexing D. None of these


ugcnetcse-dec2005-paper2 data-structures hashing

Answer key ☟

9.13.19 Hashing: UGC NET CSE | December 2009 | Part 2 | Question: 25

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.

What will be the location of 11 ?

(A) 3

(B) 4

(C) 5

(D) 6
ugcnetcse-dec2009-paper2 data-structures hashing

Answer key ☟

9.13.20 Hashing: UGC NET CSE | December 2011 | Part 2 | Question: 6

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 ☟

9.13.21 Hashing: UGC NET CSE | December 2012 | Part 2 | Question: 26

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 ☟

9.13.22 Hashing: UGC NET CSE | December 2015 | Part 2 | Question: 35

The hash function used in double hashing is of the form:

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 ☟

9.13.24 Hashing: UGC NET CSE | July 2018 | Part 2 | Question: 70

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.

A. 3, 10, 1, 8, ___ , ____ , ____ B. 1, 3, 8, 10, ___, ___, ___


C. 1, ___, 3, ___, 8, ___, 10 D. 3, 10, ___, ____, 8, ___, ___
ugcnetcse-july2018-paper2 data-structures hashing

Answer key ☟

9.13.25 Hashing: UGC NET CSE | June 2010 | Part 2 | Question: 24

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 ☟

9.13.26 Hashing: UGC NET CSE | June 2014 | Part 2 | Question: 38

Searching for an element in the hash table requires time for the _________time, whereas for direct
addressing it holds for the _______ time.

A. worst-case, average B. worst-case, worst-case


C. average, worst-case D. best, average
ugcnetcse-june2014-paper2 hashing data-structures

Answer key ☟

9.13.27 Hashing: UGC NET CSE | June 2014 | Part 3 | Question: 64

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

A. Less than B. Less than


C. Greater than D. Greater than
ugcnetjune2014iii data-structures hashing

Answer key ☟

9.13.28 Hashing: UGC NET CSE | June 2023 | Part 2: 9

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 ☟

9.13.29 Hashing: UGC NET CSE | Junet 2015 | Part 3 | Question: 34

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 Heaps (4)

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

Consider the array which satisfies the max heap property.


After delete root operations the sum of leaves comes out to be where is an integer. The value of
is

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
________

go2025-mockgate-2 numerical-answers binary-search-tree heaps

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 ☟

9.15 Infix Prefix (7)

9.15.1 Infix Prefix: GATE CSE 1989 | Question: 4-ii

Compute the postfix equivalent of the following infix arithmetic expression

where represents exponentiation. Assume normal operator precedences.


gate1989 descriptive data-structures stack infix-prefix

Answer key ☟

9.15.2 Infix Prefix: GATE CSE 1997 | Question: 1.7

Which of the following is essential for converting an infix expression to the postfix form efficiently?

A. An operator stack B. An operand stack


C. An operand stack and an operator D. A parse tree
stack
gate1997 normal infix-prefix stack data-structures

Answer key ☟

9.15.3 Infix Prefix: GATE CSE 1998 | Question: 19b

Compute the post fix equivalent of the following expression

gate1998 stack infix-prefix descriptive

Answer key ☟

9.15.4 Infix Prefix: GATE CSE 2004 | Question: 38, ISRO2009-27

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.

gatecse-2004 stack isro2009 infix-prefix

Answer key ☟

9.15.5 Infix Prefix: GATE CSE 2007 | Question: 38, ISRO2016-27

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

Given the following prefix expression :

What is the value of the prefix expression ?

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

The postfix expression AB + CD -* can be evaluated using a

A. stack B. tree C. queue D. linked list


ugcnetcse-june2012-paper2 data-structures stack infix-prefix

Answer key ☟

9.16 Linear Probing (1)

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 ☟

9.17 Linked List (25)

9.17.1 Linked List: GATE CSE 1987 | Question: 1-xv

In a circular linked list organization, insertion of a record involves modification of

A. One pointer. B. Two pointers.


C. Multiple pointers. D. No pointer.
gate1987 data-structures linked-list

Answer key ☟

9.17.2 Linked List: GATE CSE 1987 | Question: 6a

A list of elements is commonly written as a sequence of elements enclosed in a pair of square


brackets. For example. is a list of three elements and is a nil list. Five functions are defined
below:

returns the first element of its argument list ;


returns the list obtained by removing the first element of the argument list ;
returns a list such that and .
if then
else ;
if then
else ,

What do the following compute?

a.
b.

gate1987 data-structures linked-list descriptive

Answer key ☟

9.17.3 Linked List: GATE CSE 1989 | Question: 4-xi

Express the following list in terms of a linked list structure suitable for internal representation.

gate1989 descriptive data-structures linked-list unsolved

Answer key ☟

9.17.4 Linked List: GATE CSE 1993 | Question: 13

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 ☟

9.17.5 Linked List: GATE CSE 1994 | Question: 1.17, UGCNET-Sep2013-II: 32

Linked lists are not suitable data structures for which one of the following problems?

A. Insertion sort B. Binary search


C. Radix sort D. Polynomial manipulation
gate1994 data-structures linked-list normal ugcnetsep2013ii

Answer key ☟

9.17.6 Linked List: GATE CSE 1995 | Question: 2.22

Which of the following statements is true?

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

A. I and II B. II and III C. I and IV D. I and III


gate1995 data-structures linked-list hashing

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?

A. Singly linked list B. Doubly linked list


C. Circular doubly linked list D. Array implementation of list
gate1997 data-structures linked-list easy

Answer key ☟

9.17.8 Linked List: GATE CSE 1997 | Question: 18

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;
}

Assume the list contains elements ( ) in the following questions.

a. How many times is the comparison in statement made?


b. What is the minimum and the maximum number of times statements marked get executed?
c. What is the significance of the value in the integer pointed to by when the function completes?

gate1997 data-structures linked-list normal descriptive

Answer key ☟

9.17.9 Linked List: GATE CSE 1998 | Question: 19a

Let be a pointer as shown in the figure in a single linked list.

What do the following assignment statements achieve?


q:= p -> next
p -> next:= q -> next
q -> next:=(q -> next) -> next
(p -> next) -> next:= q

gate1998 data-structures linked-list normal descriptive


Answer key ☟

9.17.10 Linked List: GATE CSE 1999 | Question: 11b

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 ☟

9.17.11 Linked List: GATE CSE 2002 | Question: 1.5

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 ☟

9.17.12 Linked List: GATE CSE 2003 | Question: 90

Consider the function defined below.


struct item {
int data;
struct item * next;
};
int f(struct item *p) {
return ((p == NULL) || (p->next == NULL)||
((p->data <= p ->next -> data) &&
f(p->next)));
}

For a given linked list , the function returns if and only if

A. the list is empty or has exactly one element


B. the elements in the list are sorted in non-decreasing order of data value
C. the elements in the list are sorted in non-increasing order of data value
D. not all elements in the list have the same data value

gatecse-2003 data-structures linked-list normal

Answer key ☟

9.17.13 Linked List: GATE CSE 2004 | Question: 36

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?

A. rear node B. front node


C. not possible with a single pointer D. node next to front
gatecse-2004 data-structures linked-list normal

Answer key ☟

9.17.14 Linked List: GATE CSE 2004 | Question: 40

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 ☟

9.17.15 Linked List: GATE CSE 2008 | Question: 62

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;
};

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.
gatecse-2008 data-structures linked-list normal

Answer key ☟

9.17.16 Linked List: GATE CSE 2010 | Question: 36

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;

Choose the correct alternative to replace the blank line.

A. ;
B. ;
C. ;
D. ;

gatecse-2010 data-structures linked-list normal

Answer key ☟

9.17.17 Linked List: GATE CSE 2016 Set 2 | Question: 15

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 ☟

9.17.18 Linked List: GATE CSE 2017 Set 1 | Question: 08

Consider the C code fragment given below.


typedef struct node {
int data;
node* next;
} node;

void join(node* m, node* n) {


node* p = n;
while(p->next != NULL) {
p = p->next;
}
p->next = m;
}

Assuming that m and n point to valid NULL-terminated linked lists, invocation of join will

A. append list m to the end of list n for all inputs.


B. either cause a null pointer dereference or append list m to the end of list n.
C. cause a null pointer dereference for all inputs.
D. append list n to the end of list m for all inputs.

gatecse-2017-set1 data-structures linked-list normal

Answer key ☟

9.17.19 Linked List: GATE CSE 2020 | Question: 16

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 ☟

9.17.20 Linked List: GATE CSE 2022 | Question: 5

Consider the problem of reversing a singly linked list. To take an example, given the linked list below,

the reversed linked list should look like

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.

gatecse-2022 data-structures linked-list 1-mark

Answer key ☟

9.17.21 Linked List: GATE CSE 2023 | Question: 3

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

A. is and is B. Both and are


C. Both and are D. is and is
gatecse-2023 data-structures linked-list 1-mark

Answer key ☟

9.17.22 Linked List: GATE IT 2004 | Question: 13

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 ☟

9.17.23 Linked List: GATE IT 2005 | Question: 54

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 ?

A. Insertion at the front of the linked list.


B. Insertion at the end of the linked list.
C. Deletion of the front node of the linked list.
D. Deletion of the last node of the linked list.

ugcnetcse-aug2016-paper2 data-structures linked-list

Answer key ☟

9.17.25 Linked List: UGC NET CSE | December 2009 | Part 2 | Question: 24

With regard to linked list, which of the following statement is false ?

(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 Max Heap (1)

9.18.1 Max Heap: UGC NET CSE | July 2016 | Part 3 | Question: 33

Which one of the following array represents a binary max-heap?

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 ☟

9.19 Minimum Spanning Tree (2)


9.19.1 Minimum Spanning Tree: UGC NET CSE | August 2016 | Part 3 | Question: 33

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

ugcnetcse-dec2008-paper2 data-structures minimum-spanning-tree

Answer key ☟

9.20 Priority (1)

9.20.1 Priority: UGC NET CSE | June 2013 | Part 2 | Question: 30

Consider the following statements for priority queue:


S1: It is a data structure in which the intrinsic ordering of the elements does determine the result of its
basic operations.
S2: The elements of a priority queue may be complex structures that are ordered on one or several fields

A. Both S1 and S2 are incorrect B. S1 is correct and S2 is incorrect


C. S1 is incorrect and S2 is correct D. Both S1 and S2 are correct
data-structures priority ugcnetcse-june2013-paper2

Answer key ☟

9.21 Priority Queue (4)

9.21.1 Priority Queue: GATE CSE 1997 | Question: 4.7

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

A. non-increasing order B. non-decreasing order


C. strictly increasing order D. strictly decreasing order
gate1997 data-structures stack normal priority-queue

Answer key ☟

9.21.2 Priority Queue: GATE CSE 2023 | Question: 36

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

A. Both and run in .


B. Both and run in .
C. runs in whereas runs in .
D. runs in whereas runs in .

gatecse-2023 data-structures priority-queue time-complexity binary-heap 2-marks

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

What is the most appropriate data structure to implement a priority queue ?

A. Heap B. Circular array C. Linked list D. Binary tree


ugcnetcse-june2010-paper2 data-structures priority-queue

Answer key ☟

9.22 Pseudocode (1)

9.22.1 Pseudocode: GATE Overflow Test Series | Mock GATE | Test 2 | Question: 45

Consider the following C program


int Dosomething(struct treenode *root , int sum)
{
if(root==NULL)
return sum;
sum = Dosomething(root -> left, sum);
sum = Dosomething(root -> right, sum);
if(root -> data%2)
sum/=root -> data;
else
sum*=root -> data;
return sum;
}

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 ☟

9.23 Queue (18)

9.23.1 Queue: GATE CSE 1992 | Question: 09

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 ☟

9.23.2 Queue: GATE CSE 1994 | Question: 26

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 ☟

9.23.3 Queue: GATE CSE 1996 | Question: 1.12

Consider the following statements:

i. First-in-first out types of computations are efficiently supported by STACKS.


ii. Implementing LISTS on linked lists is more efficient than implementing LISTS on an array for almost all
the basic LIST operations.
iii. Implementing QUEUES on a circular array is more efficient than implementing QUEUES on a linear array
with two indices.
iv. Last-in-first-out type of computations are efficiently supported by QUEUES.

A. and are true B. and are true


C. and are true D. and are true
gate1996 data-structures easy queue stack linked-list

Answer key ☟

9.23.4 Queue: GATE CSE 2001 | Question: 2.16

What is the minimum number of stacks of size required to implement a queue of size ?

A. One B. Two C. Three D. Four


gatecse-2001 data-structures easy stack queue

Answer key ☟

9.23.5 Queue: GATE CSE 2006 | Question: 49

An implementation of a queue , using two stacks and , is given below:


void insert (Q, x) {
push (S1, x);
}
void delete (Q) {
if (stack-empty(S2)) then
if (stack-empty(S1)) then {
print(“Q is empty”);
return;
}
else while (!(stack-empty(S1))){
x=pop(S1);
push(S2,x);
}
x=pop(S2);
}

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

gatecse-2006 data-structures queue stack normal

Answer key ☟

9.23.6 Queue: GATE CSE 2012 | Question: 35

Suppose a circular queue of capacity elements is implemented with an array of elements.


Assume that the insertion and deletion operations are carried out using REAR and FRONT as array
index variables, respectively. Initially, . The conditions to detect queue full and queue
empty are

A. f u l l : B. full:

empty: e m p t y :

C. full: D. full:
e m p t y :
empty:

gatecse-2012 data-structures queue normal


Answer key ☟

9.23.7 Queue: GATE CSE 2013 | Question: 44

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 ☟

9.23.8 Queue: GATE CSE 2016 Set 1 | Question: 10

A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed
efficiently. Which one of the following statements is CORRECT ( refers to the number of items in the
queue) ?

A. Both operations can be performed in time.


B. At most one operation can be performed in time but the worst case time for the operation will be
.
C. The worst case time complexity for both operations will be .
D. Worst case time complexity for both operations will be

gatecse-2016-set1 data-structures queue normal

Answer key ☟

9.23.9 Queue: GATE CSE 2016 Set 1 | Question: 41

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 _______.

gatecse-2016-set1 data-structures queue difficult numerical-answers

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?

I. Next pointer of front node points to the rear node.


II. Next pointer of rear node points to the front node.

A. (I) only. B. (II) only.


C. Both (I) and (II). D. Neither (I) nor (II).
gatecse-2017-set2 data-structures queue

Answer key ☟

9.23.11 Queue: GATE CSE 2018 | Question: 3

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 ☟

9.23.12 Queue: GATE CSE 2022 | Question: 52

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________________.

gatecse-2022 numerical-answers data-structures queue 2-marks

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:

i. — returns true if the queue is empty, false otherwise.


ii. — deletes the element at the front of the queue and returns its value.
iii. — inserts the integer i at the rear of the queue.

Consider the following function:


void f (queue Q) {
int i ;
if (!isEmpty(Q)) {
i = delete(Q);
f(Q);
insert(Q, i);
}
}

What operation is performed by the above function ?

A. Leaves the queue unchanged


B. Reverses the order of the elements in the queue
C. Deletes the element at the front of the queue and inserts it at the rear keeping the other elements in the
same order
D. Empties the queue

gateit-2007 data-structures queue normal

Answer key ☟

9.23.14 Queue: UGC NET CSE | August 2016 | Part 2 | Question: 24

Consider the following statements :


: A queue can be implemented using two stacks.
: A stack can be implemented using two queues.
Which of the following is correct ?

A. is correct and is not correct. B. is not correct and is correct.


C. Both and are correct. D. Both and are not correct.
ugcnetcse-aug2016-paper2 data-structures queue stack

Answer key ☟

9.23.15 Queue: UGC NET CSE | December 2005 | Part 2 | Question: 24

The initial configuration of quaue is . is at the front. To get the configuration how
many deletions and additions required:

A. deletions, additions B. deletions, additions


C. deletions, additions D. deletions, additions
ugcnetcse-dec2005-paper2 data-structures queue

Answer key ☟

9.23.16 Queue: UGC NET CSE | December 2009 | Part 2 | Question: 23

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

(D) A linked list


ugcnetcse-dec2009-paper2 data-structures queue

Answer key ☟

9.23.17 Queue: UGC NET CSE | June 2009 | Part 2 | Question: 26

Queue is a …………. list .

A. B.
C. D.
ugcnetcse-june2009-paper2 data-structures queue easy

Answer key ☟

9.23.18 Queue: UGC NET CSE | September 2013 | Part 2 | Question: 12

The efficient data structure to insert/delete a number in a stored set of number is

A. Queue B. Linked list C. Doubly linked list D. Binary tree


ugcnetsep2013ii data-structures queue linked-list

Answer key ☟

9.24 Quick Sort (1)

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

A. 0.5 Ig n B. 0.5 (1- ) Ig n


C. -(Ig n)/(Ig ) D. -(Ig n)/Ig (1- )
ugcnetsep2013ii data-structures sorting algorithms quick-sort

Answer key ☟

9.25 Radix Sort (2)

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 ☟

9.26 Recursion (1)

9.26.1 Recursion: UGC NET CSE | January 2017 | Part 3 | Question: 24

A recursive function , is defined as follows:

If the value of is then the value of is:

A. B. C. D.
ugcnetcse-jan2017-paper3 data-structures recursion

Answer key ☟

9.27 Relational Algebra (1)

9.27.1 Relational Algebra: UGC NET CSE | October 2020 | Part 2 | Question: 64

Match with
Let and

Choose the correct answer from the options given below:

A. B.
C. D.
ugcnetcse-oct2020-paper2 data-structures relational-algebra

Answer key ☟

9.28 Stack (29)

9.28.1 Stack: GATE CSE 1991 | Question: 03,vii

The following sequence of operations is performed on a stack:

The sequence of values popped out is

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 ☟

9.28.3 Stack: GATE CSE 1995 | Question: 2.21

The postfix expression for the infix expression is:

A. B.
C. D.
gate1995 data-structures stack easy

Answer key ☟

9.28.4 Stack: GATE CSE 2000 | Question: 13

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.

Show the contents of the stack


i. After evaluating
ii. After evaluating
iii. At the end of evaluation

gatecse-2000 data-structures stack normal descriptive

Answer key ☟

9.28.5 Stack: GATE CSE 2003 | Question: 64

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 ☟

9.28.6 Stack: GATE CSE 2004 | Question: 3

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 ☟

9.28.7 Stack: GATE CSE 2004 | Question: 5

The best data structure to check whether an arithmetic expression has balanced parentheses is a

A. queue B. stack C. tree D. list


gatecse-2004 data-structures easy stack

Answer key ☟

9.28.8 Stack: GATE CSE 2014 Set 2 | Question: 41

Suppose a stack implementation supports an instruction , which reverses the order of


elements on the stack, in addition to the and instructions. Which one of the following
statements is (with respect to this modified stack )?

A. A queue cannot be implemented using this stack.


B. A queue can be implemented where takes a single instruction and takes a
sequence of two instructions.
C. A queue can be implemented where takes a sequence of three instructions and
takes a single instruction.
D. A queue can be implemented where both and take a single instruction each.

gatecse-2014-set2 data-structures stack easy

Answer key ☟

9.28.9 Stack: GATE CSE 2015 Set 2 | Question: 38

Consider the C program below


#include <stdio.h>
int *A, stkTop;
int stkFunc (int opcode, int val)
{
static int size=0, stkTop=0;
switch (opcode) {
case -1: size = val; break;
case 0: if (stkTop < size ) A[stkTop++]=val; break;
default: if (stkTop) return A[--stkTop];
}
return -1;
}
int main()
{
int B[20]; A=B; stkTop = -1;
stkFunc (-1, 10);
stkFunc (0, 5);
stkFunc (0, 10);
printf ("%d\n", stkFunc(1, 0)+ stkFunc(1, 0));
}

The value printed by the above program is ________.

gatecse-2015-set2 data-structures stack easy numerical-answers

Answer key ☟
9.28.10 Stack: GATE CSE 2015 Set 3 | Question: 12

The result evaluating the postfix expression is

A. B. C. D.
gatecse-2015-set3 data-structures stack normal

Answer key ☟

9.28.11 Stack: GATE CSE 2021 Set 1 | Question: 21

Consider the following sequence of operations on an empty stack.

Consider the following sequence of operations on an empty queue.

The value of is ___________.


gatecse-2021-set1 data-structures stack easy numerical-answers 1-mark

Answer key ☟

9.28.12 Stack: GATE CSE 2023 | Question: 49

Consider a sequence of elements , and . The following


operations are performed on a stack and a queue both of which are initially empty.

I. the elements of from to in that order into .


II. the elements of from to in that order into .
III. an element from .
IV. an element from .
V. an element from .
VI. an element from .
VII. an element from and push the same element into .
VIII. Repeat operation three times.
IX. an element from .
X. an element from .

The top element of after executing the above operations is ______________.

gatecse-2023 data-structures stack numerical-answers 2-marks easy

Answer key ☟

9.28.13 Stack: GATE CSE 2024 | Set 2 | Question: 38

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:

PushToS2: Pop the top element from S1 and push it on S2.


PushToS1: Pop the top element from S2 and push it on S1.
GenerateOutput: Pop the top element from S1 and output it to the user.

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 ☟

9.28.14 Stack: GATE IT 2004 | Question: 52

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 ☟

9.28.15 Stack: GATE IT 2005 | Question: 13

A function defined on stacks of integers satisfies the following properties. and


for all stacks and integers .
If a stack contains the integers in order from bottom to top, what is ?

A. B. C. D.
gateit-2005 data-structures stack normal

Answer key ☟

9.28.16 Stack: GATE IT 2007 | Question: 32

Consider the following C program:


#include <stdio.h>
#define EOF -1
void push (int); /* push the argument on the stack */
int pop (void); /* pop the top of the stack */
void flagError ();
int main ()
{ int c, m, n, r;
while ((c = getchar ()) != EOF)
{ if (isdigit (c) )
push (c);
else if ((c == '+') || (c == '*'))
{ m = pop ();
n = pop ();
r = (c == '+') ? n + m : n*m;
push (r);
}
else if (c != ' ')
flagError ();
}
printf("% c", pop ());
}

What is the output of the program for the following input?

A. B. C. D.
gateit-2007 stack normal

Answer key ☟

9.28.17 Stack: UGC NET CSE | December 2006 | Part 2 | Question: 23

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 ☟

9.28.18 Stack: UGC NET CSE | December 2012 | Part 2 | Question: 40

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 ☟

9.28.19 Stack: UGC NET CSE | December 2012 | Part 3 | Question: 17

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 ☟

9.28.20 Stack: UGC NET CSE | December 2014 | Part 2 | Question: 08

How many PUSH and POP operations will be needed to evaluate the following expression by reverse
polish notation in a stack machine ?

A. PUSH and POP instructions B. PUSH and POP instructions


C. PUSH and POP instructions D. PUSH and POP instructions
ugcnetcse-dec2014-paper2 data-structures stack

Answer key ☟

9.28.21 Stack: UGC NET CSE | December 2014 | Part 2 | Question: 21

Convert the following infix expression into its equivalent post fix expression ^
A. ^ B. ^
C. ^ D. ^
ugcnetcse-dec2014-paper2 data-structures stack

Answer key ☟

9.28.22 Stack: UGC NET CSE | January 2017 | Part 2 | Question: 22

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 ☟

9.28.23 Stack: UGC NET CSE | July 2016 | Part 2 | Question: 22

Consider the following operations performed on a stack of size 5:


Push (a); Pop(); Push(b); Push(c); Pop();
Push(d); Pop(); Pop(); Push(e)
Which of the following statements is correct?

A. Underflow occurs B. Stack operations are performed


smoothly
C. Overflow occurs D. None of the above
ugcnetcse-july2016-paper2 data-structures stack easy

Answer key ☟

9.28.24 Stack: UGC NET CSE | July 2016 | Part 2 | Question: 24

Which of the following is not an inherent application of stack?

A. Implementation of recursion B. Evaluation of a postfix expression


C. Job scheduling D. Reverse a string
ugcnetcse-july2016-paper2 data-structures stack

Answer key ☟

9.28.25 Stack: UGC NET CSE | June 2005 | Part 2 | Question: 21

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 ☟

9.28.26 Stack: UGC NET CSE | June 2010 | Part 2 | Question: 21

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 ☟

9.28.27 Stack: UGC NET CSE | June 2012 | Part 3 | Question: 38

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 ☟

9.28.28 Stack: UGC NET CSE | June 2014 | Part 2 | Question: 40


What is the maximum number of parenthesis that will appear on the stack at any one time for parenthesis
expression given by

A.
B.
C.
D.

ugcnetcse-june2014-paper2 data-structures stack

Answer key ☟

9.28.29 Stack: UGC NET CSE | June 2014 | Part 3 | Question: 41

The reverse polish notation equivalent to the infix expression

A. B.
C. D.
ugcnetjune2014iii data-structures stack

Answer key ☟

9.29 Tree (28)

9.29.1 Tree: GATE CSE 1990 | Question: 13a

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.

gate1990 data-structures tree descriptive

Answer key ☟

9.29.2 Tree: GATE CSE 1992 | Question: 02,vii

A tree is such that

a. All internal nodes have either or children


b. All paths from root to the leaves have the same length

The number of internal nodes of a tree having leaves could be

A.
B.
C.
D.

gate1992 tree data-structures normal multiple-selects

Answer key ☟

9.29.3 Tree: GATE CSE 1994 | Question: 5

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 ☟

9.29.4 Tree: GATE CSE 1998 | Question: 1.24

Which of the following statements is false?

A. A tree with a nodes has edges


B. A labeled rooted binary tree can be uniquely constructed given its postorder and preorder traversal results.
C. A complete binary tree with internal nodes has leaves.
D. The maximum number of nodes in a binary tree of height h is

gate1998 data-structures tree multiple-selects normal

Answer key ☟

9.29.5 Tree: GATE CSE 1998 | Question: 2.11

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 ☟

9.29.6 Tree: GATE CSE 1998 | Question: 21

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 ?

gate1998 data-structures tree descriptive numerical-answers

Answer key ☟

9.29.7 Tree: GATE CSE 2002 | Question: 2.9

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 ☟

9.29.8 Tree: GATE CSE 2004 | Question: 6

Level order traversal of a rooted tree can be done by starting from the root and performing

A. preorder traversal B. in-order traversal


C. depth first search D. breadth first search
gatecse-2004 data-structures tree easy

Answer key ☟

9.29.9 Tree: GATE CSE 2005 | Question: 36

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 ☟

9.29.10 Tree: GATE CSE 2007 | Question: 43

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 ☟

9.29.11 Tree: GATE CSE 2014 Set 3 | Question: 12

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 ☟

9.29.12 Tree: GATE CSE 2014 Set 3 | Question: 41

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;
};

int DoSomething (treeptr tree)


{
int value=0;
if (tree != NULL) {
if (tree->leftMostChild == NULL)
value = 1;
else
value = DoSomething(tree->leftMostChild);
value = value + DoSomething(tree->rightSibling);
}
return(value);
}

When the pointer to the root of a tree is passed as the argument to , the value returned by the
function corresponds to the

A. number of internal nodes in the tree. B. height of the tree.


C. number of nodes without a right D. number of leaf nodes in the tree
sibling in the tree.
gatecse-2014-set3 data-structures tree normal

Answer key ☟

9.29.13 Tree: GATE CSE 2017 Set 1 | Question: 20

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 ☟

9.29.14 Tree: GATE CSE 2021 Set 1 | Question: 41

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?

A. Root of can never be an articulation point in .


B. Root of is an articulation point in if and only if it has or more children.
C. A leaf of can be an articulation point in .
D. If is an articulation point in such that is an ancestor of in and is a descendent of in , then all
paths from to in must pass through .

gatecse-2021-set1 multiple-selects data-structures tree 2-marks

Answer key ☟

9.29.15 Tree: GATE Overflow Test Series | Mock GATE | Test 1 | Question: 18

The preorder traversal sequence of a binary search tree is

Which one of the following is the postorder traversal of the same tree?

A.
B.
C.
D.

go2025-mockgate-1 data-structures tree

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 ☟

9.29.18 Tree: UGC NET CSE | December 2012 | Part 2 | Question: 16

In which tree, for every node the height of its left subtree and right subtree differ almost by 1?

A. Binary Search Tree B. AVL Tree


C. Threaded Binary Tree D. Complete Binary Tree
ugcnetcse-dec2012-paper2 data-structures tree binary-tree

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?

A. & B. & C. & D. &


ugcnetcse-dec2012-paper2 tree

Answer key ☟

9.29.20 Tree: UGC NET CSE | December 2014 | Part 2 | Question: 02

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 ☟

9.29.21 Tree: UGC NET CSE | December 2015 | Part 2 | Question: 5

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.

A. a and b B. b and c C. a and c D. a, b,and c


ugcnetcse-dec2015-paper2 data-structures tree

Answer key ☟

9.29.22 Tree: UGC NET CSE | July 2016 | Part 2 | Question: 23

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 ☟

9.29.23 Tree: UGC NET CSE | July 2018 | Part 2 | Question: 29

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 ☟

9.29.25 Tree: UGC NET CSE | June 2010 | Part 2 | Question: 32

Which of the following expression is represented by the parse tree ?

A. B. C. D.
ugcnetcse-june2010-paper2 data-structures tree

Answer key ☟

9.29.26 Tree: UGC NET CSE | June 2012 | Part 2 | Question: 13

Leaves of which of the following trees are at the same level?

A. Binary tree
B. B-tree
C. AVL-tree
D. Expression tree
ugcnetcse-june2012-paper2 programming tree

Answer key ☟

9.29.27 Tree: UGC NET CSE | June 2012 | Part 2 | Question: 50

To represent hierarchical relationship between elements, which data structure is suitable?

A. Dequeue B. Priority C. Tree D. All of the above


data-structures ugcnetcse-june2012-paper2 tree easy

Answer key ☟

9.29.28 Tree: UGC NET CSE | June 2012 | Part 3 | Question: 36

Number of binary trees formed with 5 nodes are

A. 32 B. 36 C. 120 D. 42
ugcnetcse-june2012-paper3 data-structures tree

Answer key ☟

9.30 Tree Traversal (1)


9.30.1 Tree Traversal: UGC NET CSE | December 2015 | Part 2 | Question: 38

The inorder traversal of the following tree is

A.
B.
C.
D.

ugcnetcse-dec2015-paper2 data-structures tree-traversal

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)

10.0.1 GATE DS&AI 2024 | Question: 31

​Consider the following Python function:


def :
if :

fun (D, s1+1, s2-1)

What does this Python function fun ( ) do? Select the ONE appropriate option below.

A. It finds the smallest element in from index to , both inclusive.


B. It performs a merge sort in-place on this list between indices and , both inclusive.
C. It reverses the list between indices and , both inclusive.
D. It swaps the elements in at indices and , and leaves the remaining elements unchanged.

gate-ds-ai-2024 programming

Answer key ☟

10.0.2 GATE DS&AI 2024 | Question: 28

​Consider the following Python code:


def count(child_dict, i):
if i not in child_dict.keys():
return 1
ans
for in child_dict[i]:
ans count (child_dict, j)
return ans
child_dict dict ()
child_dict
child_dict
child_dict
print (count (child_dict, 0 )

Which ONE of the following is the output of this code?

A. B. C. D.
gate-ds-ai-2024 programming

Answer key ☟

Answer Keys
10.0.1 C 10.0.2 D

You might also like