Filters
Question type

When evaluating an arithmetic expression, first you transform it from its postfix form to its infix form.

A) True
B) False

Correct Answer

verifed

verified

What is the operation that adds items to a stack?


A) get
B) set
C) push
D) pop

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

The time complexity of the postfix expression evaluation algorithm is O( n2 ) .

Correct Answer

Answered by ExamLex AI

Answered by ExamLex AI

The time complexity of the postfix expre...

View Answer

When using a stack to evaluate the balance of brackets and parentheses in an expression, what is the final step?


A) at the end of the expression, if a final closing bracket is found, the brackets balance
B) at the end of the expression, if the stack is empty, the brackets do not balance
C) at the end of the expression, if the stack is full, the brackets balance
D) at the end of the expression, if the stack is empty, the brackets balance

E) A) and B)
F) B) and C)

Correct Answer

verifed

verified

The Node class for use in the linked structure stack contains three fields: data, next, and previous.

A) True
B) False

Correct Answer

verifed

verified

In the algorithm that checks for a balanced expression, which of the following is true if a closing bracket is encountered?


A) if the stack is empty, the brackets balance
B) if the item on the top of the stack is a closing bracket of the same type, the brackets balance
C) if the stack is empty or the item on the top of the stack is not an opening bracket of the same type, the brackets don't balance
D) if the stack is empty or the item on the bottom of the stack is an opening bracket of the same type, the brackets balance

E) None of the above
F) All of the above

Correct Answer

verifed

verified

Using a stack is a good approach to determining if the use of brackets in an expression is balanced.

A) True
B) False

Correct Answer

verifed

verified

The operation for removing an item from the stack is called push.

A) True
B) False

Correct Answer

verifed

verified

Stack interfaces implement a peek operation for examining the element at the top of the stack.

A) True
B) False

Correct Answer

verifed

verified

In a linked structure stack implementation, efficient pushing and popping require adding and removing of nodes at the head of the linked sequence.

A) True
B) False

Correct Answer

verifed

verified

Addition and subtraction have higher precedence when evaluating an infix expression.

A) True
B) False

Correct Answer

verifed

verified

What is the function of the peek method in a stack implementation?


A) to return the bottom item without removing it
B) to return the top item without removing it
C) to return the top item and remove it from the stack
D) to return the bottom item and remove it from the stack

E) A) and C)
F) A) and D)

Correct Answer

verifed

verified

In the algorithm to evaluate a postfix expression, what does the algorithm do when an operator is encountered?


A) pop the resulting value from the stack
B) push the preceding operands onto the stack
C) apply the operator to the two preceding operands
D) push the operator onto the stack

E) B) and D)
F) A) and D)

Correct Answer

verifed

verified

When converting from infix form to postfix form, parentheses are added to the equation.

A) True
B) False

Correct Answer

verifed

verified

Which of the following is NOT an operation supported by a stack interface?


A) push
B) insert
C) clear
D) peek

E) All of the above
F) A) and B)

Correct Answer

verifed

verified

The first step in evaluating a postfix expression is to scan the expression from left to right.

A) True
B) False

Correct Answer

verifed

verified

Which of the following is NOT an application of stacks in computer science?


A) implementation of a hash-based database search function
B) managing computer memory in support of function calls
C) supporting the undo feature in a text editor
D) maintaining a history of visited links by a web browser

E) B) and C)
F) A) and B)

Correct Answer

verifed

verified

To avoid stack overflow, the stack algorithm should raise an error if an item is added to a full stack.

A) True
B) False

Correct Answer

verifed

verified

A Python list structure and its methods implement a stack perfectly.

A) True
B) False

Correct Answer

verifed

verified

In the algorithm to evaluate a postfix expression, what does the algorithm do when an operand is encountered?


A) pop the operand from the stack
B) push the operand onto the stack
C) pop the operator from the stack
D) push an operator onto the stack

E) A) and C)
F) None of the above

Correct Answer

verifed

verified

Showing 21 - 40 of 50

Related Exams

Show Answer