Multiple Choice
Given the following stack declaration, which of the following function definitions would correctly push an item onto the stack?
Struct StackFrame
{
Char data;
StackFrame *link;
};
Typedef StackFrame* StackFramePtr;
Class Stack
{
Public:
Stack ) ;
Stackconst Stack& a_stack) ;
~Stack ) ;
Void pushchar the_symbol) ;
Char pop ) ;
Bool empty ) const;
Private:
StackFramePtr top;
};
A) void Stack::pushchar the_symbol)
{
StackFrame temp_ptr;
Temp_ptr = new StackFrame;
Temp_ptr->data = the_symbol;
Temp_ptr->link = top;
Top = temp_ptr;
}
B) void Stack::pushchar the_symbol)
{
StackFramePtr temp_ptr;
Temp_ptr->data = the_symbol;
Temp_ptr->link = top;
Top = temp_ptr;
}
C) void Stack::pushchar the_symbol)
{
StackFramePtr temp_ptr;
Temp_ptr = new StackFrame;
Temp_ptr->data = the_symbol;
Temp_ptr->link = top;
}
D) void Stack::pushchar the_symbol)
{
StackFramePtr temp_ptr;
Temp_ptr = new StackFrame;
Temp_ptr->data = the_symbol;
Temp_ptr->link = top;
Top = temp_ptr;
}
Correct Answer:

Verified
Correct Answer:
Verified
Q43: The pointer in a node points to<br>A)
Q44: Which operator * or .) has higher
Q45: If you push the following numbers onto
Q46: Given the following function declaration<br>Void insert NodePtr
Q47: The actual value of NULL is<br>A) -1<br>B)
Q49: Removing data from a stack is called
Q50: If you write a linked list class,
Q51: If NodeTypePtr is defined to be a
Q52: The discipline for a stack is:<br>A) .data
Q53: Which of the following loops correctly uses