GATE CS question library
Practise GATE CS Computer Science previous year questions free. Browse by subject, syllabus topic, year and question type, with answers and available solutions.
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
Consider the process of inserting an element into a , where the is represented by an array. 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 comparisons performed is:
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 …
What is the of the following recursive function? int DoSomething (int n) { if (n <= 2) return 1; else return (DoSomething (floor (sqrt(n))) + n); }
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 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 ?
Consider the following C function: int f(int n) { static int r = 0; if (n <= 0) return 1; if (n > 3) { r = n; return f(n-2) + 2; } return f(n-1) + r; } What is the value of ?
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.
The inorder and preorder traversal of a binary tree are and , respectively The postorder traversal of the binary tree is:
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
Consider a pipelined processor with the following four stages: IF: Instruction Fetch ID: Instruction Decode and Operand Fetch EX: Execute WB: Write Back The IF, ID and WB stages take one clock cycle each to complete the operation. The number of clock cycles for the EX stage depends on the instruction. The ADD and SUB instructions need clock cycle and …
The control signal functions of a - binary counter are given below (where is “don’t care”): …
In a look-ahead carry generator, the carry generate function and the carry propagate function for inputs and are given by: The expressions for the sum bit and the carry bit of the look ahead carry adder are given by: …
Suppose only one multiplexer and one inverter are allowed to be used to implement any Boolean function of variables. What is the minimum size of the multiplexer needed?
Define the connective for the Boolean variables and as: Let . Consider the following expressions , and . Which of the following is TRUE?
Let . Which of the following expressions are NOT equivalent to ? P: Q: R: S:
The language over the alphabet is:
Which of the following languages is regular?
A minimum state deterministic finite automaton accepting the language number of s and s in are divisible by and , respectively has
Consider the set of (column) vectors defined by.Which of the following is TRUE?
Consider the set Consider the following partitions on . Let be the partial order on the set of partitions …
