Filters
Question type

A stack structure is a built-in part of the Python language.

A) True
B) False

Correct Answer

verifed

verified

False

The operator in an infix expression follows the operands.

A) True
B) False

Correct Answer

verifed

verified

Stacks adhere to a LIFO protocol.

A) True
B) False

Correct Answer

verifed

verified

If the entire postfix expression is 9 1 4 + - 2 *, what is the final value?


A) 12
B) 8
C) 17
D) 10

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

Correct Answer

verifed

verified

In the linked implementation of a stack, what type of helper function simplifies the __iter__ method?


A) binary
B) sequential
C) recursive
D) random

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

Correct Answer

verifed

verified

Which of the following is true about a postfix expression?


A) the operator is between its two operands
B) the operator follows its two operands
C) stack of bricks
D) table of contents

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

Correct Answer

verifed

verified

Which of the following begins in a predefined starting state and then moves from state to state in search of a desired ending state?


A) backtracking algorithm
B) memory management algorithm
C) infix to postfix converter
D) postfix to infix converter

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

Correct Answer

verifed

verified

In what way doesn't the Python list data structure accurately emulate a stack?


A) the append method pushes elements onto the stack
B) the pop method removes and returns the top element
C) a list uses an array as the underlying data structure
D) list methods allow manipulation of items at any position

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

Correct Answer

verifed

verified

With a stack, you always access the item that has been most recently added.

A) True
B) False

Correct Answer

verifed

verified

Access to a stack is restricted to the bottom end.

A) True
B) False

Correct Answer

verifed

verified

A token in the postfix expression evaluation algorithm is an operand or operator.

A) True
B) False

Correct Answer

verifed

verified

What is the resulting infix expression from the following postfix expression? 17 4 - 6 + 8 *


A) 17 - (4 + 6 * 8)
B) 17 - (4 + 6) * 8
C) (17 - 4) + (6 * 8)
D) (17 - 4 + 6) * 8

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

Correct Answer

verifed

verified

Which of the following is NOT an example of a stack in everyday life?


A) a spindle of blank DVDs
B) a stack of plates in a cafeteria line
C) a pile of napkins
D) a jar of jellybeans

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

Correct Answer

verifed

verified

What is the function of the PVM?


A) converts methods to subroutines
B) executes a python program from bytecodes
C) compiles Python code into assembly language
D) links a Python program to imported modules

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

Correct Answer

verifed

verified

In the following code that defines the push method for the array-based stack, what is the missing code? def push (self, item) : < missing code > Self.size += 1


A) self.items += 1
B) self.items[ len(self) ] = item
C) items[ size ] = len(self.item)
D) item = self.items[ self.size + 1 ]

E) B) and D)
F) None of the above

Correct Answer

verifed

verified

B

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


A) push opening brackets onto the stack while scanning the expression
B) pop closing brackets onto the stack while scanning the expression
C) push closing brackets onto the stack while scanning the expression
D) pop opening brackets onto the stack while scanning the expression

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

Correct Answer

verifed

verified

What is the resulting postfix expression from the following infix expression? (12 + 5) * 2 - 3


A) 12 5 2 + * 3 -
B) 12 5 + 2 3 * -
C) 12 5 + 2 * 3 -
D) 12 5 2 + 3 - *

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

Correct Answer

verifed

verified

The push operation for a stack raises an error if the stack is empty.

A) True
B) False

Correct Answer

verifed

verified

If the current state of the stack is [ x, y, z ] where x is the bottom of the stack and z is the top of the stack, what is the state of the stack and the value returned after a pop operation?


A) the state is [ x, y ]; z is returned
B) the state is [ x, y, z ]; z is returned
C) the state is [ y, z ]; x is returned
D) the state is [ x, y, z ]; x is returned

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

Correct Answer

verifed

verified

The equation 17 46 + is an example of postfix form.

A) True
B) False

Correct Answer

verifed

verified

True

Showing 1 - 20 of 50

Related Exams

Show Answer