## Question 1 What is the output for the following series of commands? ```text push(10), push(20), pop(), peek() ``` ### Options 1. NULL, NULL, 20, 10 Incorrect ---------------------------- 2. NULL, NULL, 10, 20 Correct The `push()` function does not return anything. After pushing both elements, 10 is at the front of the queue, which is why 10 is popped before 20. After popping, 20 is at the front of the queue, which is returned when we use the `peek()` function. ---------------------------- 3. 10, 20, NULL, NULL Incorrect ---------------------------- 4. 10, 20, 10, 20 Incorrect ---------------------------- --------------------------------------------- ## Question 2 What is the output for the following series of commands? ```text push(10), pop(), pop(), empty() ``` ### Options 1. 10, 10, NULL, TRUE Incorrect ---------------------------- 2. NULL, 10, NULL, FALSE Incorrect ---------------------------- 3. NULL, 10, NULL, TRUE Correct The `push()` function does not return anything. 10 is at the front of the queue. The first pop will return 10, emptying the queue. The second pop returns NULL because the queue is empty. The `empty()` function will return TRUE. ---------------------------- 4. NULL, NULL, 10, TRUE Incorrect ---------------------------- --------------------------------------------- ## Question 3 What is the output for the following series of commands? ```text push(10), push(20), push(30), pop(), peek(), pop() ``` ### Options 1. NULL, NULL, NULL, 30, 20, 20 Incorrect ---------------------------- 2. NULL, NULL, NULL, 30, 20, 10 Incorrect ---------------------------- 3. NULL, NULL, NULL, 10, 20, 30 Incorrect ---------------------------- 4. NULL, NULL, NULL, 10, 20, 20 Correct The `push()` function does not return anything. The first pop will remove and return the 10. The `peek()` function only returns 20 but doesn't remove it from the queue. Since 10 is at the front of the queue, the second pop removes and returns 20. ---------------------------- ---------------------------------------------