C-Dynamic Memory Allocation and Data Structure
C-Dynamic Memory Allocation and Data Structure
81. The operation for removing an entry from a stack is traditionally called:
- Delete
- Peek
- Pop
- Remove
82. Which of the following applications may use a stack ?
- a parentheses balancing program.
- Keeping track of local variables at run time.
- syntax analyzer for a compiler
- All of the above.
83. Which of the following stack operations could result in stack undeflow/
- is_empty
- Pop
- Push
- Two or more of the above answers
84. Consider the well formed strings : (( )) (( )) ( ) ) and not well formed strings: ( ( ). Which of the data structure can be implemented to solve the problem:
- Stacks
- Queue
- Trees
- Graph
85. Consider the following pseudocode:
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)
{
write thestack's top character to the screen
pop a character off the stack
}
What is written to the screen for the imput "carpets"?
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)
{
write thestack's top character to the screen
pop a character off the stack
}
What is written to the screen for the imput "carpets"?
- serc
- carpets
- steprac
- ccaarrppeettss
86. the postfx notation is also called
- Reverse polish notation
- Posish notation
- Infix notation
- None of these
87. Consider th usual algorithm for determining whether a sequence of parentheses is balanced. suppose that contains 2 left parentheses and 3 right parentheses (in some order). What is the maximum number of parentheses that will ever appear on the stack AT ON TIME during the computation ?
- 1
- 2
- 3
- 4
88. Consider the usual algorithm for determining whether a sequence of parentheses is balanced. Wht is the maimum numbef of parentheses that will appear on the stack AT ANY ONE TIME when the algorithm analyzes: ( ) ) ( ( )) ( ( )) )
- 1
- 2
- 3
- 4
89. Adding an element to the stack means
- Placing an element at the front end
- Placing the element at the top
- Placing the element at the rear end
- None of these
90. Suppose we have an array implementation of the stack class, with ten items in the stack stored at data [0] through data [9]. The CAPACITY is 42. where does the push member function place the new entry in the aray?
- data [0]
- data [1]
- data [9]
- data [10]