wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

FINAL QUIZ DATASTRUCTURE

Total questions: 70

Worksheet time: 1hrs 10mins

Name
Class
Date
1.

Queue follows which order of operation?

a)

LIFO (Last-In-First-Out)

b)

FIFO (First-In-First-Out)

c)

FILO (First-In-Last-Out)

d)

Random Order

2.

In a queue, the data item inserted first will be accessed:

a)

Last

b)

Second

c)

First

d)

Randomly

3.

Which of the following is a real-world example of a queue mentioned in the text?

a)

A stack of plates

b)

A single-lane one-way road

c)

A bookshelf

d)

A deck of cards

4.

A queue is open at:

a)

Only the top end

b)

Only the bottom end

c)

Both its ends

d)

Neither end

5.

Which pointer is used to access data from the front end (helping in dequeuing)?

a)

Rear

b)

Top

c)

Front

d)

Head

6.

Which pointer is used to access data from the rear end (helping in enqueuing)?

a)

A. Rear

b)

B. Bottom

c)

C. Front

d)

D. Tail

7.

Which operation is used to insert elements into the queue?

a)

pop()

b)

dequeue()

c)

enqueue()

d)

peek()

8.

Which operation is used to remove elements from the queue?

a)

push()

b)

dequeue()

c)

enqueue()

d)

isFull()

9.

In the enqueue algorithm, what is the first check performed?

a)

Check if the queue is empty

b)

Check if the queue is full

c)

Increment the rear pointer

d)

Access the front pointer

10.

If you try to enqueue data into a full queue, what error is produced?

a)

Underflow error

b)

Overflow error

c)

Null pointer exception

d)

System crash

11.

In the enqueue operation, if the queue is not full, what happens to the rear pointer?

a)

It is decremented

b)

It remains the same

c)

It is incremented to point to the next empty space

d)

It is set to null

12.

What does the peek() operation do?

a)

Removes the front element

b)

Removes the rear element

c)

Retrieves the frontmost element without deleting it

d)

Checks if the queue is full

13.

In the dequeue algorithm, what is the first check performed?

a)

Check if the queue is full

b)

Check if the queue is initialized

c)

Check if the queue is empty

d)

Check the rear pointer

14.

If you try to dequeue from an empty queue, what error is produced?

a)

Overflow error

b)

Underflow error

c)

Memory leak

d)

Compilation error

15.

Which real-world scenario is cited as an example of a queue?

a)

Taking a plate from a buffet stack

b)

Queues at ticket windows and bus stops

c)

Organizing files on a desk

d)

Shuffling a music playlist

16.

Which of the following is an application of FIFO in disk scheduling?

a)

Determining which file to delete first

b)

Determining the order to service disk I/O requests

c)

Organizing folders alphabetically

d)

Compressing data packets

17.

How are FIFOs used in communication networks?

a)

To store passwords

b)

To hold data packets en route to their destination

c)

To encrypt messages

d)

To delete browsing history

18.

Which operation checks if the count of queue elements equals the queue size?

a)

isEmpty()

b)

peek()

c)

isFull()

d)

size()

19.

What does the isEmpty() operation return if the queue element count is zero?

a)

False

b)

Null

c)

-1

d)

True

20.

In the Java implementation provided, which interface is used to demonstrate FIFO?

a)

Stack

b)

Queue

c)

Vector

d)

Map

21.

In the provided Java example, which class is instantiated to create the Queue object q?

a)

ArrayList

b)

Queue

c)

LinkedList

d)

Vector

22.

Based on the Java output example, if the queue contains [0, 1, 2, 3, 4] and remove() is called, what element is removed?

a)

A. 4

b)

B. 3

c)

C. 2

d)

D. 0

23.

After removing 0 from the queue [0, 1, 2, 3, 4], what is the new head of the queue?

a)

0

b)

1

c)

2

d)

4

24.

In the enqueue algorithm, where is the data element added?

a)

Where the front is pointing

b)

Where the rear is pointing

c)

At index 0 always

d)

At the middle of the array

25.

Which data structures can be used to implement a Queue ADT?

a)

Only Arrays

b)

Only Linked Lists

c)

Arrays, Linked Lists, or Pointers

d)

Only Pointers

26.

In the provided Java isFull() function, the queue is considered full when:

a)

A. front == 0 and rear == MAX_SIZE - 1

b)

B. front == rear

c)

C. rear == 0

d)

D. front == MAX_SIZE

27.

The dequeue operation increments which pointer after accessing data?

a)

A. Rear pointer

b)

B. Null pointer

c)

C. Front pointer

d)

D. Stack pointer

28.

FIFO stands for:

a)

First-In-Fast-Out

b)

First-In-First-Out

c)

Fast-In-First-Out

d)

File-Input-File-Output

29.

The peek() operation helps check the status of the queue using which pointer?

a)

A. Rear

b)

B. Middle

c)

C. Front (implied by context of retrieving frontmost element)

d)

D. Null

30.

Which of the following is NOT a basic operation of a Queue?

a)

enqueue()

b)

dequeue()

c)

push()

d)

peek()

31.

In the Java example, which method is used to view the head of the queue without removing it?

a)

q.view()

b)

q.top()

c)

q.peek()

d)

q.element()

32.

In the Java example, the method q.add(i) corresponds to which queue operation?

a)

Dequeue

b)

Enqueue

c)

Peek

d)

IsEmpty

33.

If a queue is implemented with an array, and capacity == rear, the queue is:

a)

Empty

b)

Full

c)

Half-full

d)

Invalid

34.

In the C-style isEmpty function provided, the queue is empty when:

a)

A. queue->size == 1

b)

B. queue->size == 0

c)

C. queue->front == 1

d)

D. queue->rear == 0

35.

A queue is different from a stack because a queue is:

a)

Closed at both ends

b)

Open at only one end

c)

Open at both its ends

d)

Only for integer storage

36.

A linked list is a linear data structure where elements are called:

a)

Cells

b)

Blocks

c)

Nodes

d)

Vertexes

37.

What are the two parts contained in each node of a linked list?

a)

Index and Value

b)

Data and Reference (link/pointer)

c)

Key and Value

d)

Data and Memory Address

38.

The starting point or memory location of the first node in a linked list is denoted by:

a)

TAIL

b)

HEAD

c)

START

d)

NULL

39.

The last node in a linked list points to:

a)

The Head

b)

The previous node

c)

A NULL value

d)

A random address

40.

Unlike arrays, linked list elements are stored in:

a)

Contiguous memory locations

b)

Sequential memory sectors

c)

Random memory locations

d)

A single block of memory

41.

In a Singly Linked List, each node has a reference to:

a)

The previous node

b)

Both the next and previous nodes

c)

The next node in the sequence

d)

The head node only

42.

Which type of linked list has references to both the next and previous nodes?

a)

Singly Linked List

b)

Doubly Linked List

c)

Circular Linked List

d)

Linear Linked List

43.

In a Circular Linked List, the last node's reference points back to:

a)

NULL

b)

The middle node

c)

The first node

d)

The previous node

44.

Which of the following is NOT a common operation performed on Linked Lists?

a)

A. Insertion

b)

B. Deletion

c)

C. Traversal

d)

D. Defragmentation

45.

Insertion in a linked list can be performed:

a)

Only at the beginning

b)

Only at the end

c)

At the beginning, end, or in the middle

d)

Only in the middle

46.

"Iterating through the linked list" describes which operation?

a)

Searching

b)

Traversal

c)

Updating

d)

Sorting

47.

Which operation involves merging two linked lists?

a)

Reversing

b)

Sorting

c)

Merging

d)

Updating

48.

In the provided Java implementation, the Node class contains:

a)

int data and Node next

b)

int value and int pointer

c)

String data and Node previous

d)

Array list

49.

In the Java LinkedList class, the constructor initializes this.head to:

a)

0

b)

1

c)

null

d)

A new Node

50.

The method insertAtBeginning(int data) in the provided code first creates:

a)

A null pointer

b)

A new Node

c)

A new Array

d)

A loop

51.

In insertAtBeginning, after creating newNode, what does newNode.next point to?

a)

null

b)

The current head

c)

The new data

d)

The tail

52.

After setting newNode.next, what is head updated to?

a)

null

b)

newNode

c)

The previous head

d)

The tail

53.

The display() method uses which variable to traverse the list?

a)

Node current

b)

Node temp

c)

Node index

d)

int i

54.

The while loop in the display() method continues as long as:

a)

current == null

b)

current != null

c)

current.next != null

d)

head != null

55.

In the main method example, the values inserted are 5, 10, and 15 (in that order). How are they displayed?

a)

A. 5 10 15

b)

B. 15 10 5

c)

C. 5 15 10

d)

D. 10 5 15

56.

Why is the output 15 10 5 in the example?

a)

Because the list is sorted automatically

b)

Because insertAtBeginning adds new elements to the front (LIFO behavior for the head)

c)

Because it is a circular list

d)

Because the loop runs backwards

57.

Linked List is considered what type of Data Type?

a)

Primitive Data Type

b)

Abstract Data Type (ADT)

c)

Integer Data Type

d)

Static Data Type

58.

Which operation allows you to "Get the length" of the list?

a)

Updating

b)

Traversal

c)

Length/Size

d)

Searching

59.

In the display() method, how does the pointer move to the next node?

a)

current++

b)

current = current.next

c)

current = head

d)

next = current

60.

Searching in a linked list can be done by:

a)

A. Value and Position

b)

B. Only Value

c)

C. Only Position

d)

D. Only by Memory Address

61.

Updating a linked list involves:

a)

Changing the memory address of a node

b)

Updating the node value

c)

Deleting the node

d)

Creating a new list

62.

Which data structure is described as "linear" and connected via "references"?

a)

Array

b)

Linked List

c)

Stack

d)

Queue

63.

What denotes the "length" of the linked list in the diagram provided?

a)

The value of the last node

b)

The number of nodes (e.g., Length = 4)

c)

The size of the data type

d)

The memory address

64.

In the example diagram, the Tail node has data 2. What does its next field contain?

a)

4

b)

6

c)

8

d)

null

65.

Which of the following is NOT a type of linked list listed?

a)

Singly Linked List

b)

Doubly Linked List

c)

Circular Linked List

d)

Triangular Linked List

66.

"Reverse the linked list" is a sub-operation of:

a)

Reversing

b)

Merging

c)

Sorting

d)

Searching

67.

In the example output, the elements are printed:

a)

On separate lines

b)

On the same line separated by a space

c)

In a table format

d)

In reverse order of memory address

68.

The Node class constructor provided takes how many arguments?

a)

Zero

b)

One (int data)

c)

Two (int data, Node next)

d)

Three

69.

In the Passenger/Flight Attendant table example, what acts as the "Link" or "Pointer"?

a)

The Passenger Name

b)

The Link/Pointer number column

c)

The Row ID

d)

The Flight Attendant Name

70.

What allows linked list nodes to be stored in random memory locations?

a)

The data value

b)

The next reference/pointer connecting them

c)

The Java compiler

d)

The operating system