Skip to content

GATE CS Programming and Data Structures questions

Practise Programming and Data Structures questions for GATE CS. Explore official PYQs and original subject-wise quizzes, check answers and view available solutions. Free, no sign-in.

Subject, topic, year and type filter the full library. Match any choice within a filter, and all selected filter categories. Search, source and sort apply to this page.

20 on this page
Official PYQ2000Programming and Data StructuresProgramming in CMCQ · 1 mark
The following C declarations: struct node { int i: float j; }; struct node *s[10]; define s to be:
Official PYQ2000Programming and Data StructuresArrays, Stacks and QueuesMCQ · 1 mark
An n×nn \times n array vv is defined as follows: v[i,j]=i−jv\left[i,j\right] = i - j for all i,j,i≤n,1≤j≤ni, j, i \leq n, 1 \leq j \leq n The sum of the elements of the array vv is
Official PYQ1999Programming and Data StructuresProgramming in CMCQ · 1 mark
Consider the following program in a language that has dynamic scooping: var x: real; procedure show: begin print(x);end; procedure small; var x: real; begin x: = 0.125; show; end; begin x:=0.25 show; small end. Then the output of the program is:
Official PYQ1999Programming and Data StructuresProgramming in CMCQ · 1 mark
Given the programming constructs assignment for loops where the loop parameter cannot be changed within the loop if-then-else forward go to arbitrary go to non-recursive procedure call recursive procedure/function call repeat loop, which constructs will you not include in a programming language such that it should be possible to program the terminates (i.e., …
Official PYQ1998Programming and Data StructuresArrays, Stacks and QueuesMCQ · 1 mark
Let AA 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 100100, what is the address of the element A[i][j]A[i][j]?
Official PYQ1998Programming and Data StructuresProgramming in CMCQ · 1 mark
What is the result of the following program? program side-effect (input, output); var x, result: integer; function f (var x:integer):integer; begin x:x+1;f:=x; end begin x:=5; result:=f(x)*f(x); writeln(result); end
Official PYQ1998Programming and Data StructuresTreesMCQ · 1 mark
A complete nn-ary tree is one in which every node has 00 or nn sons. If xx is the number of internal nodes of a complete nn-ary tree, the number of leaves in it is given by
Official PYQ1998Programming and Data StructuresTreesMSQ · 1 mark
Which of the following statements is false?
Official PYQ1997Programming and Data StructuresGraphsMCQ · 1 mark
Let GG be the graph with 100100 vertices numbered 11 to 100100. Two vertices ii and jj are adjacent if ∣i−j∣=8\vert i-j \vert =8 or ∣i−j∣=12\vert i-j \vert=12. The number of connected components in GG is
Official PYQ1997Programming and Data StructuresArrays, Stacks and QueuesMCQ · 1 mark
A priority queue QQ is used to implement a stack that stores characters. PUSH (C) is implemented as INSERT (Q,C,K)(Q, C, K) where KK is an appropriate integer key chosen by the implementation. POP is implemented as DELETEMIN(Q)(Q). For a sequence of operations, the keys chosen are in
Official PYQ1997Programming and Data StructuresBinary Search TreesMCQ · 1 mark
A binary search tree contains the value 1,2,3,4,5,6,7,81, 2, 3, 4, 5, 6, 7, 8. The tree is traversed in pre-order and the values are printed out. Which of the following sequences is a valid output?
Official PYQ1997Programming and Data StructuresArrays, Stacks and QueuesMCQ · 1 mark
Which of the following is essential for converting an infix expression to the postfix form efficiently?
Official PYQ1997Programming and Data StructuresLinked ListsMCQ · 1 mark
The concatenation of two lists is to be performed on O(1)O(1) time. Which of the following implementations of a list should be used?
Official PYQ1996Programming and Data StructuresBinary Search TreesMCQ · 1 mark
A binary search tree is generated by inserting in order the following integers: 50,15,62,5,20,58,91,3,8,37,60,2450, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24 The number of nodes in the left subtree and right subtree of the root respectively is
Official PYQ1996Programming and Data StructuresBinary HeapsMCQ · 1 mark
The minimum number of interchanges needed to convert the array into a max-heap is 89,19,40,17,12,10,2,5,7,11,6,9,7089, 19, 40, 17, 12, 10, 2, 5, 7, 11, 6, 9, 70
Official PYQ1996Programming and Data StructuresTreesMCQ · 1 mark
Which of the following sequences denotes the post order traversal sequence of the below tree?
Official PYQ1996Programming and Data StructuresTreesMCQ · 1 mark
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”?
Official PYQ1996Programming and Data StructuresArrays, Stacks and QueuesMCQ · 1 mark
An advantage of chained hash table (external hashing) over the open addressing scheme is
Official PYQ1996Programming and Data StructuresArrays, Stacks and QueuesMCQ · 1 mark
Consider the following statements: First-in-first out types of computations are efficiently supported by STACKS. Implementing LISTS on linked lists is more efficient than implementing LISTS on an array for almost all the basic LIST operations. Implementing QUEUES on a circular array is more efficient than implementing QUEUES on a linear array with two …
Official PYQ1995Programming and Data StructuresLinked ListsMCQ · 1 mark
Which of the following statements is true? As the number of entries in a hash table increases, the number of collisions increases. Recursive programs are efficient The worst case complexity for Quicksort is O(n2)O(n^2) Binary search using a linear linked list is efficient