Stack MCQ

1. Which one of the following is an application of Stack Data Structure?

A. Managing function calls
B. The stock span problem
C. Arithmetic expression evaluation
D. All of the above

View Answer


2. Process of inserting an element in stack is called ____________.

A. Create
B. Push
C. Evaluation
D. Pop

View Answer


3. The postfix form of A*B+C/D is?

A. *AB/CD+
B. AB*CD/+
C. A*BC+/D
D. ABCD+/*

View Answer


4.Which of the following is true about linked list implementation of stack?

A. In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end.
B. In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from the beginning.
C. Both of the above
D. None of the above

View Answer


5.In a stack, if a user tries to remove an element from empty stack it is called _________.

A. Underflow
B. Empty collection
C. Overflow
D. Garbage Collection

View Answer


6. 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 output for input "letsfindc"?

A. letsfindcletsfindc
B. cdnifstel
C. letsfindc
D. cdnifstelcdnifstel

View Answer


7.Entries in a stack are “ordered”. What is the meaning of this statement?

A. A collection of stacks is sortable
B. Stack entries may be compared with the '<' operation
C. The entries are stored in a linked list
D. There is a Sequential entry that is one by one

View Answer


8. The prefix form of A-B/ (C * D ⋀ E) is?

A. -/*⋀ACBDE
B. -ABCD*⋀DE
C. -A/B*C⋀DE
D. -A/BC*⋀DE

View Answer


9.Following is an incorrect pseudocode for the algorithm which is supposed to determine whether a sequence of parentheses is balanced:
  declare a character stack
 while ( more input is available)
 {
   read a character
   if ( the character is a '(' )
    push it on the stack
   else if ( the character is a ')' and the stack is not empty )
    pop a character off the stack
   else
    print "unbalanced" and exit
  }
  print "balanced"
Which of these unbalanced sequences does the above code think is balanced?

A. ((())
B. ())(()
C. (()()))
D. (()))()

View Answer


10.What is the value of the postfix expression 6 3 2 4 + – *:

A. Something between -5 and -15
B. Something between 5 and -5
C. Something between 5 and 15
D. Something between 15 and 100

View Answer






Also Check :


Discussion


* You must be logged in to add comment.