Skip to content

Tag Archives: GATE-GATE-CS-2004

Consider the grammar with the following translation rules and E as the start symbol. E → E1 # T { E.value = E1.value * T.value… Read More
Suppose we run Dijkstra’s single source shortest-path algorithm on the following edge weighted directed graph with vertex P as the source. In what order do… Read More
Consider the following C program segment struct CellNode {   struct CelINode *leftchild;   int element;   struct CelINode *rightChild; }    int Dosomething(struct CelINode *ptr) {     int… Read More
What does the following algorithm approximate? x = m; y = 1; while (x - y > e) {     x = (x + y)/2;     y… Read More
Consider the following C program main() {     int x, y, m, n;     scanf ("%d %d", &x, &y);     /* Assume x > 0 and y >… Read More
Suppose each set is represented as a linked list with elements in arbitrary order. Which of the operations among union, intersection, membership, cardinality will be… Read More
Two matrices M1 and M2 are to be stored in arrays A and B respectively. Each array can be stored either in row-major or column-major… Read More
Assume that the operators +, -, × are left associative and ^ is right associative. The order of precedence (from highest to lowest) is ^,… Read More
The elements 32, 15, 20, 30, 12, 25, 16 are inserted one by one in the given order into a Max Heap. The resultant Max… Read More
A circularly linked list is used to represent a Queue. A single variable p is used to access the Queue. To which node should p… Read More
Consider the label sequences obtained by the following pairs of traversals on a labeled binary tree. Which of these pairs identify a tree uniquely ?… Read More
It is desired to design an object-oriented employee record system for a company. Each employee has a name, unique id and salary. Employees belong to… Read More
Consider the following C program segment: char p[20]; char *s = "string"; int length = strlen(s); int i; for (i = 0; i < length;… Read More
Consider the following program fragment for reversing the digits in a given integer to obtain a new integer. Let n = D1D2…Dm int n, rev;… Read More
Consider the following C function: int f(int n) {    static int i = 1;    if (n >= 5)       return n;    n = n+i;    i++;    return… Read More