Deck 17: Stacks and Queue

ملء الشاشة (f)
exit full mode
سؤال
What is the output of the following code? <strong>What is the output of the following code?  </strong> A) x = 4 B) x = 5 C) x = 6 D) x = 9 <div style=padding-top: 35px>

A) x = 4
B) x = 5
C) x = 6
D) x = 9
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
The infix expression
(a + b) * (c - d / e) + f
is equivalent to the postfix expression
ab + cde /-* f +
سؤال
A queue is a First In First Out data structure.
سؤال
Postfix notation requires the use of parentheses to enforce operator precedence.
سؤال
The expression a + b is the same in both infix notation and postfix notation.
سؤال
You can perform the operation ____ to remove the top element from the stack.

A) dequeue
B) top
C) pop
D) push
سؤال
If you try to add a new item to a full stack, the resulting condition is called an outflow.
سؤال
Popping an element from an empty stack is called ____.

A) overflow
B) underflow
C) exception
D) overloading
سؤال
The ____ element of the stack is the last element added to the stack.

A) top
B) bottom
C) head
D) tail
سؤال
The default constructor for the linked implementation of a stack initializes the stack to an empty state when a stack object is declared.
سؤال
You can perform the add operation, called ____, to add an element onto the stack.

A) pop
B) push
C) enqueue
D) dequeue
سؤال
If you try to add a new item to a full stack, the resulting condition is called a(n) ____.

A) override
B) overflow
C) overload
D) underflow
سؤال
When a stack is implemented as an array, the array is empty if the value of stackTop is ____.

A) zero
B) one
C) nonzero
D) equal to the size of the array
سؤال
In the linked implementation of stacks, the memory to store the stack elements is allocated statically.
سؤال
In the array representation of a stack, if a value called stackTop indicates the number of elements in the stack, then stackTop-1 points to the top item of the stack.
سؤال
The bottom element of the stack is the last element added to the stack.
سؤال
A(n) ____ is a list of homogenous elements in which the addition and deletion of elements occurs only at one end.

A) stack
B) queue
C) array
D) linked list
سؤال
A stack is a(n) ____ data structure.

A) FIFO
B) FILO
C) LIFO
D) LILO
سؤال
A stack can be implemented as either a(n) ____ or a linked structure.

A) map
B) struct
C) queue
D) array
سؤال
The addition and deletion of elements of a stack occurs only at the ____ of the stack.

A) head
B) bottom
C) top
D) middle
سؤال
A technique in which one system models the behavior of another system is called ____.

A) imitation
B) recursion
C) simulation
D) stimulation
سؤال
The postfix expression 2 4 6 * + 15 - 21 7 / + = evaluates to ____.

A) 4
B) 14
C) 24
D) 26
سؤال
In ____________________ notation, operators are written after the operands.
سؤال
What is the output of the following code? <strong>What is the output of the following code?  </strong> A) x = 2 Y = 4 B) x = 4 Y = 3 C) x = 2 Y = 3 D) x = 3 Y = 2 <div style=padding-top: 35px>

A) x = 2
Y = 4
B) x = 4
Y = 3
C) x = 2
Y = 3
D) x = 3
Y = 2
سؤال
The following expression (a - b) * (c + d) is equivalent to which of the following postfix expressions?

A) a b c d - + *
B) a b - c d + *
C) a b - + c d *
D) - + * a b c d
سؤال
What is the output of the following code? <strong>What is the output of the following code?  </strong> A) x = 5 Y = 6 B) x = 4 Y = 3 C) x = 5 Y = 3 D) x = 11 Y = 6 <div style=padding-top: 35px>

A) x = 5
Y = 6
B) x = 4
Y = 3
C) x = 5
Y = 3
D) x = 11
Y = 6
سؤال
The ____________________ constructor is called when a stack object is passed as a (value) parameter to a function.
سؤال
____________________ techniques are used when it is too expensive or dangerous to experiment with real systems.
سؤال
What is the output of the following code? ​

<strong>What is the output of the following code? ​ ​  </strong> A) 6 2 3 3 B) 6 2 4 2 C) 6 3 3 3 D) 6 4 2 3 <div style=padding-top: 35px>

A) 6 2 3 3
B) 6 2 4 2
C) 6 3 3 3
D) 6 4 2 3
سؤال
The elements at the ____________________ of the stack have been in the stack the longest.
سؤال
A queue is a data structure in which the elements are ____.

A) added to the rear and deleted from the front
B) added to and deleted from the rear
C) added to and deleted from the front
D) added and deleted in the middle
سؤال
In evaluating a postfix expression, when an equal sign (=) is encountered, how many elements must the stack contain so that no error is generated?

A) none
B) one
C) two
D) three
سؤال
In the array representation of a stack, the stack is initialized simply by setting stackTop to ____________________.
سؤال
The postfix expression 5 6 + 4 * 10 5 / - = evaluates to ____.

A) 10
B) 30
C) 42
D) 44
سؤال
To describe a queuing system, we use the term ____ for the object receiving the service.

A) receiver
B) server
C) customer
D) provider
سؤال
An array is a(n) ____________________ access data structure.
سؤال
The postfix expression 3 5 + 2 ; 6 - = will generate an error, because it ____.

A) contains an illegal operator
B) does not have enough operands
C) has too many operands
D) has too many operators
سؤال
Which of the following is listed in the chapter as a basic operation performed on a queue?

A) push
B) pop
C) isEmptyQueue
D) top
سؤال
The postfix expression 14 2 5 + = will generate an error, because ____.

A) it contains an illegal operator
B) it does not have enough operands
C) it has too many operators
D) there will be too many elements in the stack when the equal sign is encountered
سؤال
To describe a queuing system, we use the term ____ for the object that provides the service.

A) client
B) server
C) customer
D) provider
سؤال
In a(n) ____________________ simulation, the clock is implemented as a counter, and the passage of, say, one minute can be implemented by incrementing the counter by 1.
سؤال
In a queuing system, every customer has a customer number, arrival time, ____________________ time, transaction time, and departure time.
سؤال
When describing a queuing system, we use the term ____________________ to refer to the time it takes to serve a customer.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/43
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 17: Stacks and Queue
1
What is the output of the following code? <strong>What is the output of the following code?  </strong> A) x = 4 B) x = 5 C) x = 6 D) x = 9

A) x = 4
B) x = 5
C) x = 6
D) x = 9
D
2
The infix expression
(a + b) * (c - d / e) + f
is equivalent to the postfix expression
ab + cde /-* f +
True
3
A queue is a First In First Out data structure.
True
4
Postfix notation requires the use of parentheses to enforce operator precedence.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
5
The expression a + b is the same in both infix notation and postfix notation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
6
You can perform the operation ____ to remove the top element from the stack.

A) dequeue
B) top
C) pop
D) push
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
7
If you try to add a new item to a full stack, the resulting condition is called an outflow.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
8
Popping an element from an empty stack is called ____.

A) overflow
B) underflow
C) exception
D) overloading
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
9
The ____ element of the stack is the last element added to the stack.

A) top
B) bottom
C) head
D) tail
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
10
The default constructor for the linked implementation of a stack initializes the stack to an empty state when a stack object is declared.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
11
You can perform the add operation, called ____, to add an element onto the stack.

A) pop
B) push
C) enqueue
D) dequeue
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
12
If you try to add a new item to a full stack, the resulting condition is called a(n) ____.

A) override
B) overflow
C) overload
D) underflow
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
13
When a stack is implemented as an array, the array is empty if the value of stackTop is ____.

A) zero
B) one
C) nonzero
D) equal to the size of the array
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
14
In the linked implementation of stacks, the memory to store the stack elements is allocated statically.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
15
In the array representation of a stack, if a value called stackTop indicates the number of elements in the stack, then stackTop-1 points to the top item of the stack.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
16
The bottom element of the stack is the last element added to the stack.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
17
A(n) ____ is a list of homogenous elements in which the addition and deletion of elements occurs only at one end.

A) stack
B) queue
C) array
D) linked list
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
18
A stack is a(n) ____ data structure.

A) FIFO
B) FILO
C) LIFO
D) LILO
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
19
A stack can be implemented as either a(n) ____ or a linked structure.

A) map
B) struct
C) queue
D) array
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
20
The addition and deletion of elements of a stack occurs only at the ____ of the stack.

A) head
B) bottom
C) top
D) middle
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
21
A technique in which one system models the behavior of another system is called ____.

A) imitation
B) recursion
C) simulation
D) stimulation
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
22
The postfix expression 2 4 6 * + 15 - 21 7 / + = evaluates to ____.

A) 4
B) 14
C) 24
D) 26
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
23
In ____________________ notation, operators are written after the operands.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
24
What is the output of the following code? <strong>What is the output of the following code?  </strong> A) x = 2 Y = 4 B) x = 4 Y = 3 C) x = 2 Y = 3 D) x = 3 Y = 2

A) x = 2
Y = 4
B) x = 4
Y = 3
C) x = 2
Y = 3
D) x = 3
Y = 2
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
25
The following expression (a - b) * (c + d) is equivalent to which of the following postfix expressions?

A) a b c d - + *
B) a b - c d + *
C) a b - + c d *
D) - + * a b c d
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
26
What is the output of the following code? <strong>What is the output of the following code?  </strong> A) x = 5 Y = 6 B) x = 4 Y = 3 C) x = 5 Y = 3 D) x = 11 Y = 6

A) x = 5
Y = 6
B) x = 4
Y = 3
C) x = 5
Y = 3
D) x = 11
Y = 6
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
27
The ____________________ constructor is called when a stack object is passed as a (value) parameter to a function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
28
____________________ techniques are used when it is too expensive or dangerous to experiment with real systems.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
29
What is the output of the following code? ​

<strong>What is the output of the following code? ​ ​  </strong> A) 6 2 3 3 B) 6 2 4 2 C) 6 3 3 3 D) 6 4 2 3

A) 6 2 3 3
B) 6 2 4 2
C) 6 3 3 3
D) 6 4 2 3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
30
The elements at the ____________________ of the stack have been in the stack the longest.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
31
A queue is a data structure in which the elements are ____.

A) added to the rear and deleted from the front
B) added to and deleted from the rear
C) added to and deleted from the front
D) added and deleted in the middle
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
32
In evaluating a postfix expression, when an equal sign (=) is encountered, how many elements must the stack contain so that no error is generated?

A) none
B) one
C) two
D) three
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
33
In the array representation of a stack, the stack is initialized simply by setting stackTop to ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
34
The postfix expression 5 6 + 4 * 10 5 / - = evaluates to ____.

A) 10
B) 30
C) 42
D) 44
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
35
To describe a queuing system, we use the term ____ for the object receiving the service.

A) receiver
B) server
C) customer
D) provider
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
36
An array is a(n) ____________________ access data structure.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
37
The postfix expression 3 5 + 2 ; 6 - = will generate an error, because it ____.

A) contains an illegal operator
B) does not have enough operands
C) has too many operands
D) has too many operators
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
38
Which of the following is listed in the chapter as a basic operation performed on a queue?

A) push
B) pop
C) isEmptyQueue
D) top
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
39
The postfix expression 14 2 5 + = will generate an error, because ____.

A) it contains an illegal operator
B) it does not have enough operands
C) it has too many operators
D) there will be too many elements in the stack when the equal sign is encountered
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
40
To describe a queuing system, we use the term ____ for the object that provides the service.

A) client
B) server
C) customer
D) provider
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
41
In a(n) ____________________ simulation, the clock is implemented as a counter, and the passage of, say, one minute can be implemented by incrementing the counter by 1.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
42
In a queuing system, every customer has a customer number, arrival time, ____________________ time, transaction time, and departure time.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
43
When describing a queuing system, we use the term ____________________ to refer to the time it takes to serve a customer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.