NEW
Font size
WorksheetsFINAL QUIZ DATASTRUCTURE
Total questions: 70
Worksheet time: 1hrs 10mins
Queue follows which order of operation?
LIFO (Last-In-First-Out)
FIFO (First-In-First-Out)
FILO (First-In-Last-Out)
Random Order
In a queue, the data item inserted first will be accessed:
Last
Second
First
Randomly
Which of the following is a real-world example of a queue mentioned in the text?
A stack of plates
A single-lane one-way road
A bookshelf
A deck of cards
A queue is open at:
Only the top end
Only the bottom end
Both its ends
Neither end
Which pointer is used to access data from the front end (helping in dequeuing)?
Rear
Top
Front
Head
Which pointer is used to access data from the rear end (helping in enqueuing)?
A. Rear
B. Bottom
C. Front
D. Tail
Which operation is used to insert elements into the queue?
pop()
dequeue()
enqueue()
peek()
Which operation is used to remove elements from the queue?
push()
dequeue()
enqueue()
isFull()
In the enqueue algorithm, what is the first check performed?
Check if the queue is empty
Check if the queue is full
Increment the rear pointer
Access the front pointer
If you try to enqueue data into a full queue, what error is produced?
Underflow error
Overflow error
Null pointer exception
System crash
In the enqueue operation, if the queue is not full, what happens to the rear pointer?
It is decremented
It remains the same
It is incremented to point to the next empty space
It is set to null
What does the peek() operation do?
Removes the front element
Removes the rear element
Retrieves the frontmost element without deleting it
Checks if the queue is full
In the dequeue algorithm, what is the first check performed?
Check if the queue is full
Check if the queue is initialized
Check if the queue is empty
Check the rear pointer
If you try to dequeue from an empty queue, what error is produced?
Overflow error
Underflow error
Memory leak
Compilation error
Which real-world scenario is cited as an example of a queue?
Taking a plate from a buffet stack
Queues at ticket windows and bus stops
Organizing files on a desk
Shuffling a music playlist
Which of the following is an application of FIFO in disk scheduling?
Determining which file to delete first
Determining the order to service disk I/O requests
Organizing folders alphabetically
Compressing data packets
How are FIFOs used in communication networks?
To store passwords
To hold data packets en route to their destination
To encrypt messages
To delete browsing history
Which operation checks if the count of queue elements equals the queue size?
isEmpty()
peek()
isFull()
size()
What does the isEmpty() operation return if the queue element count is zero?
False
Null
-1
True
In the Java implementation provided, which interface is used to demonstrate FIFO?
Stack
Queue
Vector
Map
In the provided Java example, which class is instantiated to create the Queue object q?
ArrayList
Queue
LinkedList
Vector
Based on the Java output example, if the queue contains [0, 1, 2, 3, 4] and remove() is called, what element is removed?
A. 4
B. 3
C. 2
D. 0
After removing 0 from the queue [0, 1, 2, 3, 4], what is the new head of the queue?
0
1
2
4
In the enqueue algorithm, where is the data element added?
Where the front is pointing
Where the rear is pointing
At index 0 always
At the middle of the array
Which data structures can be used to implement a Queue ADT?
Only Arrays
Only Linked Lists
Arrays, Linked Lists, or Pointers
Only Pointers
In the provided Java isFull() function, the queue is considered full when:
A. front == 0 and rear == MAX_SIZE - 1
B. front == rear
C. rear == 0
D. front == MAX_SIZE
The dequeue operation increments which pointer after accessing data?
A. Rear pointer
B. Null pointer
C. Front pointer
D. Stack pointer
FIFO stands for:
First-In-Fast-Out
First-In-First-Out
Fast-In-First-Out
File-Input-File-Output
The peek() operation helps check the status of the queue using which pointer?
A. Rear
B. Middle
C. Front (implied by context of retrieving frontmost element)
D. Null
Which of the following is NOT a basic operation of a Queue?
enqueue()
dequeue()
push()
peek()
In the Java example, which method is used to view the head of the queue without removing it?
q.view()
q.top()
q.peek()
q.element()
In the Java example, the method q.add(i) corresponds to which queue operation?
Dequeue
Enqueue
Peek
IsEmpty
If a queue is implemented with an array, and capacity == rear, the queue is:
Empty
Full
Half-full
Invalid
In the C-style isEmpty function provided, the queue is empty when:
A. queue->size == 1
B. queue->size == 0
C. queue->front == 1
D. queue->rear == 0
A queue is different from a stack because a queue is:
Closed at both ends
Open at only one end
Open at both its ends
Only for integer storage
A linked list is a linear data structure where elements are called:
Cells
Blocks
Nodes
Vertexes
What are the two parts contained in each node of a linked list?
Index and Value
Data and Reference (link/pointer)
Key and Value
Data and Memory Address
The starting point or memory location of the first node in a linked list is denoted by:
TAIL
HEAD
START
NULL
The last node in a linked list points to:
The Head
The previous node
A NULL value
A random address
Unlike arrays, linked list elements are stored in:
Contiguous memory locations
Sequential memory sectors
Random memory locations
A single block of memory
In a Singly Linked List, each node has a reference to:
The previous node
Both the next and previous nodes
The next node in the sequence
The head node only
Which type of linked list has references to both the next and previous nodes?
Singly Linked List
Doubly Linked List
Circular Linked List
Linear Linked List
In a Circular Linked List, the last node's reference points back to:
NULL
The middle node
The first node
The previous node
Which of the following is NOT a common operation performed on Linked Lists?
A. Insertion
B. Deletion
C. Traversal
D. Defragmentation
Insertion in a linked list can be performed:
Only at the beginning
Only at the end
At the beginning, end, or in the middle
Only in the middle
"Iterating through the linked list" describes which operation?
Searching
Traversal
Updating
Sorting
Which operation involves merging two linked lists?
Reversing
Sorting
Merging
Updating
In the provided Java implementation, the Node class contains:
int data and Node next
int value and int pointer
String data and Node previous
Array list
In the Java LinkedList class, the constructor initializes this.head to:
0
1
null
A new Node
The method insertAtBeginning(int data) in the provided code first creates:
A null pointer
A new Node
A new Array
A loop
In insertAtBeginning, after creating newNode, what does newNode.next point to?
null
The current head
The new data
The tail
After setting newNode.next, what is head updated to?
null
newNode
The previous head
The tail
The display() method uses which variable to traverse the list?
Node current
Node temp
Node index
int i
The while loop in the display() method continues as long as:
current == null
current != null
current.next != null
head != null
In the main method example, the values inserted are 5, 10, and 15 (in that order). How are they displayed?
A. 5 10 15
B. 15 10 5
C. 5 15 10
D. 10 5 15
Why is the output 15 10 5 in the example?
Because the list is sorted automatically
Because insertAtBeginning adds new elements to the front (LIFO behavior for the head)
Because it is a circular list
Because the loop runs backwards
Linked List is considered what type of Data Type?
Primitive Data Type
Abstract Data Type (ADT)
Integer Data Type
Static Data Type
Which operation allows you to "Get the length" of the list?
Updating
Traversal
Length/Size
Searching
In the display() method, how does the pointer move to the next node?
current++
current = current.next
current = head
next = current
Searching in a linked list can be done by:
A. Value and Position
B. Only Value
C. Only Position
D. Only by Memory Address
Updating a linked list involves:
Changing the memory address of a node
Updating the node value
Deleting the node
Creating a new list
Which data structure is described as "linear" and connected via "references"?
Array
Linked List
Stack
Queue
What denotes the "length" of the linked list in the diagram provided?
The value of the last node
The number of nodes (e.g., Length = 4)
The size of the data type
The memory address
In the example diagram, the Tail node has data 2. What does its next field contain?
4
6
8
null
Which of the following is NOT a type of linked list listed?
Singly Linked List
Doubly Linked List
Circular Linked List
Triangular Linked List
"Reverse the linked list" is a sub-operation of:
Reversing
Merging
Sorting
Searching
In the example output, the elements are printed:
On separate lines
On the same line separated by a space
In a table format
In reverse order of memory address
The Node class constructor provided takes how many arguments?
Zero
One (int data)
Two (int data, Node next)
Three
In the Passenger/Flight Attendant table example, what acts as the "Link" or "Pointer"?
The Passenger Name
The Link/Pointer number column
The Row ID
The Flight Attendant Name
What allows linked list nodes to be stored in random memory locations?
The data value
The next reference/pointer connecting them
The Java compiler
The operating system
