Deck 6: Stacks

ملء الشاشة (f)
exit full mode
سؤال
A client of a list can access any element and can insert elements at any location.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
In programming, a(n) __________ is a data structure with the property that only the top element of the stack is accessible.
سؤال
The storage policy of a stack is sometimes referred to as __________.

A) First-In, First-Out, or FIFO
B) First-In, Last-Out, or LILO
C) Last-In, First-Out, or LIFO
D) Last-in, Last-Out, or LILO
سؤال
Which of the following is a stack operation?

A) front
B) top
C) insert
D) back
سؤال
Which string is output by the last line of the following instruction set?
My_stack.push("Last to arrive ");
My_stack.push("first to leave ");
My_stack.pop();
Cout << my_stack.top() << endl;

A) Last to arrive
B) Last to arrive first to leave
C) first to leave Last to arrive
D) first to leave
سؤال
A(n) __________ is a string that reads the same in either direction: left to right or right to left.
سؤال
The code segment from build_reverse, a member function of Palindrome_Finder, has been incorrectly altered.
<strong>The code segment from build_reverse, a member function of Palindrome_Finder, has been incorrectly altered.   The line __________ replaces the error written into the code segment.</strong> A) while (char_stack.empty()) B) result = char_stack.front(); C) result += char_stack.top(); D) char_stack.push(); <div style=padding-top: 35px> The line __________ replaces the error written into the code segment.

A) while (char_stack.empty())
B) result = char_stack.front();
C) result += char_stack.top();
D) char_stack.push();
سؤال
Complete the definition for the new function class CiLess_Than, which will be used to perform a case-sensitive comparison of characters.
Complete the definition for the new function class CiLess_Than, which will be used to perform a case-sensitive comparison of characters.  <div style=padding-top: 35px>
سؤال
An expression is __________ if each subexpression that starts with the symbol { ends with the symbol }, and the same statement is true for the other symbol pairs.
سؤال
The expression
(w * [x + y) / z - [p / {r - q}])
Is not balanced, because the subexpression __________ is incorrect.

A) {r - q}
B) [x + y)
C) [p / {r - q}]
D) p / {r - q}
سؤال
Suppose the function is_balanced in Paren_Checker.cpp is called with the expression
[ (x + y)/8 - z [ p * {r + q) ] ]
What is the value of s.top() in the return statement?

A) empty
B) [
C) ]
D) {
سؤال
Within the standard library a stack can be implemented using a vector, list, or __________ as a component to hold the contents of the stack.
سؤال
The stack is said to be a(n) __________ class because it adapts the functions available in another class to the interface its clients expect by giving different names to essentially the same operations.
سؤال
It is easier to insert and remove from the middle of a linked list.
سؤال
The C++ standard requires that implementations of sequential containers provide push_back, pop_back, and back operations in (amortized) constant time.
سؤال
Normally we write expressions using __________ notation, in which binary operators (*, +, and so forth) are inserted between their operands.
سؤال
A calculator (or computer) normally scans an expression string from right to left.
سؤال
The advantage of the __________ form is that there is no need to group subexpressions in parentheses or even to consider operator precedence.

A) infix
B) suffix
C) postfix
D) adfix
سؤال
In a(n) __________expression the operands precede the operators.
سؤال
The __________ function (member of the istream class) is used to "unread" a single character.
سؤال
According to the __________ rule, operators with the same precedence are evaluated in left-to-right order.
سؤال
Using the algorithm for converting an infix expression to a postfix expression, how is
(14 + 5) - 8 * 4 / 2
Represented in postfix form?

A) 14 5 8 4 2 + - * /
B) 14 5 + 8 4 * 2 / -
C) 14 5 + 8 * / 2 -
D) 14 5 8 + - 2 * /
سؤال
The action of using function top to access an item at the top of the stack, without removing it, is sometimes called __________ the stack.

A) peeking
B) skimming
C) popping
D) peeling
سؤال
__________ are used to separate an expression into subexpressions.

A) Tokens
B) Operators
C) Operands
D) Parentheses
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/24
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 6: Stacks
1
A client of a list can access any element and can insert elements at any location.
True
2
In programming, a(n) __________ is a data structure with the property that only the top element of the stack is accessible.
stack
3
The storage policy of a stack is sometimes referred to as __________.

A) First-In, First-Out, or FIFO
B) First-In, Last-Out, or LILO
C) Last-In, First-Out, or LIFO
D) Last-in, Last-Out, or LILO
Last-In, First-Out, or LIFO
4
Which of the following is a stack operation?

A) front
B) top
C) insert
D) back
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
5
Which string is output by the last line of the following instruction set?
My_stack.push("Last to arrive ");
My_stack.push("first to leave ");
My_stack.pop();
Cout << my_stack.top() << endl;

A) Last to arrive
B) Last to arrive first to leave
C) first to leave Last to arrive
D) first to leave
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
6
A(n) __________ is a string that reads the same in either direction: left to right or right to left.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
7
The code segment from build_reverse, a member function of Palindrome_Finder, has been incorrectly altered.
<strong>The code segment from build_reverse, a member function of Palindrome_Finder, has been incorrectly altered.   The line __________ replaces the error written into the code segment.</strong> A) while (char_stack.empty()) B) result = char_stack.front(); C) result += char_stack.top(); D) char_stack.push(); The line __________ replaces the error written into the code segment.

A) while (char_stack.empty())
B) result = char_stack.front();
C) result += char_stack.top();
D) char_stack.push();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
8
Complete the definition for the new function class CiLess_Than, which will be used to perform a case-sensitive comparison of characters.
Complete the definition for the new function class CiLess_Than, which will be used to perform a case-sensitive comparison of characters.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
9
An expression is __________ if each subexpression that starts with the symbol { ends with the symbol }, and the same statement is true for the other symbol pairs.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
10
The expression
(w * [x + y) / z - [p / {r - q}])
Is not balanced, because the subexpression __________ is incorrect.

A) {r - q}
B) [x + y)
C) [p / {r - q}]
D) p / {r - q}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
11
Suppose the function is_balanced in Paren_Checker.cpp is called with the expression
[ (x + y)/8 - z [ p * {r + q) ] ]
What is the value of s.top() in the return statement?

A) empty
B) [
C) ]
D) {
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
12
Within the standard library a stack can be implemented using a vector, list, or __________ as a component to hold the contents of the stack.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
13
The stack is said to be a(n) __________ class because it adapts the functions available in another class to the interface its clients expect by giving different names to essentially the same operations.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
14
It is easier to insert and remove from the middle of a linked list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
15
The C++ standard requires that implementations of sequential containers provide push_back, pop_back, and back operations in (amortized) constant time.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
16
Normally we write expressions using __________ notation, in which binary operators (*, +, and so forth) are inserted between their operands.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
17
A calculator (or computer) normally scans an expression string from right to left.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
18
The advantage of the __________ form is that there is no need to group subexpressions in parentheses or even to consider operator precedence.

A) infix
B) suffix
C) postfix
D) adfix
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
19
In a(n) __________expression the operands precede the operators.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
20
The __________ function (member of the istream class) is used to "unread" a single character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
21
According to the __________ rule, operators with the same precedence are evaluated in left-to-right order.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
22
Using the algorithm for converting an infix expression to a postfix expression, how is
(14 + 5) - 8 * 4 / 2
Represented in postfix form?

A) 14 5 8 4 2 + - * /
B) 14 5 + 8 4 * 2 / -
C) 14 5 + 8 * / 2 -
D) 14 5 8 + - 2 * /
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
23
The action of using function top to access an item at the top of the stack, without removing it, is sometimes called __________ the stack.

A) peeking
B) skimming
C) popping
D) peeling
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
24
__________ are used to separate an expression into subexpressions.

A) Tokens
B) Operators
C) Operands
D) Parentheses
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 24 في هذه المجموعة.