wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Stacks And Queues

Total questions: 35

Worksheet time: 18mins

Name
Class
Date
1.

What data structure should you use to store a list of tasks (as String objects) in the To-Do List Manager application?

a)

LinkedList

b)

HashMap

c)

Stack

d)

TreeSet

2.

The user should be presented with a menu of options in the To-Do List Manager application by:

a)

Displaying a list of numbered choices for the user to select from

b)

Automatically performing all actions without user input

c)

Hiding the menu and requiring users to guess the commands

d)

Presenting options only after the user completes all tasks

3.

List the menu options that should be available to the user in the To-Do List Manager application.

a)

Add Task, Edit Task, Delete Task, View Tasks

b)

Play Music, Watch Videos, Edit Photos, Share Files

c)

Send Email, Make Calls, Browse Internet, Play Games

d)

Order Food, Book Tickets, Track Delivery, Watch Movies

4.

What Java class should you use to read the user's input in the To-Do List Manager application?

a)

Scanner

b)

FileReader

c)

PrintWriter

d)

BufferedWriter

5.

When the to-do list is empty and the user tries to remove a task, how should the application handle this situation?

a)

Display a message indicating the list is empty and no task can be removed.

b)

Remove a random task from the list anyway.

c)

Add a default task to the list before removing it.

d)

Crash the application.

6.

What data structure should you use to manage the 'undo' history in the Simple Productivity App?

a)

Stack

b)

Queue

c)

Array

d)

Linked List

7.

What data structure should you use to manage the 'redo' history in the Simple Productivity App?

a)

Stack

b)

Queue

c)

Linked List

d)

Hash Map

8.

Which of the following commands should your Simple Productivity App support for implementing an Undo/Redo feature?

a)

Add, Delete, Undo, Redo

b)

Add, Save, Print, Export

c)

Undo, Redo, Share, Archive

d)

Delete, Print, Export, Import

9.

How should your code handle cases where the user tries to undo or redo when the respective stacks are empty?

a)

Display a message or do nothing to prevent errors.

b)

Automatically add a default action to the stack.

c)

Force the user to perform a new action before undo/redo is available.

d)

Restart the application.

10.

What data structure should you use to represent the playlist of songs to be played next in the Music Playlist Manager?

a)

Queue

b)

Stack

c)

Array

d)

Tree

11.

What data structure should you use to store all available songs in the music library in the Music Playlist Manager?

a)

ArrayList

b)

HashMap

c)

Stack

d)

Queue

12.

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?

a)

ArrayList for posts and Stack for notifications

b)

Queue for posts and Stack for notifications

c)

Stack for posts and ArrayList for notifications

d)

LinkedList for posts and Queue for notifications

13.

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?

a)

Stack

b)

Queue

c)

Linked List

d)

Heap

14.

Which data structure should be used to keep track of all available tickets in the dynamic ticketing system?

a)

ArrayList

b)

LinkedList

c)

Queue

d)

Stack

15.

Which data structure is used to manage the queue of general admission ticket requests in the dynamic ticketing system?

a)

ArrayList

b)

LinkedList

c)

Queue

d)

Stack

16.

Which data structure is used to manage VIP ticket requests in the dynamic ticketing system?

a)

Queue

b)

Stack

c)

Array

d)

Linked List

17.

In the dynamic ticketing system, which feature displays the number of available tickets?

a)

sell ticket

b)

process requests

c)

check availability

d)

view queue

18.

In the dynamic ticketing system, which feature removes a ticket request from either queue by searching for a specific ticket ID?

a)

sell ticket

b)

process requests

c)

check availability

d)

cancel request

19.

In the Java TextEditor, what command is used to display the current document?

a)

display

b)

show

c)

open

d)

print

20.

What happens when you enter the 'undo' command after the stack is empty in the Java TextEditor?

a)

Cannot undo. Stack is empty.

b)

The last action is undone successfully.

c)

The editor crashes immediately.

d)

A new empty action is added to the stack.

21.

Which command is used to exit the Java TextEditor application?

a)

exit

b)

close

c)

quit

d)

end

22.

In the Music Manager, what is the initial library of songs?

a)

[Song A, Song B, Song C]

b)

[Song A, Song B]

c)

[Song B, Song C]

d)

[Song A, Song C]

23.

In the Music Manager, after adding Song A and Song C to the playlist and viewing the playlist, what songs are in the playlist?

a)

[Song A, Song B]

b)

[Song A, Song C]

c)

[Song B, Song C]

d)

[Song A]

24.

In the Music Manager, what message is displayed after the command 'skip' is entered?

a)

Skipped song.

b)

Song paused.

c)

Song stopped.

d)

No song found.

25.

In the Social Media Feed Simulator, what is the first post added to the timeline?

a)

Enjoying the beautiful weather today.

b)

My first post!

c)

New notification

d)

Timeline

26.

In the Social Media Feed Simulator, what is the output after the first 'read notifications' command?

a)

New notification: Enjoying the beautiful weather today.

b)

No new notifications at this time.

c)

New notification: You have a friend request.

d)

New notification: Your post has been liked.

27.

Which command is used to place an order in the E-Commerce Order Processing system?

a)

process order

b)

place order [items]

c)

ship order

d)

view orders

28.

After placing orders for 'laptop, mouse' and 'keyboard, monitor', what is the correct sequence of commands to process and ship all orders?

a)

process order, process order, ship order, ship order

b)

ship order, process order, process order, ship order

c)

process order, ship order, process order, ship order

d)

ship order, ship order, process order, process order

29.

What does the 'view shipment stack' command display after both orders have been shipped?

a)

[] (an empty list)

b)

[Order1, Order2]

c)

[Shipped Orders]

d)

[Pending Shipments]

30.

Which command is used to check the number of available tickets in the Dynamic Ticketing System?

a)

sell ticket [type]

b)

process requests

c)

check availability

d)

view queue

31.

What happens when the command 'sell ticket VIP' is entered?

a)

VIP ticket added to queue.

b)

VIP ticket removed from queue.

c)

Regular ticket added to queue.

d)

VIP ticket sold out message displayed.

32.

After processing all requests, how many VIP tickets are remaining?

a)

3

b)

1

c)

2

d)

5

33.

After processing all requests, how many General tickets are remaining?

a)

9

b)

5

c)

12

d)

0

34.

What is the status of the VIP Queue after all requests are processed?

a)

A) [VIP Ticket 1, VIP Ticket 2]

b)

B) []

c)

C) [VIP Ticket 2]

d)

D) [VIP Ticket 1]

35.

What is the status of the General Queue after all requests are processed?

a)

[General Ticket 1]

b)

[]

c)

[General Ticket 2]

d)

[General Ticket 1, General Ticket 2]