Consider the following pseudocode that uses a stack declare a stack of characters
while ( there are more characters in the word to read )
{
read a character
push the character on the stack
}
while ( the stack is not empty )
{
pop a character off the stack write the character to the screen
}
What is the output for input “gate2022”?
gate2022
2202etag2
gate2022gate2022
2202etag
Boost your performance with adaptive practice tests
Practice every concept in the syllabus
Compare your speed and accuracy with your peers
Download the app and practice on the go