Font size
WorksheetsData Structures Quiz
Total questions: 55
Worksheet time: 1hrs 18mins
What are the two essential cases in any recursive algorithm?
Base case and Iterative case
Base case and Recursive case
Recursive case and Termination case
Loop case and Exit case
In recursion, the base case is:
A simple occurrence that can be solved directly
A complex problem that needs further recursion
A case that terminates the computer
A repeated loop that never stops
What is an array?
A collection of nodes pointing to each other
A data structure that stores elements of the same type in a fixed size
A database for storing numbers
A dynamic list of elements
In Java, array indices start from:
1
0
-1
Any number
What is the time complexity of accessing an element in an array using its index?
O(1)
O(n)
O(log n)
O(n²)
A two-dimensional array can be visualized as:
A stack
A linked list
A table with rows and columns
A single-row list
What is NOT a basic operation of an array?
Traversing
Inserting
Searching
Merging two arrays into a single node
What is a major limitation of arrays?
Dynamic size
Fixed size
No storage requirement
Can only store strings
How is a linked list different from an array?
It uses pointers to link elements dynamically
It stores elements in a contiguous memory location
It does not allow deletion of elements
It has a fixed size
A node in a singly linked list contains:
Only data
Data and a reference to the next node
Data and two references (next and previous)
Only a reference to another node
In a singly linked list, the first node is called:
Tail
Head
Middle
Node pointer
In a doubly linked list, each node has:
Only one reference to the next node
Two references: one to the next node and one to the previous node
No references
Three references: previous, next, and middle
What happens in a circular linked list?
The last node links back to the first node
Each node has multiple links
The linked list is stored in an array
It has only one node
What is a key advantage of linked lists?
Faster access time than arrays
Fixed size allocation
Easy insertion and deletion
Uses less memory than arrays
What is a major disadvantage of linked lists?
Slow traversal compared to arrays
Fixed size
Inefficient insertion and deletion
Cannot be used to store data
What is the best way to access the 10th element in an array?
Looping through all elements
Using array[10]
Searching sequentially
Using a linked list
Inserting an element at the head of a linked list requires:
Updating the tail node
Setting the new node’s next to reference the old head
Shifting all elements
Sorting the list first
In a linked list, a sentinel node is used to:
Store important data
Simplify operations such as insertion
Increase memory usage
Create infinite loops
The main application of linked lists in operating systems is:
Managing process scheduling
Storing large databases
Running antivirus software
Creating spreadsheets
Which real-world application uses linked lists?
Web browsers (back and forward navigation)
Calculators
Image compression
Chess engines
Which of the following is NOT an operation that can be performed on an array?
Insertion
Deletion
Searching
Multiplication
In an array, what operation involves shifting elements after removing an item?
Traversing
Deletion
Searching
Sorting
In an array, elements are accessed using:
Pointers
Indices
Addresses
Loops only
Which of the following is an application of arrays?
Storing records in a database
Implementing web pages
Running a music player
Managing process scheduling
Which operation is the fastest in an array?
Searching
Accessing an element using an index
Deleting an element
Inserting at the beginning
What is an advantage of arrays?
Dynamic size
Fast access to elements using an index
Easy deletion of elements
No memory requirement
What happens when you insert an element in the middle of an array?
The array expands automatically
All elements after the insertion point shift one position
The array resets all values
The operation fails
Which of the following operations is difficult to perform efficiently in an array?
Accessing an element
Deleting an element from the middle
Traversing
Storing elements
Which of the following data structures is preferred when inserting and deleting elements frequently?
Array
Linked List
Stack
Graph
A linked list is best suited for which application?
Implementing an operating system scheduler
Storing a fixed number of student records
Performing mathematical calculations
Designing a calculator
What makes a linked list better than an array in certain cases?
It uses less memory
It allows fast insertion and deletion of elements
It does not require pointers
It has a fixed size
What is a common application of linked lists in web browsers?
Managing browser history (back and forward navigation)
Playing videos
Running JavaScript code
Storing cookies
Which of the following is an example of a real-world application of a linked list?
Image viewers for next/previous navigation
Storing employee records in a fixed database
Performing matrix multiplication
Searching files on a hard drive
What operation is faster in a linked list compared to an array?
Inserting an element in the middle
Accessing an element by index
Sorting elements
Performing arithmetic calculations
Which linked list operation requires modifying only two links?
Insertion at the end
Deleting a node in the middle
Traversing the list
Searching for a value
Every recursive algorithm must have at least one base case and one recursive case.
An array’s size can be changed dynamically.
In an array, accessing an element by its index is an O(1) operation.
A linked list is stored in contiguous memory like an array.
A singly linked list allows traversal in both directions.
A doubly linked list has two links per node: one to the next node and one to the previous node.
A circular linked list allows traversal from the last node back to the first node.
A linked list is better than an array when frequent insertions and deletions are required.
Arrays use more memory than linked lists due to additional pointer storage.
To access the 10th node in a linked list, all preceding nodes must be traversed.
Linked lists are used in music players for playlist navigation.
Linked lists are not used in web browsers.
Removing an element from a linked list is always O(1).
A linked list can dynamically increase in size as needed.
The first node in a linked list is called the tail.
The sentinel node in a linked list stores data.
A doubly linked list allows easier backward traversal compared to a singly linked list.
Stacks and queues can be implemented using linked lists.
Searching in a linked list is always faster than in an array.
Linked lists are used in operating systems for process scheduling.
