NEW
Font size
WorksheetsStacks And Queues
Total questions: 35
Worksheet time: 18mins
What data structure should you use to store a list of tasks (as String objects) in the To-Do List Manager application?
LinkedList
HashMap
Stack
TreeSet
The user should be presented with a menu of options in the To-Do List Manager application by:
Displaying a list of numbered choices for the user to select from
Automatically performing all actions without user input
Hiding the menu and requiring users to guess the commands
Presenting options only after the user completes all tasks
List the menu options that should be available to the user in the To-Do List Manager application.
Add Task, Edit Task, Delete Task, View Tasks
Play Music, Watch Videos, Edit Photos, Share Files
Send Email, Make Calls, Browse Internet, Play Games
Order Food, Book Tickets, Track Delivery, Watch Movies
What Java class should you use to read the user's input in the To-Do List Manager application?
Scanner
FileReader
PrintWriter
BufferedWriter
When the to-do list is empty and the user tries to remove a task, how should the application handle this situation?
Display a message indicating the list is empty and no task can be removed.
Remove a random task from the list anyway.
Add a default task to the list before removing it.
Crash the application.
What data structure should you use to manage the 'undo' history in the Simple Productivity App?
Stack
Queue
Array
Linked List
What data structure should you use to manage the 'redo' history in the Simple Productivity App?
Stack
Queue
Linked List
Hash Map
Which of the following commands should your Simple Productivity App support for implementing an Undo/Redo feature?
Add, Delete, Undo, Redo
Add, Save, Print, Export
Undo, Redo, Share, Archive
Delete, Print, Export, Import
How should your code handle cases where the user tries to undo or redo when the respective stacks are empty?
Display a message or do nothing to prevent errors.
Automatically add a default action to the stack.
Force the user to perform a new action before undo/redo is available.
Restart the application.
What data structure should you use to represent the playlist of songs to be played next in the Music Playlist Manager?
Queue
Stack
Array
Tree
What data structure should you use to store all available songs in the music library in the Music Playlist Manager?
ArrayList
HashMap
Stack
Queue
Which data structures are used in a program that simulates a social media feed with a content timeline and user engagement, where posts are stored in one structure and unread notifications in another?
ArrayList for posts and Stack for notifications
Queue for posts and Stack for notifications
Stack for posts and ArrayList for notifications
LinkedList for posts and Queue for notifications
Which data structure is used to represent orders that are "awaiting shipment" and need to be processed in a Last-In, First-Out (LIFO) manner in an e-commerce order processing system?
Stack
Queue
Linked List
Heap
Which data structure should be used to keep track of all available tickets in the dynamic ticketing system?
ArrayList
LinkedList
Queue
Stack
Which data structure is used to manage the queue of general admission ticket requests in the dynamic ticketing system?
ArrayList
LinkedList
Queue
Stack
Which data structure is used to manage VIP ticket requests in the dynamic ticketing system?
Queue
Stack
Array
Linked List
In the dynamic ticketing system, which feature displays the number of available tickets?
sell ticket
process requests
check availability
view queue
In the dynamic ticketing system, which feature removes a ticket request from either queue by searching for a specific ticket ID?
sell ticket
process requests
check availability
cancel request
In the Java TextEditor, what command is used to display the current document?
display
show
open
What happens when you enter the 'undo' command after the stack is empty in the Java TextEditor?
Cannot undo. Stack is empty.
The last action is undone successfully.
The editor crashes immediately.
A new empty action is added to the stack.
Which command is used to exit the Java TextEditor application?
exit
close
quit
end
In the Music Manager, what is the initial library of songs?
[Song A, Song B, Song C]
[Song A, Song B]
[Song B, Song C]
[Song A, Song C]
In the Music Manager, after adding Song A and Song C to the playlist and viewing the playlist, what songs are in the playlist?
[Song A, Song B]
[Song A, Song C]
[Song B, Song C]
[Song A]
In the Music Manager, what message is displayed after the command 'skip' is entered?
Skipped song.
Song paused.
Song stopped.
No song found.
In the Social Media Feed Simulator, what is the first post added to the timeline?
Enjoying the beautiful weather today.
My first post!
New notification
Timeline
In the Social Media Feed Simulator, what is the output after the first 'read notifications' command?
New notification: Enjoying the beautiful weather today.
No new notifications at this time.
New notification: You have a friend request.
New notification: Your post has been liked.
Which command is used to place an order in the E-Commerce Order Processing system?
process order
place order [items]
ship order
view orders
After placing orders for 'laptop, mouse' and 'keyboard, monitor', what is the correct sequence of commands to process and ship all orders?
process order, process order, ship order, ship order
ship order, process order, process order, ship order
process order, ship order, process order, ship order
ship order, ship order, process order, process order
What does the 'view shipment stack' command display after both orders have been shipped?
[] (an empty list)
[Order1, Order2]
[Shipped Orders]
[Pending Shipments]
Which command is used to check the number of available tickets in the Dynamic Ticketing System?
sell ticket [type]
process requests
check availability
view queue
What happens when the command 'sell ticket VIP' is entered?
VIP ticket added to queue.
VIP ticket removed from queue.
Regular ticket added to queue.
VIP ticket sold out message displayed.
After processing all requests, how many VIP tickets are remaining?
3
1
2
5
After processing all requests, how many General tickets are remaining?
9
5
12
0
What is the status of the VIP Queue after all requests are processed?
A) [VIP Ticket 1, VIP Ticket 2]
B) []
C) [VIP Ticket 2]
D) [VIP Ticket 1]
What is the status of the General Queue after all requests are processed?
[General Ticket 1]
[]
[General Ticket 2]
[General Ticket 1, General Ticket 2]
