1. >GATE CS
  2. >Programming and Data Structures
Found 2  QuestionsSET DEFAULT
Selected Filters
    GATE CS Programming and Data Structures Stacks
Exams
Years
Subjects
Topics

List of top Programming and Data Structures Questions on Stacks asked in GATE CS

Consider the following C code:

int main() {
    sum = 0;
    for (n = 1; n < 3; n++) {
        n++;
        sum += g(f(n));
    }
    printf("%d", sum);
}

int g(n) {
    return 10 + n;
}

int f(n) {
    return g(2 * n);
}
  

What is the output?

  • GATE CS - 2025
  • GATE CS
  • Programming and Data Structures
  • Stacks
Consider the following sequence of operations on an empty stack and an empty queue.
Stack:
push(54); push(52); pop(); push(55); push(62); s = pop();
Queue:
enqueue(21); enqueue(24); dequeue(); enqueue(28); enqueue(32); q = dequeue();
The value of \( s + q \) is \(\underline{\hspace{2cm}}\).
  • GATE CS - 2021
  • GATE CS
  • Programming and Data Structures
  • Stacks