DATA STRUCTURES STACK EXAM
QUESTIONS AND ANSWERS
T/F In the Java API class java.util.Stack<E> implements a stack; there is no Stack
interface - Correct Answers -True
T/F an array can be used for storage of a stack instead of using a Java ArrayList class -
Correct Answers –True
A(n) _ is a data structure in which objects are inserted into and removed from the same
end - Correct Answers -Stack
A(n) _ is a string that reads the same in either direction: left to right or right to left -
Correct Answers -Palindrome
In terms of efficiency all stack operations using an array structure are - Correct Answers
-O(1)
T/F the statement Stack<String> myStack = new Stack<String>(); defines a stack that
holds String objects - Correct Answers -True
T/F there is only one stack interface in Java - Correct Answers -False
The value of the following postfix expression is 12+4*3+ - Correct Answers -15
Rewrite the following statement as an infix expression 56* 10- - Correct Answers -5*6-
10
A(n) _ is a data structure with the property that only the top element is accessible -
Correct Answers -Stack
In a(n) _ the top element is the data value that was most recently stored - Correct
Answers -Stack
What are the methods that make up the StackInt interface - Correct Answers -Push(),
pop(), peek(), empty()
What is the value of the following postfix expression 561+* - Correct Answers -35
Is the following a balanced expression (a+b*{[d-e]}) +(d/e) - Correct Answers -Yes
QUESTIONS AND ANSWERS
T/F In the Java API class java.util.Stack<E> implements a stack; there is no Stack
interface - Correct Answers -True
T/F an array can be used for storage of a stack instead of using a Java ArrayList class -
Correct Answers –True
A(n) _ is a data structure in which objects are inserted into and removed from the same
end - Correct Answers -Stack
A(n) _ is a string that reads the same in either direction: left to right or right to left -
Correct Answers -Palindrome
In terms of efficiency all stack operations using an array structure are - Correct Answers
-O(1)
T/F the statement Stack<String> myStack = new Stack<String>(); defines a stack that
holds String objects - Correct Answers -True
T/F there is only one stack interface in Java - Correct Answers -False
The value of the following postfix expression is 12+4*3+ - Correct Answers -15
Rewrite the following statement as an infix expression 56* 10- - Correct Answers -5*6-
10
A(n) _ is a data structure with the property that only the top element is accessible -
Correct Answers -Stack
In a(n) _ the top element is the data value that was most recently stored - Correct
Answers -Stack
What are the methods that make up the StackInt interface - Correct Answers -Push(),
pop(), peek(), empty()
What is the value of the following postfix expression 561+* - Correct Answers -35
Is the following a balanced expression (a+b*{[d-e]}) +(d/e) - Correct Answers -Yes