Skills101
← All practice quizzes

Quiz: Stack and Queue in C

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Build the two most used data structures in C from scratch. A stack with an array and with a linked list, a circular queue that reuses free space, overflow and underflow checks, and a bracket-matching program.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    Which order does a stack follow?

  2. Question 2

    What does this print?

    #include <stdio.h>
    int s[10], top = -1;
    void push(int x) { s[++top] = x; }
    int pop(void) { return s[top--]; }
    int main(void) {
        push(1); push(2); push(3);
        int a = pop();
        push(4);
        int b = pop();
        int c = pop();
        printf("%d %d %d", a, b, c);
        return 0;
    }
    
  3. Question 3

    In an array stack with top starting at -1 and size MAX, when is the stack full?

  4. Question 4

    What is underflow?

  5. Question 5

    In a circular queue of size 5, rear is 4. Where does the next enqueue go (if not full)?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →