What is the outputs of the following pseudocode where num1 n
Solution
num1 = 5
num2 = 1
num3 = 4
aQueue.enqueue(num2) //Will add 1 to the queue. So, now the queue will hold the value 1.
aQueue.enqueue(num3) //Will add 4 to the queue. So, now the queue will hold the values 1 4.
qQueue.dequeue() //Will remove the first element from the queue. So, now the queue will hold the value 4.
aQueue.enqueue(num1 - num2) //Will add 5-1 = 4 to the queue. So, now the queue will hold the values 4 4.
aQueue.dequeue(num1) //Will remove the first element from the queue, and store in num1. So, now the queue will hold the values 4. And num1 is updated to 4.
aQueue.dequeue(num2) //Will remove the first element from the queue, and store in num2. So, now the queue will be empty. And num2 is updated to 4.
Now, printing num2 followed by num1 followed by num3 will print the line 4 4 4 as output.
