

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A series of questions and answers related to the stack data structure, covering fundamental concepts, operations, and applications. It includes true/false questions, fill-in-the-blanks, and problem-solving exercises to test understanding of stack principles. Topics covered range from basic stack operations like push and pop to more complex applications such as parentheses balancing and postfix expression evaluation. The material is suitable for students learning about data structures and algorithms, offering a practical way to reinforce their knowledge through self-assessment and review. The questions address both array-based and linked list implementations of stacks, providing a comprehensive overview of stack-related concepts and their practical implications in computer science.
Typology: Exams
1 / 3
This page cannot be seen from the preview
Don't miss anything!


T/F In the Java API class java.util.Stack
Is the following a balanced expression (a+b{[d-e]}) +(d/e) - Correct Answers -Yes The storage policy used by stack is what - Correct Answers -LIFO What does LIFO mean - Correct Answers -Last in first out The value of the following expression is 573 10++4/ - Correct Answers - What will an array look like after Stack s = new Stack(); S.push(1); S.push(2); S.push(3); System.out.println(s.pop()); - Correct Answers -0|1| 1|2| Top is pointed at 1s index Updates top What will a linked list look like after Stack s = new Stack(); S.push(1); S.push(2); S.push(3); System.out.println(s.pop()); - Correct Answers -|2| -> |1| Top is at 2 Update variable of head The operation for adding an entry to a stack is called - Correct Answers -Push The operation for removing an element from a stack is called - Correct Answers -Pop What stack operation could result in stack overflow - Correct Answers -Push Which stack operation could result in stack underflow - Correct Answers -Pop What applications may use a stack - Correct Answers -Parentheses balancing, matching HTML tags and evaluating postfix expressions What is written to the screen for the input "carpets" Declare a stack of characters While(more characters to read) { Read and push characters on stack; } While(stack is not empty)