Bird
0
0
DSA Cprogramming~10 mins

Enqueue Operation in DSA C - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add an element at the rear of the queue.

DSA C
queue->rear = (queue->rear + 1) % queue->capacity;
queue->array[queue->rear] = [1];
Drag options to blanks, or click blank then click option'
Acapacity
Brear
Citem
Dfront
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'rear' or 'front' instead of the item variable.
Assigning to the wrong index in the array.
2fill in blank
medium

Complete the code to check if the queue is full before enqueue.

DSA C
if ((queue->rear + 1) % queue->capacity == [1]) {
    return; // Queue is full
}
Drag options to blanks, or click blank then click option'
Aqueue->front
Bqueue->rear
Cqueue->capacity
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Comparing with rear or capacity instead of front.
Using incorrect modulo logic.
3fill in blank
hard

Fix the error in updating the rear index after enqueue.

DSA C
queue->rear = (queue->rear [1] 1) % queue->capacity;
Drag options to blanks, or click blank then click option'
A-
B+
C*
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using subtraction or multiplication instead of addition.
Forgetting modulo operation.
4fill in blank
hard

Fill both blanks to correctly enqueue an item and update size.

DSA C
queue->rear = (queue->rear [1] 1) % queue->capacity;
queue->array[queue->rear] = [2];
queue->size++;
Drag options to blanks, or click blank then click option'
A+
Bitem
C-
Drear
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' instead of '+' for rear update.
Assigning wrong variable to array.
5fill in blank
hard

Fill all three blanks to enqueue an item safely with full check.

DSA C
if ((queue->rear [1] 1) % queue->capacity == queue->front) {
    return; // Queue full
}
queue->rear = (queue->rear [2] 1) % queue->capacity;
queue->array[queue->rear] = [3];
queue->size++;
Drag options to blanks, or click blank then click option'
A+
B-
Citem
Dfront
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' instead of '+' in condition or update.
Assigning wrong variable to array.