Multiple choice technology mainframe

"MAKEBUF" Push ‘TCS’ Push ‘TATA’ Push ‘CONSULTANCY’ Push ‘SERVICES’ "QELEM" "DROPBUF" "QELEM" What will be returned by "QELEM" in step 6 and 8 ?

  1. 4,4

  2. 4,0

  3. 3,3

  4. 3,0

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Tracing the operations: MAKEBUF then 4 PUSH operations (QELEM returns 4), then DROPBUF clears the buffer (QELEM returns 0). Step 6 is the first QELEM after all pushes - returns 4. Step 8 is QELEM after DROPBUF - returns 0 because the buffer was emptied. So the answer is 4,0.