Deck 9: Sorting,stacks,and Queues
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/19
Play
Full screen (f)
Deck 9: Sorting,stacks,and Queues
1
4.Queues use the first in,first out procedure.
True
2
5.The bubble sort bubbles the largest number to the bottom.
True
3
Use the bubble sort method to show the first pass of the following array:
A)12,17,23,15,65
B)12,23,17,15,65
C)15,17,12,23,65
D)17,15,12,23,65
A)12,17,23,15,65
B)12,23,17,15,65
C)15,17,12,23,65
D)17,15,12,23,65
15,17,12,23,65
4
18.When processing a queue:
A)An error occurs when adding data to the queue and the queue is filled.
B)An error occurs when deleting data from the queue and queue is empty.
C)An error occurs when the wrong option is entered.
D)All of the above.
A)An error occurs when adding data to the queue and the queue is filled.
B)An error occurs when deleting data from the queue and queue is empty.
C)An error occurs when the wrong option is entered.
D)All of the above.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
5
11.The bubble sort:
A)Finds the smallest value and exchanges it with the first value,then continues with the second value,third value,etc.
B)Is a system of comparisons and exchanges of adjacent elements to move the largest to the bottom of the selected group of values.
C)Is a system of comparisons and exchanges of elements that are non-adjacent.The gap is halved at each pass.
D)None of the above.
A)Finds the smallest value and exchanges it with the first value,then continues with the second value,third value,etc.
B)Is a system of comparisons and exchanges of adjacent elements to move the largest to the bottom of the selected group of values.
C)Is a system of comparisons and exchanges of elements that are non-adjacent.The gap is halved at each pass.
D)None of the above.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
6
Use the selection exchange method to show the first pass of the following array:
A)12,17,23,15,65
B)12,23,17,15,65
C)15,17,12,23,65
D)17,15,12,23,65
A)12,17,23,15,65
B)12,23,17,15,65
C)15,17,12,23,65
D)17,15,12,23,65
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
7
7.Data structures are the various ways to store data in the computer.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
8
17.The selection exchange sort:
A)Finds the smallest value and exchanges it with the first value,then continues with the second value,third value,etc.
B)Is a system of comparisons and exchanges of adjacent elements to move the largest to the bottom of the selected group of values.
C)Is a system of comparisons and exchanges of elements that are non-adjacent.The gap is halved at each pass.
D)None of the above.
A)Finds the smallest value and exchanges it with the first value,then continues with the second value,third value,etc.
B)Is a system of comparisons and exchanges of adjacent elements to move the largest to the bottom of the selected group of values.
C)Is a system of comparisons and exchanges of elements that are non-adjacent.The gap is halved at each pass.
D)None of the above.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
9
3.Stacks use the first in,first out procedure.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
10
1.Sorting is done through multiple comparisons and exchanges.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
11
Given a stack,what would the final value of the stack pointer be after the following instructions were executed:
PUSH 23
PUSH 35
PUSH 42
POP X
PUSH 20
POP X
POP X
PUSH 30
A)1.
B)2.
C)3.
D)4.
E)5.
PUSH 23
PUSH 35
PUSH 42
POP X
PUSH 20
POP X
POP X
PUSH 30
A)1.
B)2.
C)3.
D)4.
E)5.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
12
20.In a queue:
A)Data is added to the top and deleted from the bottom.
B)Data is added to the bottom and deleted from the top.
C)The data in the queue is moved to the top when data is deleted.
D)The data in the queue is moved down when data is deleted.
A)Data is added to the top and deleted from the bottom.
B)Data is added to the bottom and deleted from the top.
C)The data in the queue is moved to the top when data is deleted.
D)The data in the queue is moved down when data is deleted.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
13
10.Queues use pushing and popping to add and delete data.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
14
2.The sorting technique that requires the least number of comparisons and exchanges is the selection-exchange method.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
15
12.When a stack is pushed:
A)The number is entered into the element number in the stack pointer,the stack pointer is then incremented.
B)The stack pointer is incremented,then the number is entered into to element number in the stack pointer.
C)The number is taken out of the stack at the element number in the stack pointer,the stack pointer is then decremented.
D)The stack pointer is decremented,then the number is taken out of the stack at the element number in the stack pointer.
A)The number is entered into the element number in the stack pointer,the stack pointer is then incremented.
B)The stack pointer is incremented,then the number is entered into to element number in the stack pointer.
C)The number is taken out of the stack at the element number in the stack pointer,the stack pointer is then decremented.
D)The stack pointer is decremented,then the number is taken out of the stack at the element number in the stack pointer.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
16
6.The shell sort is a modification of the selection sort.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
17
16.The Shell sort:
A)Finds the smallest value and exchanges it with the first value,then continues with the second value,third value,etc.
B)Is a system of comparisons and exchanges of adjacent elements to move the largest to the bottom of the selected group of values.
C)Is a system of comparisons and exchanges of elements that are non-adjacent.The gap is halved at each pass.
D)None of the above.
A)Finds the smallest value and exchanges it with the first value,then continues with the second value,third value,etc.
B)Is a system of comparisons and exchanges of adjacent elements to move the largest to the bottom of the selected group of values.
C)Is a system of comparisons and exchanges of elements that are non-adjacent.The gap is halved at each pass.
D)None of the above.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
18
21.When processing a stack:
A)Additions are at one end and deletions are at the other end.
B)Additions and deletions are both at the same end.
C)Additions are at the top and deletions are at the bottom.
D)Additions are at the bottom and deletions are at the top.
A)Additions are at one end and deletions are at the other end.
B)Additions and deletions are both at the same end.
C)Additions are at the top and deletions are at the bottom.
D)Additions are at the bottom and deletions are at the top.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
19
8.Sorting Data means to separate data into catagories.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck